Skip to content

Commit

Permalink
Adding company parsing from description
Browse files Browse the repository at this point in the history
  • Loading branch information
karllhughes committed Jul 25, 2015
1 parent 1d9d65a commit 69aa899
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/Careercast.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public function createJobObject($payload)
if (isset($this->state)) {
$job->setState($this->state);
}
$job->setCompany($this->parseCompanyFromDescription($job->getDescription()));

return $job;
}
Expand Down Expand Up @@ -183,6 +184,25 @@ public function getVerb()
return 'GET';
}

/**
* Attempt to get the company name from the description
*
* @return string
*/
public function parseCompanyFromDescription($description)
{
$array = explode(' - ', $description);
if (isset($array[0]) && isset($array[1])) {
return $array[0];
}
return null;
}

/* NOTE: Everything below here should be removed when this issue:
* https://github.com/JobBrander/jobs-common/issues/4
* is fixed.
*/

/**
* Makes the api call and returns a collection of job objects
*
Expand Down

0 comments on commit 69aa899

Please sign in to comment.