| Conditions | 9 | 
| Paths | 57 | 
| Total Lines | 31 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Tests | 0 | 
| CRAP Score | 90 | 
| Changes | 0 | ||
| 1 | <?php  | 
            ||
| 9 | public function run()  | 
            ||
| 10 |     { | 
            ||
| 11 | // job name to process  | 
            ||
| 12 |         $job = getenv('BASIS_JOB'); | 
            ||
| 13 |         if (!$job) { | 
            ||
| 14 |             throw new Exception("BASIS_JOB is not defined"); | 
            ||
| 15 | }  | 
            ||
| 16 | |||
| 17 | // loops count limit  | 
            ||
| 18 |         $loops = +getenv('BASIS_LOOPS') ?: (getenv('BASIS_ENVIRONMENT') == 'dev' ? 1 : 100); | 
            ||
| 19 | $current = 1;  | 
            ||
| 
                                                                                                    
                        
                         | 
                |||
| 20 | |||
| 21 | // delay between calls in milliseconds  | 
            ||
| 22 |         $delay = +getenv('BASIS_DELAY') ?: 0; | 
            ||
| 23 | |||
| 24 |         while ($loops--) { | 
            ||
| 25 | $start = microtime(true);  | 
            ||
| 26 | $result = $this->dispatch($job);  | 
            ||
| 27 |             foreach ($result as $k => $v) { | 
            ||
| 28 |                 if (!$v) { | 
            ||
| 29 | unset($result->$k);  | 
            ||
| 30 | }  | 
            ||
| 31 | }  | 
            ||
| 32 |             if (json_encode($result) != "{}") { | 
            ||
| 33 | $result->time = microtime(true) - $start;  | 
            ||
| 34 | echo json_encode($result), PHP_EOL;  | 
            ||
| 35 | ob_flush();  | 
            ||
| 36 | }  | 
            ||
| 37 | usleep($delay * 1000);  | 
            ||
| 38 | }  | 
            ||
| 39 | }}  | 
            ||
| 40 | 
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVarassignment in line 1 and the$higherassignment in line 2 are dead. The first because$myVaris never used and the second because$higheris always overwritten for every possible time line.