| Conditions | 4 |
| Paths | 8 |
| Total Lines | 8 |
| Code Lines | 5 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | 26 | protected function setJobId(\Dtc\QueueBundle\Model\Job $job) |
|
| 13 | { |
||
| 14 | 26 | $pid = isset($this->pid) ? $this->pid : null; |
|
|
|
|||
| 15 | 26 | $hostname = isset($this->hostname) ? $this->hostname : null; |
|
| 16 | 26 | if (!$job->getId()) { |
|
| 17 | 26 | $job->setId(uniqid($hostname.'-'.$pid, true)); |
|
| 18 | } |
||
| 19 | 26 | } |
|
| 20 | } |
||
| 21 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: