@@ -24,7 +24,7 @@ |
||
24 | 24 | */ |
25 | 25 | public function checkInstallation() { |
26 | 26 | $result = shell_exec('circo -V 2>&1'); |
27 | - if(!preg_match('!graphviz version!', $result)) { |
|
27 | + if (!preg_match('!graphviz version!', $result)) { |
|
28 | 28 | throw new \RuntimeException('Graphviz not installed'); |
29 | 29 | } |
30 | 30 | } |
@@ -53,7 +53,7 @@ |
||
53 | 53 | ; |
54 | 54 | |
55 | 55 | $config |
56 | - ->setRuleSet(new RuleSet( (array) $array['rules'])) |
|
56 | + ->setRuleSet(new RuleSet((array) $array['rules'])) |
|
57 | 57 | ->setFailureCondition($array['failure']) |
58 | 58 | ->setPath($path) |
59 | 59 | ->setLogging(new LoggingConfiguration($array['logging'])) |
@@ -43,7 +43,7 @@ |
||
43 | 43 | */ |
44 | 44 | public function load($filename) { |
45 | 45 | |
46 | - if(!\file_exists($filename) ||!\is_readable($filename)) { |
|
46 | + if (!\file_exists($filename) || !\is_readable($filename)) { |
|
47 | 47 | throw new \RuntimeException('configuration file is not accessible'); |
48 | 48 | } |
49 | 49 | $content = file_get_contents($filename); |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | public function evaluate($rule) { |
61 | 61 | $result = new Evaluation; |
62 | 62 | |
63 | - if(0 == strlen($rule) ||is_null($rule)) { |
|
63 | + if (0 == strlen($rule) || is_null($rule)) { |
|
64 | 64 | return $result; |
65 | 65 | } |
66 | 66 | |
@@ -69,16 +69,16 @@ discard block |
||
69 | 69 | $context = new \Hoa\Ruler\Context(); |
70 | 70 | |
71 | 71 | // general |
72 | - foreach($bounds->asArray() as $category => $values) { |
|
72 | + foreach ($bounds->asArray() as $category => $values) { |
|
73 | 73 | $context[$category] = (object) $values; |
74 | 74 | } |
75 | 75 | |
76 | 76 | // by package |
77 | - foreach($this->aggregatedResults as $aggregate) { |
|
77 | + foreach ($this->aggregatedResults as $aggregate) { |
|
78 | 78 | $array = $aggregate->asArray(); |
79 | 79 | $c = array(); |
80 | - foreach($array as $k => $v) { |
|
81 | - if(is_array($v)) { |
|
80 | + foreach ($array as $k => $v) { |
|
81 | + if (is_array($v)) { |
|
82 | 82 | $v = (object) $v; |
83 | 83 | } |
84 | 84 | $c[$k] = $v; |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | |
90 | 90 | try { |
91 | 91 | $result->setValid(true === $ruler->assert($rule, $context)); |
92 | - } catch(\Hoa\Ruler\Exception\Asserter $e) { |
|
92 | + } catch (\Hoa\Ruler\Exception\Asserter $e) { |
|
93 | 93 | throw new \LogicException(sprintf('Cannot evaluate rule : %s', $e->getMessage())); |
94 | 94 | } |
95 | 95 | return $result; |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | public function find($path) |
69 | 69 | { |
70 | 70 | $files = array(); |
71 | - if(is_dir($path)) { |
|
71 | + if (is_dir($path)) { |
|
72 | 72 | $path = rtrim($path, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR; |
73 | 73 | $directory = new RecursiveDirectoryIterator($path, $this->flags); |
74 | 74 | $iterator = new RecursiveIteratorIterator($directory); |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | $filterRegex = sprintf( |
77 | 77 | '`^%s%s$`', |
78 | 78 | !empty($this->excludedDirs) ? '((?!'.$this->excludedDirs.').)+' : '.+', |
79 | - '\.(' . $this->extensions . ')' |
|
79 | + '\.('.$this->extensions.')' |
|
80 | 80 | ); |
81 | 81 | |
82 | 82 | $filteredIterator = new RegexIterator( |
@@ -85,10 +85,10 @@ discard block |
||
85 | 85 | \RecursiveRegexIterator::GET_MATCH |
86 | 86 | ); |
87 | 87 | |
88 | - foreach($filteredIterator as $file) { |
|
88 | + foreach ($filteredIterator as $file) { |
|
89 | 89 | $files[] = $file[0]; |
90 | 90 | } |
91 | - } elseif(is_file($path)) { |
|
91 | + } elseif (is_file($path)) { |
|
92 | 92 | $files = array($path); |
93 | 93 | } |
94 | 94 | return $files; |
@@ -24,7 +24,7 @@ |
||
24 | 24 | * @return int |
25 | 25 | */ |
26 | 26 | public function isCorrect($filename) { |
27 | - if(1 === version_compare('5.0.4', PHP_VERSION)) { |
|
27 | + if (1 === version_compare('5.0.4', PHP_VERSION)) { |
|
28 | 28 | return php_check_syntax($filename); |
29 | 29 | } |
30 | 30 |
@@ -43,9 +43,9 @@ |
||
43 | 43 | { |
44 | 44 | $alias = $real = null; |
45 | 45 | $expression = $this->searcher->getUnder(array(';'), $n, $tokens); |
46 | - if(preg_match('!use\s+(.*)\s+as\s+(.*)!i', $expression, $matches)) { |
|
46 | + if (preg_match('!use\s+(.*)\s+as\s+(.*)!i', $expression, $matches)) { |
|
47 | 47 | list(, $real, $alias) = $matches; |
48 | - } else if(preg_match('!use\s+([^\s\(]+)\s*!i', $expression, $matches)) { |
|
48 | + } else if (preg_match('!use\s+([^\s\(]+)\s*!i', $expression, $matches)) { |
|
49 | 49 | list(, $real) = $matches; |
50 | 50 | $alias = $real; |
51 | 51 | } |
@@ -52,12 +52,12 @@ discard block |
||
52 | 52 | |
53 | 53 | $token = $tokens[$n]; |
54 | 54 | $call = null; |
55 | - switch($token->getType()) { |
|
55 | + switch ($token->getType()) { |
|
56 | 56 | case T_PAAMAYIM_NEKUDOTAYIM: |
57 | 57 | $prev = $n - 1; |
58 | 58 | $value = $this->searcher->getUnder(array('::'), $prev, $tokens); |
59 | 59 | |
60 | - switch(true) { |
|
60 | + switch (true) { |
|
61 | 61 | case $value == 'parent' && $this->currentClass: |
62 | 62 | return $this->currentClass->getParent(); |
63 | 63 | |
@@ -66,10 +66,10 @@ discard block |
||
66 | 66 | $extendPosition = $this->searcher->getExtendPosition($tokens, $n); |
67 | 67 | return $this->searcher->getFollowingName($extendPosition, $tokens); |
68 | 68 | |
69 | - case ($value == 'static' ||$value === 'self')&& $this->currentClass: |
|
69 | + case ($value == 'static' || $value === 'self') && $this->currentClass: |
|
70 | 70 | return $this->currentClass->getFullname(); |
71 | 71 | |
72 | - case ($value == 'static' ||$value === 'self'): |
|
72 | + case ($value == 'static' || $value === 'self'): |
|
73 | 73 | $extendPosition = $this->searcher->getClassNamePosition($tokens); |
74 | 74 | return $this->searcher->getFollowingName($extendPosition, $tokens); |
75 | 75 | |
@@ -79,12 +79,12 @@ discard block |
||
79 | 79 | |
80 | 80 | case T_NEW: |
81 | 81 | $call = $this->searcher->getFollowingName($n, $tokens); |
82 | - if(preg_match('!^(\w+)!', $call, $matches)) { // fixes PHP 5.4: (new MyClass)->foo() |
|
82 | + if (preg_match('!^(\w+)!', $call, $matches)) { // fixes PHP 5.4: (new MyClass)->foo() |
|
83 | 83 | $call = $matches[1]; |
84 | 84 | } |
85 | 85 | break; |
86 | 86 | } |
87 | - if(null === $call) { |
|
87 | + if (null === $call) { |
|
88 | 88 | throw new \LogicException('Classname of call not found'); |
89 | 89 | } |
90 | 90 | return $call; |
@@ -49,7 +49,7 @@ |
||
49 | 49 | { |
50 | 50 | // is PHP7 ? |
51 | 51 | $previous = $tokens->get($n - 2); |
52 | - if($previous && T_NEW === $previous->getType()) { |
|
52 | + if ($previous && T_NEW === $previous->getType()) { |
|
53 | 53 | // anonymous class |
54 | 54 | $class = new ReflectedAnonymousClass($this->namespace, 'class@anonymous'); |
55 | 55 | return $class; |