Skip to content

Commit

Permalink
Merge pull request #7 from WJdeBaas/master
Browse files Browse the repository at this point in the history
Fixed PSR Compliance and added function for curl options
  • Loading branch information
Josh-G authored Apr 3, 2020
2 parents 045436e + 0e43c0c commit 693da7e
Show file tree
Hide file tree
Showing 13 changed files with 163 additions and 63 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/vendor/
composer.lock
/.idea/
26 changes: 21 additions & 5 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,18 @@
*/
class Client
{
private $http_client;
private $token;
private $config;

protected $http_client;

/**
* @var string
*/
protected $token;

/**
* @var array
*/
protected $config;

/**
* construct function that builds the client class
Expand All @@ -25,6 +34,7 @@ public function __construct(array $config = [])

if (isset($this->config['http_client'])) {
$this->http_client = $this->config['http_client'];
unset($this->config['http_client']);
} else {
$this->http_client = new \GuzzleHttp\Client([
'base_uri' => $this->getBaseURL(),
Expand Down Expand Up @@ -72,6 +82,9 @@ public function setToken(string $token) : void
$this->token = (new Parser())->parse($token);
}

/**
* @return Token
*/
public function getToken() : Token
{
return $this->token;
Expand Down Expand Up @@ -198,6 +211,9 @@ public function countries() : Service\CountryService
return $this->countries;
}

/**
* @return array
*/
public function getDefaultConfig() : array
{
return [
Expand All @@ -218,7 +234,7 @@ public function getBaseURL() : string
* Function gets the Api url
* @return string Returns a string containing the api url
*/
private function getApiURL() : string
protected function getApiURL() : string
{
return $this->config['apiURI'];
}
Expand All @@ -227,7 +243,7 @@ private function getApiURL() : string
* Function gets the Api Version
* @return string Returns a string containing the Api Version
*/
private function getApiVersion() : string
protected function getApiVersion() : string
{
return 'v1';
}
Expand Down
2 changes: 1 addition & 1 deletion src/Exception/APIException.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/
class APIException extends \RuntimeException
{
private $correlationID = null;
protected $correlationID = null;

/**
* Sets the CorrelationID
Expand Down
16 changes: 8 additions & 8 deletions src/ListResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
*/
class ListResult implements \Iterator
{
private $client;
private $targetClass;
private $endpoint;
private $params;
private $pageSize = 10;
private $currentPagePos = null;
private $currentRecordPos = null;
private $currentRecordSet = [];
protected $client;
protected $targetClass;
protected $endpoint;
protected $params;
protected $pageSize = 10;
protected $currentPagePos = null;
protected $currentRecordPos = null;
protected $currentRecordSet = [];

/**
* This constructor is used to build the ListResult
Expand Down
44 changes: 22 additions & 22 deletions src/Models/Company.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,28 @@
class Company
{

private $client;
private $companyID;
private $businessName;
private $registeredCompanyName;
private $companyRegistrationNumber;
private $country;
private $companyRegistrationDate;
private $mainAddress;
private $otherAddresses;
private $commentaries;
private $history;
private $currentDirectors;
private $previousDirectors;
private $creditScore;
private $shareholders;
private $issuedShareCapital;
private $numberOfSharesIssued;
private $mortgageSummary;
private $mortgages;
private $negativeInfo;
private $rawDetails;
private $financialStatements;
protected $client;
protected $companyID;
protected $businessName;
protected $registeredCompanyName;
protected $companyRegistrationNumber;
protected $country;
protected $companyRegistrationDate;
protected $mainAddress;
protected $otherAddresses;
protected $commentaries;
protected $history;
protected $currentDirectors;
protected $previousDirectors;
protected $creditScore;
protected $shareholders;
protected $issuedShareCapital;
protected $numberOfSharesIssued;
protected $mortgageSummary;
protected $mortgages;
protected $negativeInfo;
protected $rawDetails;
protected $financialStatements;

/**
* Function constructs the Company Class
Expand Down
10 changes: 5 additions & 5 deletions src/Models/Company/CreditScore.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
*/
class CreditScore
{
private $company;
private $currentCreditRating;
private $currentContractLimit;
private $previousCreditRating;
private $latestRatingChangeDate;
protected $company;
protected $currentCreditRating;
protected $currentContractLimit;
protected $previousCreditRating;
protected $latestRatingChangeDate;

/**
* Function constructs the CreditScore Class
Expand Down
6 changes: 3 additions & 3 deletions src/Models/Company/Director.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
*/
class Director
{
private $company;
private $directorDetails;
private $current;
protected $company;
protected $directorDetails;
protected $current;

/**
* Function constructs the Director Class
Expand Down
4 changes: 2 additions & 2 deletions src/Models/Company/FinancialStatement.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
class FinancialStatement
{

private $company;
private $statementDetails;
protected $company;
protected $statementDetails;

/**
* Function constructs the FinancialStatement Class
Expand Down
4 changes: 2 additions & 2 deletions src/Models/Company/Shareholder.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
*/
class Shareholder
{
private $company;
private $shareholderDetails;
protected $company;
protected $shareholderDetails;
/**
* [__construct description]
* @param Company $company Used to store the client in the Company Class
Expand Down
103 changes: 93 additions & 10 deletions src/Models/CompanySearchResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,72 @@
*/
class CompanySearchResult
{
private $client;
private $id;
private $country;
private $regNo;
private $safeNo;
private $name;
private $address;
private $status;
private $type;
private $dateOfLatestChange;
protected $client;

/**
* @var string
*/
protected $id;

/**
* @var string|null
*/
protected $country;

/**
* @var string|null
*/
protected $regNo;

/**
* @var string|null
*/
protected $safeNo;

/**
* @var array|null
*/
protected $vatNo;

/**
* @var string|null
*/
protected $name;

/**
* @var array|null
*/
protected $address;

/**
* @var string|null
*/
protected $status;

/**
* @var mixed|null
*/
protected $type;

/**
* @var string|null
*/
protected $officeType;

/**
* @var array|null
*/
protected $tradingNames;

/**
* @var string|null
*/
protected $dateOfLatestChange;

/**
* @var string|null
*/
protected $activityCode;

/**
* Function constructs the CompanySearchResult Class
Expand All @@ -35,6 +91,9 @@ public function __construct($client, array $companyDetails)
$this->address = $companyDetails['address'] ?? null;
$this->status = $companyDetails['status'] ?? null;
$this->type = $companyDetails['type'] ?? null;
$this->officeType = $companyDetails['officeType'] ?? null;
$this->vatNo = $companyDetails['vatNo'] ?? [];
$this->tradingNames = $companyDetails['tradingNames'] ?? [];
$this->dateOfLatestChange = $companyDetails['dateOfLatestChange'] ?? null;
}

Expand Down Expand Up @@ -110,6 +169,30 @@ public function getType() : string
return $this->type ?? '';
}

/**
* @return string Get OfficeType
*/
public function getOfficeType() : string
{
return $this->officeType ?? '';
}

/**
* @return array
*/
public function getTradingNames() : array
{
return $this->tradingNames ?? [];
}

/**
* @return array
*/
public function getVatNo() : array
{
return $this->vatNo ?? [];
}

/**
*
* @return DateTime Get Date Of Latest Change
Expand Down
4 changes: 2 additions & 2 deletions src/Service/CompanyEventService.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
*/
class CompanyEventService
{
private $client;
private $id;
protected $client;
protected $id;

/**
* This Constructor builds the CompaniesEvents Class
Expand Down
4 changes: 2 additions & 2 deletions src/Service/CompanyService.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
*/
class CompanyService
{
private $client;
private $id;
protected $client;
protected $id;

/**
* This constructor builds the CompanyServices Class
Expand Down
2 changes: 1 addition & 1 deletion src/Service/CountryService.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

class CountryService
{
private $client;
protected $client;

/**
* This Constructor builds the Countries Class
Expand Down

0 comments on commit 693da7e

Please sign in to comment.