Skip to content
Permalink
Browse files

Php Inspections (EA Ultimate): minor code tweaks

  • Loading branch information...
vladimir.reznichenko
vladimir.reznichenko committed Jun 28, 2018
1 parent c0d6f8f commit b991c2c70f68c8f8be8b609c98c0ff950a00f234
@@ -329,7 +329,7 @@ public function getConfig($key = null, $default = null)
*/
public function configShallow($key, $value = null)
{
$this->_paginator->configShallow($key, $value = null);
$this->_paginator->configShallow($key, null);
return $this;
}
@@ -207,10 +207,8 @@ function env($key, $default = null)
return (strpos((string)env('SCRIPT_URI'), 'https://') === 0);
}
if ($key === 'SCRIPT_NAME') {
if (env('CGI_MODE') && isset($_ENV['SCRIPT_URL'])) {
$key = 'SCRIPT_URL';
}
if ($key === 'SCRIPT_NAME' && env('CGI_MODE') && isset($_ENV['SCRIPT_URL'])) {
$key = 'SCRIPT_URL';
}
$val = null;
@@ -109,10 +109,8 @@ public function create()
{
$dir = $this->Folder->pwd();
if (is_dir($dir) && is_writable($dir) && !$this->exists()) {
if (touch($this->path)) {
return true;
}
if (is_dir($dir) && is_writable($dir) && !$this->exists() && touch($this->path)) {
return true;
}
return false;
@@ -1107,8 +1107,8 @@ public function getHeaders()
$name = $key;
}
if ($name !== null) {
$name = strtr(strtolower($name), '_', ' ');
$name = strtr(ucwords($name), ' ', '-');
$name = str_replace('_', ' ', strtolower($name));
$name = str_replace(' ', '-', ucwords($name));
$headers[$name] = (array)$value;
}
}
@@ -569,7 +569,7 @@ public function merge(EntityInterface $entity, array $data, array $options = [])
$errors = $this->_validate($data + $keys, $options, $isNew);
$options['isMerge'] = true;
$propertyMap = $this->_buildPropertyMap($data, $options);
$properties = $marshalledAssocs = [];
$properties = [];
foreach ($data as $key => $value) {
if (!empty($errors[$key])) {
if ($entity instanceof InvalidPropertyInterface) {
@@ -678,7 +678,7 @@ protected function _castToString($data)
}
if (is_array($value)) {
$looksLikeFile = isset($value['error']) && isset($value['tmp_name']) && isset($value['size']);
$looksLikeFile = isset($value['error'], $value['tmp_name'], $value['size']);
if ($looksLikeFile) {
continue;
}
@@ -208,10 +208,8 @@ public static function cc($check, $type = 'fast', $deep = false, $regex = null)
return false;
}
if ($regex !== null) {
if (static::_check($check, $regex)) {
return !$deep || static::luhn($check);
}
if ($regex !== null && static::_check($check, $regex)) {
return !$deep || static::luhn($check);
}
$cards = [
'all' => [
@@ -1293,7 +1293,7 @@ protected function _getViewFileName($name = null)
if (strlen($this->subDir)) {
$subDir = $this->subDir . DIRECTORY_SEPARATOR;
// Check if templatePath already terminates with subDir
if ($templatePath != $subDir && substr($templatePath, -(strlen($subDir))) == $subDir) {
if ($templatePath != $subDir && substr($templatePath, -strlen($subDir)) == $subDir) {
$subDir = '';
}
}

0 comments on commit b991c2c

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