| Conditions | 4 |
| Paths | 2 |
| Total Lines | 17 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php namespace JobApis\JobsToMail\Filters; |
||
| 21 | 3 | public function filter(array $jobs, Search $search) |
|
| 22 | { |
||
| 23 | // Make sure this search wants to filter recruiters |
||
| 24 | 3 | if ($search->no_recruiters === true) { |
|
| 25 | 2 | return array_filter($jobs, function ($job) { |
|
| 26 | // Make sure this job has a company |
||
| 27 | 2 | if (isset($job->company)) { |
|
| 28 | // Make sure this company is not a recruiter |
||
| 29 | 1 | if ($this->recruiter->whereNameLike($job->company)->first()) { |
|
| 30 | 1 | return false; |
|
| 31 | } |
||
| 32 | } |
||
| 33 | 1 | return true; |
|
| 34 | 2 | }); |
|
| 35 | } |
||
| 36 | 1 | return $jobs; |
|
| 37 | } |
||
| 38 | } |
||
| 39 |
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: