Browse Source

SCA with Php Inspections (EA Ultimate): reverts as per code review

Vladimir Reznichenko 8 years ago
parent
commit
7220686ef8

+ 4 - 2
src/Console/ConsoleIo.php

@@ -455,8 +455,9 @@ class ConsoleIo
             $defaultText = "[$default] ";
         }
         $this->_out->write('<question>' . $prompt . "</question>$optionsText\n$defaultText> ", 0);
+        $result = $this->_in->read();
 
-        $result = trim($this->_in->read());
+        $result = trim($result);
         if ($default !== null && ($result === '' || $result === null)) {
             return $default;
         }
@@ -550,7 +551,8 @@ class ConsoleIo
 
         if (file_exists($path) && $forceOverwrite === false) {
             $this->warning("File `{$path}` exists");
-            $key = strtolower($this->askChoice('Do you want to overwrite?', ['y', 'n', 'a', 'q'], 'n'));
+            $key = $this->askChoice('Do you want to overwrite?', ['y', 'n', 'a', 'q'], 'n');
+            $key = strtolower($key);
 
             if ($key === 'q') {
                 $this->error('Quitting.', 2);

+ 2 - 1
src/Core/Plugin.php

@@ -241,7 +241,8 @@ class Plugin
             }
         }
         if (Configure::check('plugins')) {
-            $plugins = array_unique(array_merge($plugins, array_keys(Configure::read('plugins'))));
+            $plugins = array_merge($plugins, array_keys(Configure::read('plugins')));
+            $plugins = array_unique($plugins);
         }
 
         $collection = static::getCollection();

+ 2 - 1
src/Event/EventManager.php

@@ -366,7 +366,8 @@ class EventManager implements EventManagerInterface
         $globalListeners = static::instance()->prioritisedListeners($eventKey);
         $globalListeners = empty($globalListeners) ? [] : $globalListeners;
 
-        $priorities = array_unique(array_merge(array_keys($globalListeners), array_keys($localListeners)));
+        $priorities = array_merge(array_keys($globalListeners), array_keys($localListeners));
+        $priorities = array_unique($priorities);
         asort($priorities);
 
         $result = [];

+ 2 - 1
src/Utility/Hash.php

@@ -712,7 +712,8 @@ class Hash
     {
         $result = [];
         foreach ($data as $flat => $value) {
-            $keys = array_reverse(explode($separator, $flat));
+            $keys = explode($separator, $flat);
+            $keys = array_reverse($keys);
             $child = [
                 $keys[0] => $value
             ];

+ 2 - 1
src/View/Helper/HtmlHelper.php

@@ -355,7 +355,8 @@ class HtmlHelper extends Helper
             unset($options['fullBase']);
         } else {
             $url = $this->Url->build($title);
-            $title = h(urldecode(htmlspecialchars_decode($url, ENT_QUOTES)));
+            $title = htmlspecialchars_decode($url, ENT_QUOTES);
+            $title = h(urldecode($title));
             $escapeTitle = false;
         }