Passed
Push — master ( 2a417c...c27bb9 )
by Jean
03:40
created
src/Rule/AbstractRule.php 2 patches
Doc Comments   +2 added lines patch added patch discarded remove patch
@@ -42,6 +42,8 @@
 block discarded – undo
42 42
     }
43 43
 
44 44
     /**
45
+     * @param string $symbolic_operator
46
+     * @return string
45 47
      */
46 48
     public static function findEnglishOperator($symbolic_operator)
47 49
     {
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -33,9 +33,9 @@  discard block
 block discarded – undo
33 33
      */
34 34
     public static function findSymbolicOperator($english_operator)
35 35
     {
36
-        $association = array_flip( self::$ruleAliases );
37
-        if (isset($association[ $english_operator ])) {
38
-            return $association[ $english_operator ];
36
+        $association = array_flip(self::$ruleAliases);
37
+        if (isset($association[$english_operator])) {
38
+            return $association[$english_operator];
39 39
         }
40 40
 
41 41
         return $english_operator;
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
     public static function findEnglishOperator($symbolic_operator)
47 47
     {
48 48
         $association = self::$ruleAliases;
49
-        if (isset($association[ $symbolic_operator ])) {
50
-            return $association[ $symbolic_operator ];
49
+        if (isset($association[$symbolic_operator])) {
50
+            return $association[$symbolic_operator];
51 51
         }
52 52
 
53 53
         return $symbolic_operator;
@@ -66,16 +66,16 @@  discard block
 block discarded – undo
66 66
      *
67 67
      * @return AbstractRule
68 68
      */
69
-    public static function generateSimpleRule($field, $type, $values, array $options=[])
69
+    public static function generateSimpleRule($field, $type, $values, array $options = [])
70 70
     {
71
-        $cache_key = hash('md4', serialize( func_get_args()) );
71
+        $cache_key = hash('md4', serialize(func_get_args()));
72 72
         if (isset(self::$static_cache['rules_generation'][$cache_key])) {
73 73
             return self::$static_cache['rules_generation'][$cache_key]->copy();
74 74
         }
75 75
 
76 76
         $ruleClass = self::getRuleClass($type);
77 77
 
78
-        return self::$static_cache['rules_generation'][$cache_key] = new $ruleClass( $field, $values, $options );
78
+        return self::$static_cache['rules_generation'][$cache_key] = new $ruleClass($field, $values, $options);
79 79
     }
80 80
 
81 81
     /**
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
             . str_replace('_', '', ucwords($english_rule_operator, '_'))
93 93
             . 'Rule';
94 94
 
95
-        if ( ! class_exists( $rule_class)) {
95
+        if (!class_exists($rule_class)) {
96 96
             throw new \InvalidArgumentException(
97 97
                 "The class '$rule_class' corresponding to the  operator "
98 98
                 ."'$rule_operator' / '$english_rule_operator' cannot be found."
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
      *
122 122
      * @return $this
123 123
      */
124
-    final public function dump($exit=false, array $options=[])
124
+    final public function dump($exit = false, array $options = [])
125 125
     {
126 126
         $default_options = [
127 127
             'callstack_depth' => 2,
@@ -129,18 +129,18 @@  discard block
 block discarded – undo
129 129
             // 'show_instance'   => false,
130 130
         ];
131 131
         foreach ($default_options as $default_option => &$default_value) {
132
-            if ( ! isset($options[ $default_option ])) {
133
-                $options[ $default_option ] = $default_value;
132
+            if (!isset($options[$default_option])) {
133
+                $options[$default_option] = $default_value;
134 134
             }
135 135
         }
136 136
         extract($options);
137 137
 
138 138
         $bt     = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, $callstack_depth);
139
-        $caller = $bt[ $callstack_depth - 2 ];
139
+        $caller = $bt[$callstack_depth - 2];
140 140
 
141
-        echo "\n" . $caller['file'] . ':' . $caller['line'] . "\n";
141
+        echo "\n".$caller['file'].':'.$caller['line']."\n";
142 142
         if ('string' == $mode) {
143
-            if ( ! isset($options['indent_unit'])) {
143
+            if (!isset($options['indent_unit'])) {
144 144
                 $options['indent_unit'] = "    ";
145 145
             }
146 146
 
@@ -158,10 +158,10 @@  discard block
 block discarded – undo
158 158
             }
159 159
         }
160 160
         elseif ('xdebug' == $mode) {
161
-            if ( ! function_exists('xdebug_is_enabled')) {
161
+            if (!function_exists('xdebug_is_enabled')) {
162 162
                 throw new \RuntimeException("Xdebug is not installed");
163 163
             }
164
-            if ( ! xdebug_is_enabled()) {
164
+            if (!xdebug_is_enabled()) {
165 165
                 throw new \RuntimeException("Xdebug is disabled");
166 166
             }
167 167
 
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
         else {
182 182
             throw new \InvalidArgumentException(
183 183
                  "'mode' option must belong to ['string', 'export', 'dump'] "
184
-                ."instead of " . var_export($mode, true)
184
+                ."instead of ".var_export($mode, true)
185 185
             );
186 186
         }
187 187
         echo "\n\n";
@@ -273,9 +273,9 @@  discard block
 block discarded – undo
273 273
         }
274 274
 
275 275
         // return hash('crc32b', serialize( $this->toArray() ));
276
-        return hash('md4', serialize( $this->toArray(['semantic' => true]) ))  // faster but longer
276
+        return hash('md4', serialize($this->toArray(['semantic' => true])))  // faster but longer
277 277
               .'-'
278
-              .hash('md4', serialize( $this->options ))
278
+              .hash('md4', serialize($this->options))
279 279
               ;
280 280
     }
281 281
 
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
         }
308 308
         elseif ($this instanceof OrRule) {
309 309
             foreach ($this->operands as $i => $operand) {
310
-                if ( ! $operand instanceof AndRule) {
310
+                if (!$operand instanceof AndRule) {
311 311
                     $this->operands[$i] = new AndRule([$operand]);
312 312
                 }
313 313
             }
Please login to merge, or discard this patch.