for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Billogram\Model\Item;
use Billogram\Model\CreatableFromArray;
/**
* @author Ibrahim Hizeoui <[email protected]>
*/
class Bookkeeping implements CreatableFromArray
{
* @var string
private $incomeAccount;
private $vatAccount;
* @return string
public function getIncomeAccount(): string
return $this->incomeAccount;
}
* @param string $incomeAccount
*
* @return Bookkeeping
public function withIncomeAccount(string $incomeAccount)
$new = clone $this;
$new->incomeAccount = $incomeAccount;
return $new;
public function getVatAccount(): string
return $this->vatAccount;
* @param string $vatAccount
public function withVatAccount(string $vatAccount)
$new->vatAccount = $vatAccount;
public function toArray()
$data = [];
if ($this->incomeAccount !== null) {
$data['income_account'] = $this->incomeAccount;
if ($this->vatAccount !== null) {
$data['vat_account'] = $this->vatAccount;
return $data;
* Create an API response object from the HTTP response from the API server.
* @param array $data
* @return self
public static function createFromArray(array $data)
$bookkeeping = new self();
$bookkeeping->incomeAccount = $data['income_account'] ?? null;
$bookkeeping->vatAccount = $data['vat_account'] ?? null;
return $bookkeeping;