Docblock fixes + more tests

This commit is contained in:
Dennis Eichhorn 2018-12-15 22:36:04 +01:00
parent e31d7f7997
commit d5b8b93769
15 changed files with 468 additions and 288 deletions

View File

@ -29,23 +29,4 @@ use phpOMS\Module\UninstallerAbstract;
*/
class Uninstaller extends UninstallerAbstract
{
/**
* {@inheritdoc}
*/
public static function uninstall(DatabasePool $dbPool, InfoManager $info) : void
{
parent::uninstall($dbPool, $info);
$query = new Builder($dbPool->get());
$query->prefix($dbPool->get()->getPrefix())->drop(
'accounting_posting_ele',
'accounting_posting',
'accounting_batch',
'accounting_account'
);
$dbPool->get()->con->prepare($query->toSql())->execute();
}
}

View File

@ -36,22 +36,18 @@ abstract class AccountAbstract
/**
* Type.
*
* @var \Modules\Accounting\Models\AccountType
* @var AccountType
* @since 1.0.0
*/
protected $type = null;
protected $positiveParent = null;
protected $negativeParent = null;
protected $type = AccountType::IMPERSONAL;
/**
* Entry list.
*
* @var \Modules\Accounting\Models\EntryInterface[]
* @var EntryInterface[]
* @since 1.0.0
*/
protected $entryList = [];
protected $entries = [];
/**
* Constructor.
@ -65,6 +61,13 @@ abstract class AccountAbstract
$this->id = $id;
}
/**
* Get account id.
*
* @return int
*
* @since 1.0.0
*/
public function getId() : int
{
return $this->id;
@ -75,12 +78,13 @@ abstract class AccountAbstract
*
* @param int $id Entry ID
*
* @return void
* @return null|EntryInterface
*
* @since 1.0.0
*/
public function getEntryById($id)
public function getEntryById(int $id) : ?EntryInterface
{
return $this->entries[$id] ?? null;
}
/**
@ -90,31 +94,12 @@ abstract class AccountAbstract
* @param \DateTime $end Interval end
* @param int $dateType
*
* @internal \Modules\Accounting\Models\TimeRangeType $dateTime Time range type
* @return array
*
* @since 1.0.0
*/
public function getEntriesByDate($start, $end, $dateType = TimeRangeType::RECEIPT_DATE)
public function getEntriesByDate(\DateTime $start, \DateTime $end, int $dateType = TimeRangeType::RECEIPT_DATE) : array
{
}
public function getPositiveParent()
{
return $this->positiveParent;
}
public function setPositiveParent($parent)
{
$this->positiveParent = $parent;
}
public function getNegativeParent()
{
return $this->negativeParent;
}
public function setNegativeParent($parent)
{
$this->negativeParent = $parent;
return [];
}
}

View File

@ -14,7 +14,6 @@ declare(strict_types=1);
namespace Modules\Accounting\Models;
/**
* Balance class.
*
@ -43,21 +42,82 @@ class Balance
private $balance = [];
/**
* Constructor.
* Balance name.
*
* @since 1.0.0
* @var string
* @since 1.0.0
*/
public function __construct()
{
}
private $name = '';
/**
* Balance description.
*
* @var string
* @since 1.0.0
*/
private $description = '';
/**
* Get balance id
*
* @return int
*
* @since 1.0.0
*/
public function getId()
public function getId() : int
{
return $this->id;
}
/**
* Set name
*
* @param string $name Balance name
*
* @return void
*
* @since 1.0.0
*/
public function setName(string $name) : void
{
$this->name = $name;
}
/**
* Get name
*
* @return string
*
* @since 1.0.0
*/
public function getName() : string
{
return $this->name;
}
/**
* Set description
*
* @param string $description Balance description
*
* @return void
*
* @since 1.0.0
*/
public function setDescription(string $description) : void
{
$this->description = $description;
}
/**
* Get description
*
* @return string
*
* @since 1.0.0
*/
public function getDescription() : string
{
return $this->description;
}
}

View File

