Skip to content

Commit

Permalink
Merge pull request #2 from SynergiTech/shareholder-class
Browse files Browse the repository at this point in the history
Add the shareholder class to get the shareholders of the company
  • Loading branch information
willpower232 authored Mar 19, 2019
2 parents 5a459a5 + bc20369 commit 90ed4da
Show file tree
Hide file tree
Showing 2 changed files with 109 additions and 0 deletions.
35 changes: 35 additions & 0 deletions src/Models/Company.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ class Company
private $currentDirectors;
private $previousDirectors;
private $creditScore;
private $shareholders;
private $issuedShareCapital;
private $numberOfSharesIssued;
private $mortgageSummary;
private $mortgages;
private $negativeInfo;
Expand Down Expand Up @@ -70,6 +73,11 @@ public function __construct($client, array $companyDetails)

$this->commentaries = $companyDetails['report']['additionalInformation']['commentaries'] ?? [];
$this->creditScore = new Company\CreditScore($this, $companyDetails['report']['creditScore'] ?? []);
$this->shareholders = array_map(function ($shareholder) {
return new Company\Shareholder($this, $shareholder);
}, $companyDetails['report']['shareCapitalStructure']['shareHolders'] ?? []);
$this->numberOfSharesIssued = $companyDetails['report']['shareCapitalStructure']['numberOfSharesIssued'] ?? [];
$this->issuedShareCapital = $companyDetails['report']['shareCapitalStructure']['issuedShareCapital'] ?? [];
$this->mortgageSummary = $companyDetails['report']['additionalInformation']['mortgageSummary'] ?? [];
$this->mortgages = $companyDetails['report']['additionalInformation']['mortgageDetails'] ?? null;
$this->negativeInfo = $companyDetails['report']['negativeInformation'] ?? [];
Expand Down Expand Up @@ -184,6 +192,15 @@ public function getCreditScore() : CreditScore
return $this->creditScore;
}

/**
*
* @return array Returns a array of Shareholders for the company
*/
public function getShareHolders() : array
{
return $this->shareholders;
}

/**
*
* @return array Returns the commentaries of the company
Expand Down Expand Up @@ -237,4 +254,22 @@ public function getFinancialStatements() : array
{
return $this->financialStatements;
}

/**
*
* @return array Returns an array which ocontains the currency and value of shares
*/
public function getIssuedShareCapital() : array
{
return $this->issuedShareCapital;
}

/**
*
* @return string Returns the number of shares issued
*/
public function getNumberOfSharesIssued() : string
{
return $this->numberOfSharesIssued;
}
}
74 changes: 74 additions & 0 deletions src/Models/Company/Shareholder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<?php

namespace SynergiTech\Creditsafe\Models\Company;

use SynergiTech\Creditsafe\Models\Company;

/**
* [Shareholder description]
*/
class Shareholder
{
private $company;
private $shareholderDetails;
/**
* [__construct description]
* @param Company $company Used to store the client in the Company Class
* @param array $shareholderDetails Shareholder Data that needs to be stored in the Shareholder Class
*/
public function __construct(Company $company, array $shareholderDetails)
{
$this->company = $company;
$this->shareholderDetails['name'] = $shareholderDetails['name'] ?? null;
$this->shareholderDetails['shareType'] = $shareholderDetails['shareType'] ?? null;
$this->shareholderDetails['numberOfSharesOwned'] = $shareholderDetails['numberOfSharesOwned'] ?? null;
$this->shareholderDetails['percentSharesHeld'] = $shareholderDetails['percentSharesHeld'] ?? null;
$this->shareholderDetails['shareholderType'] = $shareholderDetails['shareholderType'] ?? null;
}

/**
*
* @return string Returns Shareholder Name
*/
public function getShareHolderName() : string
{
return $this->shareholderDetails['name'];
}

/**
*
* @return string Returns the type of shareholder
*/
public function getshareholderType() : string
{
return $this->shareholderDetails['shareholderType'];
}

/**
*
* @return string Returns the shareholder percetage
*/
public function getShareHolderPercentage() : string
{
return $this->shareholderDetails['percentSharesHeld'];
}

/**
*
* @return string Returns the num of shares owned
*/
public function getNumOfSharesOwned() : string
{
return $this->shareholderDetails['numberOfSharesOwned'];
}

/**
*
* @return string Returns the share type
*/
public function getShareType() : string
{
return $this->shareholderDetails['shareType'];
}
}

0 comments on commit 90ed4da

Please sign in to comment.