Skip to content
Permalink
Browse files

SCA with Php Inspections (EA Ultimate): tweak misused functions calls

  • Loading branch information...
kalessil committed Apr 27, 2018
1 parent fd0e9b8 commit c160b876d1c4ff5f8c24a10974acddb581840442
@@ -345,7 +345,7 @@ public static function isAbsolute($path)
*/
public static function isRegisteredStreamWrapper($path)
{
return preg_match('/^[^:\/\/]+?(?=:\/\/)/i', $path, $matches) &&
return preg_match('/^[^:\/\/]+?(?=:\/\/)/', $path, $matches) &&
in_array($matches[0], stream_get_wrappers());
}
@@ -360,11 +360,7 @@ protected function _buildAuth($data)
*/
protected function _encode($value)
{
return str_replace(
'+',
' ',
str_replace('%7E', '~', rawurlencode($value))
);
return str_replace(['%7E', '+'], ['~', ' '], rawurlencode($value));
}
}
@@ -481,7 +481,7 @@ function ($ent) use ($primaryKey) {
)
->filter(
function ($v) {
return !in_array(null, array_values($v), true);
return !in_array(null, $v, true);
}
)
->toArray();
@@ -360,7 +360,7 @@ protected function _writeRoute()
$mode = 'u';
}
krsort($routeParams);
$parsed = str_replace(array_keys($routeParams), array_values($routeParams), $parsed);
$parsed = str_replace(array_keys($routeParams), $routeParams, $parsed);
$this->_compiledRoute = '#^' . $parsed . '[/]*$#' . $mode;
$this->keys = $names;
@@ -189,7 +189,7 @@ protected function _loadFixtures($test)
} elseif ($type === 'plugin') {
list($plugin, $name) = explode('.', $pathName);
// Flip vendored plugin separators
$path = implode('\\', explode('/', $plugin));
$path = str_replace('/', '\\', $plugin);
$baseNamespace = Inflector::camelize(str_replace('\\', '\ ', $path));
$additionalPath = null;
} else {
@@ -199,7 +199,7 @@ protected function _loadFixtures($test)
// Tweak subdirectory names, so camelize() can make the correct name
if (strpos($name, '/') > 0) {
$name = implode('\\ ', explode('/', $name));
$name = str_replace('/', '\\ ', $name);
}
$name = Inflector::camelize($name);
@@ -764,7 +764,7 @@ public static function slug($string, $replacement = '-')
$string = str_replace(
array_keys(static::$_transliteration),
array_values(static::$_transliteration),
static::$_transliteration,
$string
);
@@ -718,8 +718,7 @@ public static function decimal($check, $places = null, $regex = null)
$decimalPoint = $formatter->getSymbol(NumberFormatter::DECIMAL_SEPARATOR_SYMBOL);
$groupingSep = $formatter->getSymbol(NumberFormatter::GROUPING_SEPARATOR_SYMBOL);
$check = str_replace($groupingSep, '', $check);
$check = str_replace($decimalPoint, '.', $check);
$check = str_replace([$groupingSep, $decimalPoint], ['', '.'], $check);
return static::_check($check, $regex);
}
@@ -180,7 +180,7 @@ protected function _compileTemplates(array $templates = [])
}
$template = str_replace('%', '%%', $template);
preg_match_all('#\{\{([\w\d\._]+)\}\}#', $template, $matches);
preg_match_all('#\{\{([\w\._]+)\}\}#', $template, $matches);
$this->_compiled[$name] = [
str_replace($matches[0], '%s', $template),
$matches[1]

0 comments on commit c160b87

Please sign in to comment.
You can’t perform that action at this time.