Skip to content

Commit

Permalink
Fix PHP warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
arunshenoy99 committed Mar 19, 2024
1 parent 7375873 commit 9aeae86
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 9aeae86

Please sign in to comment.