Conditions | 4 |
Paths | 18 |
Total Lines | 30 |
Code Lines | 19 |
Lines | 0 |
Ratio | 0 % |
Tests | 15 |
CRAP Score | 4.1492 |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
17 | 79 | public function isValid($namespace) |
|
18 | { |
||
19 | 79 | $currentDir = getcwd(); |
|
20 | |||
21 | 79 | chdir(FileWriter::BASE_DESTINATION . $namespace); |
|
22 | |||
23 | 79 | if (!defined('ZEPHIRPATH')) |
|
24 | 79 | define('ZEPHIRPATH', realpath(__DIR__.'/../../vendor/phalcon/zephir').'/'); |
|
25 | |||
26 | 79 | $generateCommand = new CommandGenerate(); |
|
27 | 79 | $cleanCommand = new CommandFullClean(); |
|
|
|||
28 | |||
29 | try { |
||
30 | 79 | $config = new Config(); |
|
31 | 79 | $config->set('namespace', strtolower($namespace)); |
|
32 | 79 | $config->set('silent', true); |
|
33 | |||
34 | 79 | if (is_dir('ext')) { |
|
35 | $cleanCommand->execute($config, new ZephirLogger($config)); |
||
36 | } |
||
37 | 79 | $generateCommand->execute($config, new ZephirLogger($config)); |
|
38 | 79 | } catch (Exception $e) { |
|
39 | chdir($currentDir); |
||
40 | throw new \Exception(sprintf('Error on %s', $e->getMessage())); |
||
41 | } |
||
42 | |||
43 | 79 | chdir($currentDir); |
|
44 | |||
45 | 79 | return true; |
|
46 | } |
||
47 | } |
||
48 |
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.
To visualize
will produce issues in the first and second line, while this second example
will produce no issues.