for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php namespace JobApis\JobsToMail\Filters;
use JobApis\Jobs\Client\Job;
use JobApis\JobsToMail\Models\Recruiter;
use JobApis\JobsToMail\Models\Search;
class RecruiterFilter
{
public function __construct(Recruiter $recruiter)
$this->recruiter = $recruiter;
recruiter
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
class MyClass { } $x = new MyClass(); $x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:
class MyClass { public $foo; } $x = new MyClass(); $x->foo = true;
}
/**
* Filters out jobs from recruiting companies if the user prefers it.
*
* @param array $jobs
* @param Search $search
* @return array
*/
public function filter(array $jobs, Search $search)
return array_filter($jobs, function (Job $job) use ($search) {
// Make sure this job has a company
if (isset($job->company) && $job->company) {
// See if this company is not a recruiter
if ($this->recruiter->whereNameLike($job->company)->first()) {
if ($search->no_recruiters === true) {
return false;
} else {
$job->setIndustry("Staffing");
return true;
});
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: