| Total Complexity | 8 |
| Total Lines | 45 |
| Duplicated Lines | 0 % |
| Coverage | 40% |
| Changes | 0 | ||
| 1 | <?php |
||
| 21 | class InternalReferences extends AbstractEntity |
||
| 22 | { |
||
| 23 | |||
| 24 | /** @ODM\Field(type="hash") */ |
||
| 25 | protected $jobs = array(); |
||
| 26 | |||
| 27 | 3 | /** |
|
| 28 | * @ODM\Field(type="collection") |
||
| 29 | 3 | * @var array |
|
| 30 | */ |
||
| 31 | protected $jobManagers = []; |
||
| 32 | |||
| 33 | 3 | public function setJob(JobInterface $job) |
|
| 34 | 3 | { |
|
| 35 | 3 | if (isset($this->jobs['__id__']) && $this->jobs['__id__'] == $job->getId()) { |
|
| 36 | return $this; |
||
| 37 | 3 | } |
|
| 38 | |||
| 39 | $this->jobs = array( |
||
| 40 | '__id__' => $job->getId(), |
||
| 41 | 'userId' => ($user = $job->getUser()) ? $user->getId() : null, |
||
| 42 | ); |
||
| 43 | $this->setJobsManagers($job->getMetaData('organizations:managers', [])); |
||
|
|
|||
| 44 | return $this; |
||
| 45 | } |
||
| 46 | |||
| 47 | public function setJobsId($id) |
||
| 51 | } |
||
| 52 | |||
| 53 | public function setJobsUserId($userOrId) |
||
| 60 | } |
||
| 61 | |||
| 62 | public function setJobsManagers($managers) |
||
| 68 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.