@ -60,7 +60,7 @@ class BatchPosting implements \Countable
/**
* Postings.
*
* @var \Modules\Accounting\Models\PostingAbstract[]
* @var PostingAbstract[]
* @since 1.0.0
*/
private $postings = [];
@ -82,7 +82,7 @@ class BatchPosting implements \Countable
*
* @since 1.0.0
*/
public function getId()
public function getId() : int
{
return $this->id;
}
@ -108,7 +108,7 @@ class BatchPosting implements \Countable
*
* @since 1.0.0
*/
public function setDescription(string $desc)
public function setDescription(string $desc) : void
{
$this->description = $desc;
}
@ -146,7 +146,7 @@ class BatchPosting implements \Countable
*
* @since 1.0.0
*/
public function setCreator($creator)
public function setCreator($creator) : void
{
$this->creator = $creator;
}
@ -156,13 +156,13 @@ class BatchPosting implements \Countable
*
* @param int $id Posting ID
*
* @return \Modules\Accounting\Models\PostingAbstract
* @return null|PostingAbstract
*
* @since 1.0.0
*/
public function getPosting($id)
public function getPosting(int $id) : ?PostingAbstract
{
return $this->postings[$id];
return $this->postings[$id] ?? null;
}
/**
@ -170,25 +170,31 @@ class BatchPosting implements \Countable
*
* @param int $id Posting ID
*
* @return void
* @return bool
*
* @since 1.0.0
*/
public function removePosting($id)
public function removePosting($id) : bool
{
if (!isset($this->postings[$id])) {
return false;
}
unset($this->postings[$id]);
return true;
}
/**
* Add posting.
*
* @param \Modules\Accounting\Models\PostingAbstract $posting Posting
* @param PostingAbstract $posting Posting
*
* @return void
*
* @since 1.0.0
*/
public function addPosting($posting)
public function addPosting(PostingAbstract $posting) : void
{
$this->postings[] = $posting;
}
@ -196,7 +202,7 @@ class BatchPosting implements \Countable
/**
* {@inheritdoc}
*/
public function count()
public function count() : int
{
return count($this->postings);
}

View File

@ -0,0 +1,148 @@
<?php
/**
* Orange Management
*
* PHP Version 7.2
*
* @package Modules\Accounting\Models
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://website.orange-management.de
*/
declare(strict_types=1);
namespace Modules\Accounting\Models;
/**
* BatchPosting class.
*
* @package Modules\Accounting\Models
* @license OMS License 1.0
* @link http://website.orange-management.de
* @since 1.0.0
*/
class CostCenter
{
/**
* ID.
*
* @var int
* @since 1.0.0
*/
private $id = 0;
/**
* Code.
*
* @var string
* @since 1.0.0
*/
private $code = '';
/**
* Name.
*
* @var string
* @since 1.0.0
*/
private $name = '';
/**
* Description.
*
* @var string
* @since 1.0.0
*/
private $description = '';
/**
* Get balance id
*
* @return int
*
* @since 1.0.0
*/
public function getId() : int
{
return $this->id;
}
/**
* Set code
*
* @param string $code Balance code
*
* @return void
*
* @since 1.0.0
*/
public function setCode(string $code) : void
{
$this->code = $code;
}
/**
* Get code
*
* @return string
*
* @since 1.0.0
*/
public function getCode() : string
{
return $this->code;
}
/**
* Set name
*
* @param string $name Balance name
*
* @return void
*
* @since 1.0.0
*/
public function setName(string $name) : void
{
$this->name = $name;
}
/**
* Get name
*
* @return string
*
* @since 1.0.0
*/
public function getName() : string
{
return $this->name;
}
/**
* Set description
*
* @param string $description Balance description
*
* @return void
*
* @since 1.0.0
*/
public function setDescription(string $description) : void
{
$this->description = $description;
}
/**
* Get description
*
* @return string
*
* @since 1.0.0
*/
public function getDescription() : string
{
return $this->description;
}
}

View File

@ -0,0 +1,148 @@
<?php
/**
* Orange Management
*
* PHP Version 7.2
*
* @package Modules\Accounting\Models
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://website.orange-management.de
*/
declare(strict_types=1);
namespace Modules\Accounting\Models;
/**
* BatchPosting class.
*
* @package Modules\Accounting\Models
* @license OMS License 1.0
* @link http://website.orange-management.de
* @since 1.0.0
*/
class CostObject
{
/**
* ID.
*
* @var int
* @since 1.0.0
*/
private $id = 0;
/**
* Code.
*
* @var string
* @since 1.0.0
*/
private $code = '';
/**
* Name.
*
* @var string
* @since 1.0.0
*/
private $name = '';
/**
* Description.
*
* @var string
* @since 1.0.0
*/
private $description = '';
/**
* Get balance id
*
* @return int
*
* @since 1.0.0
*/
public function getId() : int
{
return $this->id;
}
/**
* Set code
*
* @param string $code Balance code
*
* @return void
*
* @since 1.0.0
*/
public function setCode(string $code) : void
{
$this->code = $code;
}
/**
* Get code
*
* @return string
*
* @since 1.0.0
*/
public function getCode() : string
{
return $this->code;
}
/**
* Set name
*
* @param string $name Balance name
*
* @return void
*
* @since 1.0.0
*/
public function setName(string $name) : void
{
$this->name = $name;
}
/**
* Get name
*
* @return string
*
* @since 1.0.0
*/
public function getName() : string
{
return $this->name;
}
/**
* Set description
*
* @param string $description Balance description
*
* @return void
*
* @since 1.0.0
*/
public function setDescription(string $description) : void
{
$this->description = $description;
}
/**
* Get description
*
* @return string
*
* @since 1.0.0
*/
public function getDescription() : string
{
return $this->description;
}
}

