| Conditions | 6 |
| Paths | 4 |
| Total Lines | 31 |
| Code Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 20 |
| CRAP Score | 6 |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 15 | 16 | public function process(File $file, $ptr): void |
|
| 16 | { |
||
| 17 | // File path sniffs and not saved using sniff code and their config |
||
| 18 | // is not processed. This is a workaround. |
||
| 19 | 16 | if (!$this->configured) { |
|
| 20 | 16 | $bits = explode('\\', get_class($this)); |
|
| 21 | 16 | $currentClass = end($bits); |
|
| 22 | |||
| 23 | 16 | $opts = []; |
|
| 24 | 16 | foreach ($file->ruleset->ruleset as $ref => $rule) { |
|
| 25 | 16 | $bits = explode('/', $ref); |
|
| 26 | 16 | $cfgClass = rtrim(end($bits), '.php'); |
|
| 27 | 16 | if ($currentClass === $cfgClass) { |
|
| 28 | 16 | $opts = $rule['properties']; |
|
| 29 | 16 | break; |
|
| 30 | } |
||
| 31 | } |
||
| 32 | |||
| 33 | 16 | array_walk_recursive($opts, function (&$val) { |
|
| 34 | 16 | if ('true' === $val) { |
|
| 35 | 1 | $val = true; |
|
| 36 | 15 | } elseif ('false' === $val) { |
|
| 37 | 1 | $val = false; |
|
| 38 | } |
||
| 39 | 16 | }); |
|
| 40 | |||
| 41 | 16 | $this->configure($opts); |
|
| 42 | 16 | $this->configured = true; |
|
| 43 | } |
||
| 44 | |||
| 45 | 16 | $this->run($file, $ptr); |
|
| 46 | 16 | } |
|
| 55 |