From 8db811eda7ca4e891577511c310abb122baed455 Mon Sep 17 00:00:00 2001 From: MBriedis Date: Tue, 21 Aug 2018 10:27:47 +0300 Subject: [PATCH] Base library lib allows setting the auth token. Reformat --- src/Breezy.php | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/src/Breezy.php b/src/Breezy.php index 3a00d7a..65c6fae 100644 --- a/src/Breezy.php +++ b/src/Breezy.php @@ -42,10 +42,20 @@ public function signIn($email, $password) return $token; } + /** + * Set authorization token for next requests + * @param string $token + */ + public function setToken($token) + { + $this->api->setToken($token); + } + /** * Get company data * @param string $companyId * @return CompanyItem + * @throws BreezyException */ public function getCompany($companyId) { @@ -59,6 +69,7 @@ public function getCompany($companyId) * @param string $companyId * @param string $state State of the position (draft, archived, etc). By default, returns only published. Pass an empty string if you want all * @return PositionItem[] + * @throws BreezyException */ public function getCompanyPositions($companyId, $state = PositionItem::STATE_PUBLISHED) { @@ -85,6 +96,7 @@ public function getCompanyPositions($companyId, $state = PositionItem::STATE_PUB * @param string $positionId * @param string $candidateId * @return CandidateItem + * @throws BreezyException */ public function getCandidate($companyId, $positionId, $candidateId) { @@ -101,6 +113,7 @@ public function getCandidate($companyId, $positionId, $candidateId) * @param string $positionId * @param CandidateItem $candidate * @return CandidateItem + * @throws BreezyException */ public function addCandidate($companyId, $positionId, CandidateItem $candidate) { @@ -124,10 +137,17 @@ public function uploadResume($companyId, $positionId, $candidateId, $pathname, $ $extension = pathinfo($filename, PATHINFO_EXTENSION); if (!in_array($extension, self::$allowedFileExtensions, true)) { - throw new BreezyException('Extension "' . $extension . '" is not within allowed list: ' . implode(', ', self::$allowedFileExtensions)); + throw new BreezyException( + 'Extension "' . $extension . '" is not within allowed list: ' + . implode(', ', self::$allowedFileExtensions) + ); } - $response = $this->api->uploadFile('company/' . $companyId . '/position/' . $positionId . '/candidate/' . $candidateId . '/resume', $pathname, $filename); + $response = $this->api->uploadFile( + 'company/' . $companyId . '/position/' . $positionId . '/candidate/' . $candidateId . '/resume', + $pathname, + $filename + ); return $response; } @@ -147,10 +167,17 @@ public function uploadDocument($companyId, $positionId, $candidateId, $pathname, $extension = pathinfo($filename, PATHINFO_EXTENSION); if (!in_array($extension, self::$allowedFileExtensions, true)) { - throw new BreezyException('Extension "' . $extension . '" is not within allowed list: ' . implode(', ', self::$allowedFileExtensions)); + throw new BreezyException( + 'Extension "' . $extension . '" is not within allowed list: ' + . implode(', ', self::$allowedFileExtensions) + ); } - $response = $this->api->uploadFile('company/' . $companyId . '/position/' . $positionId . '/candidate/' . $candidateId . '/documents', $pathname, $filename); + $response = $this->api->uploadFile( + 'company/' . $companyId . '/position/' . $positionId . '/candidate/' . $candidateId . '/documents', + $pathname, + $filename + ); return $response; }