View File

@ -14,6 +14,8 @@ declare(strict_types=1);
namespace Modules\Accounting\Models;
use Modules\Admin\Models\Account;
/**
* Creditor class.
*
@ -26,11 +28,42 @@ class Creditor
{
/**
* Constructor.
* Creditor ID.
*
* @var int
* @since 1.0.0
*/
protected $id = 0;
/**
* Account.
*
* @var int
* @since 1.0.0
*/
protected $account = null;
/**
* Get id.
*
* @return int
*
* @since 1.0.0
*/
public function __construct()
public function getId() : int
{
return $this->id;
}
/**
* Get account.
*
* @return null|int|Account
*
* @since 1.0.0
*/
public function getAccount()
{
return $this->account;
}
}

View File

@ -1,45 +0,0 @@
<?php
/**
* Orange Management
*
* PHP Version 7.2
*
* @package Modules\Accounting\Models
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://website.orange-management.de
*/
declare(strict_types=1);
namespace Modules\Accounting\Models;
/**
* Creditor account class.
*
* @package Modules\Accounting\Models
* @license OMS License 1.0
* @link http://website.orange-management.de
* @since 1.0.0
*/
abstract class CreditorAccount extends PersonalAccountAbstract
{
/**
* Constructor.
*
* @since 1.0.0
*/
public function __construct()
{
}
public function getPDO()
{
}
public function getDefault()
{
}
}

View File

@ -14,6 +14,8 @@ declare(strict_types=1);
namespace Modules\Accounting\Models;
use Modules\Admin\Models\Account;
/**
* Debitor class.
*
@ -26,11 +28,42 @@ class Debitor
{
/**
* Constructor.
* Debitor ID.
*
* @var int
* @since 1.0.0
*/
protected $id = 0;
/**
* Account.
*
* @var int
* @since 1.0.0
*/
protected $account = null;
/**
* Get id.
*
* @return int
*
* @since 1.0.0
*/
public function __construct()
public function getId() : int
{
return $this->id;
}
/**
* Get account.
*
* @return null|int|Account
*
* @since 1.0.0
*/
public function getAccount()
{
return $this->account;
}
}

View File

@ -1,49 +0,0 @@
<?php
/**
* Orange Management
*
* PHP Version 7.2
*
* @package Modules\Accounting\Models
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://website.orange-management.de
*/
declare(strict_types=1);
namespace Modules\Accounting\Models;
/**
* DebitorAccount class.
*
* @package Modules\Accounting\Models
* @license OMS License 1.0
* @link http://website.orange-management.de
* @since 1.0.0
*/
abstract class DebitorAccount extends PersonalAccountAbstract
{
/**
* Constructor.
*
* @since 1.0.0
*/
public function __construct()
{
}
public function getDSO()
{
}
public function getDefault()
{
}
public function getNetReceivable()
{
}
}

View File

@ -1,37 +0,0 @@
<?php
/**
* Orange Management
*
* PHP Version 7.2
*
* @package Modules\Accounting\Models
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://website.orange-management.de
*/
declare(strict_types=1);
namespace Modules\Accounting\Models;
/**
* ImpersonalAccount class.
*
* @package Modules\Accounting\Models
* @license OMS License 1.0
* @link http://website.orange-management.de
* @since 1.0.0
*/
class ImpersonalAccount
{
/**
* Constructor.
*
* @since 1.0.0
*/
public function __construct()
{
}
}

View File

@ -1,36 +0,0 @@
<?php
/**
* Orange Management
*
* PHP Version 7.2
*
* @package Modules\Accounting\Models
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://website.orange-management.de
*/
declare(strict_types=1);
namespace Modules\Accounting\Models;
/**
* Invoice posting simple class.
*
* @package Modules\Accounting\Models
* @license OMS License 1.0
* @link http://website.orange-management.de
* @since 1.0.0
*/
abstract class InvoicePostingSimple extends PostingAbstract
{
/**
* Constructor.
*
* @since 1.0.0
*/
public function __construct()
{
}
}

View File

@ -1,47 +0,0 @@
<?php
/**
* Orange Management
*
* PHP Version 7.2
*
* @package Modules\Accounting\Models
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://website.orange-management.de
*/
declare(strict_types=1);
namespace Modules\Accounting\Models;
/**
* ImpersonalAccount class.
*
* @package Modules\Accounting\Models
* @license OMS License 1.0
* @link http://website.orange-management.de
* @since 1.0.0
*/
abstract class PersonalAccountAbstract extends AccountAbstract
{
public function __construct(int $id)
{
parent::__construct($id);
}
public function getBalance()
{
}
public function getAccountsReceivable()
{
}
public function getAccountsPayable()
{
}
public function getAccountsHistory($start, $end)
{
}
}