From a40a12a9f84798acfd6d65e88c568e051adc3b78 Mon Sep 17 00:00:00 2001 From: Karl Date: Thu, 23 Jul 2015 19:06:54 -0500 Subject: [PATCH] Minor code quality improvements --- phpunit.xml.dist | 1 - src/Careerbuilder.php | 46 +++++++++++++++++++++++-------------------- 2 files changed, 25 insertions(+), 22 deletions(-) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index b486c71..2dbe64c 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -2,7 +2,6 @@ $payload['DescriptionTeaser'], 'employmentType' => $payload['EmploymentType'], 'title' => $payload['JobTitle'], @@ -75,7 +76,8 @@ public function createJobObject($payload) 'experienceRequirements' => $payload['ExperienceRequired'], 'minimumSalary' => $payload['Pay'], 'sourceId' => $payload['DID'], - ]); + ] + ); $job->setOccupationalCategoryWithCodeAndTitle( $payload['OnetCode'], @@ -118,7 +120,7 @@ public function getUseFacets() * * @return string */ - public function getEnableCompanyCollapse() + public function getCompanyCollapse() { return 'true'; } @@ -136,7 +138,7 @@ public function getFormat() /** * Get listings path * - * @return string + * @return string */ public function getListingsPath() { @@ -146,7 +148,7 @@ public function getListingsPath() /** * Get parameters * - * @return array + * @return array */ public function getParameters() { @@ -160,7 +162,7 @@ public function getParameters() */ public function getQueryString() { - $query_params = [ + $queryParams = [ 'DeveloperKey' => 'getDeveloperKey', 'Keywords' => 'getKeyword', 'FacetState' => 'getState', @@ -168,37 +170,39 @@ public function getQueryString() 'PageNumber' => 'getPage', 'PerPage' => 'getCount', 'UseFacets' => 'getUseFacets', - 'EnableCompanyCollapse' => 'getEnableCompanyCollapse', + 'EnableCompanyCollapse' => 'getCompanyCollapse', ]; - $query_string = []; + $queryString = []; - array_walk($query_params, function ($value, $key) use (&$query_string) { - $computed_value = $this->$value(); - if (!is_null($computed_value)) { - $query_string[$key] = $computed_value; + array_walk( + $queryParams, function ($value, $key) use (&$queryString) { + $computedValue = $this->$value(); + if (!is_null($computedValue)) { + $queryString[$key] = $computedValue; + } } - }); + ); - return http_build_query($query_string); + return http_build_query($queryString); } /** * Get url * - * @return string + * @return string */ public function getUrl() { - $query_string = $this->getQueryString(); + $queryString = $this->getQueryString(); - return 'http://api.careerbuilder.com/v2/jobsearch/?'.$query_string; + return 'http://api.careerbuilder.com/v2/jobsearch/?'.$queryString; } /** * Get http verb * - * @return string + * @return string */ public function getVerb() {