Skip to content

Commit

Permalink
Merge pull request #18 from newfold-labs/fix/deprecated-warnings
Browse files Browse the repository at this point in the history
Fix PHP warnings
  • Loading branch information
arunshenoy99 authored Mar 19, 2024
2 parents c6cb9ae + 9aeae86 commit 26e0440
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 19 deletions.
14 changes: 0 additions & 14 deletions includes/Models/PriorityQueue.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,6 @@
*/
class PriorityQueue extends \SplPriorityQueue {

/**
* Defines the logic to use when comparing two priorities.
*
* @param mixed $priority1 First Priority Queue
* @param mixed $priority2 Second Priority Queue
* @return int
*/
public function compare( $priority1, $priority2 ) : int {
if ( $priority1 === $priority2 ) {
return 0;
}
return $priority1 < $priority2 ? -1 : 1;
}

/**
* Converts the max heap to an array.
*
Expand Down
10 changes: 5 additions & 5 deletions includes/Services/PluginInstaller.php
Original file line number Diff line number Diff line change
Expand Up @@ -309,11 +309,11 @@ public static function get_plugin_type( $plugin ) {
*
* @param string $plugin The slug of the plugin.
* @param string $plugin_type The type of plugin.
* @return string
* @return string|false
*/
public static function get_plugin_path( $plugin, $plugin_type ) {
$plugin_list = Plugins::get();
return $plugin_list[ $plugin_type ][ $plugin ]['path'];
return isset( $plugin_list[ $plugin_type ][ $plugin ] ) ? $plugin_list[ $plugin_type ][ $plugin ]['path'] : false;
}

/**
Expand All @@ -326,7 +326,7 @@ public static function get_plugin_path( $plugin, $plugin_type ) {
public static function exists( $plugin, $activate ) {
$plugin_type = self::get_plugin_type( $plugin );
$plugin_path = self::get_plugin_path( $plugin, $plugin_type );
if ( ! self::is_plugin_installed( $plugin_path ) ) {
if ( ! ( $plugin_path && self::is_plugin_installed( $plugin_path ) ) ) {
return false;
}

Expand Down Expand Up @@ -355,7 +355,7 @@ public static function is_active( $plugin_path ) {
public static function activate( $plugin ) {
$plugin_type = self::get_plugin_type( $plugin );
$plugin_path = self::get_plugin_path( $plugin, $plugin_type );
if ( ! self::is_plugin_installed( $plugin_path ) ) {
if ( ! ( $plugin_path && self::is_plugin_installed( $plugin_path ) ) ) {
return false;
}

Expand All @@ -376,7 +376,7 @@ public static function activate( $plugin ) {
public static function deactivate( $plugin ) {
$plugin_type = self::get_plugin_type( $plugin );
$plugin_path = self::get_plugin_path( $plugin, $plugin_type );
if ( ! self::is_plugin_installed( $plugin_path ) ) {
if ( ! ( $plugin_path && self::is_plugin_installed( $plugin_path ) ) ) {
return false;
}

Expand Down

0 comments on commit 26e0440

Please sign in to comment.