Everywhere yoda conditions are
This commit is contained in:
@ -60,7 +60,7 @@ class Arr {
|
||||
);
|
||||
|
||||
if ($flag) {
|
||||
$result = $flag === self::RESULTS_FIRST ? reset($result) : end($result);
|
||||
$result = self::RESULTS_FIRST === $flag ? reset($result) : end($result);
|
||||
}
|
||||
|
||||
return $result;
|
||||
|
@ -31,6 +31,7 @@ class Screenshot {
|
||||
public static function api_url($domain): string {
|
||||
return 'https://image.thum.io/get/' . $domain;
|
||||
}
|
||||
|
||||
/**
|
||||
* Takes in a URL and creates it as an attachment.
|
||||
*
|
||||
@ -45,6 +46,7 @@ class Screenshot {
|
||||
|
||||
return self::save_image_from_url($url);
|
||||
}
|
||||
|
||||
/**
|
||||
* Downloads the image from the URL.
|
||||
*
|
||||
|
@ -34,7 +34,7 @@ class WP_Config {
|
||||
|
||||
$config_path = $this->get_wp_config_path();
|
||||
|
||||
if ( ! is_writeable($config_path)) {
|
||||
if ( ! is_writable($config_path)) {
|
||||
|
||||
// translators: %s is the file name.
|
||||
return new \WP_Error('not-writeable', sprintf(__('The file %s is not writable', 'wp-ultimo'), $config_path));
|
||||
@ -46,12 +46,12 @@ class WP_Config {
|
||||
|
||||
$content = str_pad(sprintf("define( '%s', '%s' );", $constant, $value), 50) . '// Automatically injected by WP Multisite WaaS;';
|
||||
|
||||
if ($line === false) {
|
||||
if (false === $line) {
|
||||
|
||||
// no defined, we just need to inject
|
||||
$hook_line = $this->find_reference_hook_line($config);
|
||||
|
||||
if ($hook_line === false) {
|
||||
if (false === $hook_line) {
|
||||
return new \WP_Error('unknown-wpconfig', __("WP Multisite WaaS can't recognize your wp-config.php, please revert it to original state for further process.", 'wp-ultimo'));
|
||||
}
|
||||
|
||||
@ -61,7 +61,7 @@ class WP_Config {
|
||||
} else {
|
||||
[$value, $line] = $line;
|
||||
|
||||
if ($value !== true) {
|
||||
if (true !== $value) {
|
||||
$config[ $line ] = $content . PHP_EOL;
|
||||
|
||||
return file_put_contents($config_path, implode('', $config), LOCK_EX);
|
||||
@ -177,7 +177,7 @@ class WP_Config {
|
||||
|
||||
$config_path = $this->get_wp_config_path();
|
||||
|
||||
if ( ! is_writeable($config_path)) {
|
||||
if ( ! is_writable($config_path)) {
|
||||
|
||||
// translators: %s is the file name.
|
||||
return new \WP_Error('not-writeable', sprintf(__('The file %s is not writable', 'wp-ultimo'), $config_path));
|
||||
@ -187,14 +187,14 @@ class WP_Config {
|
||||
|
||||
$line = $this->find_injected_line($config, $constant);
|
||||
|
||||
if ($line === false) {
|
||||
if (false === $line) {
|
||||
return;
|
||||
} else {
|
||||
$value = $line[0];
|
||||
|
||||
$line = $line[1];
|
||||
|
||||
if ($value === 'true' || $value === '1') {
|
||||
if ('true' === $value || '1' === $value) {
|
||||
|
||||
// value is true, we will remove this
|
||||
unset($config[ $line ]);
|
||||
@ -204,6 +204,7 @@ class WP_Config {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks for the injected line inside of the wp-config.php file.
|
||||
*
|
||||
|
@ -28,6 +28,7 @@ class City extends Rule {
|
||||
* @var array
|
||||
*/
|
||||
protected $fillableParams = ['country', 'state'];
|
||||
|
||||
/**
|
||||
* Performs the actual check.
|
||||
*
|
||||
|
@ -84,6 +84,7 @@ class Unique extends Rule {
|
||||
if ( ! $existing) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( $existing instanceof \WP_User) {
|
||||
$id = $existing->ID;
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user