public function filterByJob($filterByJob)
    {
        $result = $this->filter(
            function ($key, $value) use ($filterByJob) {
                $jobList = $value->getJobList();

                foreach ($jobList as $job) {
                    if ($filterByJob == $job) {
                        return true;
                    }
                }
            }
        );

        if ($result && 1 === count($result)) {
            $results = $result->toArray();

            return array_shift($results);
        }

        return $result;
    }
public function filterByJob($filterByJob)
    {
        $result = $this->filter(
            function ($key, $value) use ($filterByJob) {
                $jobList = $value->getJobList();

                foreach ($jobList as $job) {
                    if ($filterByJob == $job) {
                        return true;
                    }
                }
            }
        );

        if ($result && 1 === count($result)) {
            $results = $result->toArray();

            return array_shift($results);
        }

        return $result;
    }
public function filterByJob ( $ filterByJob ) { $ result = $ this -> filter ( function ( $ key , $ value ) use ( $ filterByJob ) { $ jobList = $ value -> getJobList ( ) ; foreach ( $ jobList as $ job ) { if ( $ filterByJob == $ job ) { return true ; } } } ) ; if ( $ result && 1 === count ( $ result ) ) { $ results = $ result -> toArray ( ) ; return array_shift ( $ results ) ; } return $ result ; }
Filter by job

@param  string $filterByJob
@return $this
Filter by job