Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
100.00% |
1 / 1 |
|
100.00% |
6 / 6 |
CRAP | |
100.00% |
14 / 14 |
App | |
100.00% |
1 / 1 |
|
100.00% |
6 / 6 |
9 | |
100.00% |
14 / 14 |
__construct($id = null) | |
100.00% |
1 / 1 |
2 | |
100.00% |
3 / 3 |
|||
getCostPerMonth() | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
setCostPerMonth($costPerMonth) | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
getCostPerYear() | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
getId() | |
100.00% |
1 / 1 |
2 | |
100.00% |
3 / 3 |
|||
setId($id) | |
100.00% |
1 / 1 |
2 | |
100.00% |
4 / 4 |
<?php | |
namespace TriNetAssess; | |
/** | |
* Class App | |
* | |
* @package TriNetAssess | |
*/ | |
class App implements CostCalculationsInterface | |
{ | |
/** | |
* The App's cost for a month | |
* | |
* @var float $costPerMonth | |
*/ | |
protected $costPerMonth; | |
/** | |
* App id | |
* | |
* @var integer $id | |
*/ | |
protected $id; | |
/** | |
* App constructor. | |
* | |
* @param integer $id the App's id | |
* | |
* @throws \DomainException | |
*/ | |
public function __construct($id = null) | |
{ | |
if (null !== $id) { | |
$this->setId($id); | |
} | |
} | |
/** | |
* Get the total cost per month | |
* | |
* @return float the App's total cost for a month | |
*/ | |
public function getCostPerMonth() | |
{ | |
return $this->costPerMonth; | |
} | |
/** | |
* Set the total cost per month | |
* | |
* @param float $costPerMonth total cost per month | |
* | |
* @return float the App's total cost for a month | |
* @throws \DomainException | |
*/ | |
public function setCostPerMonth($costPerMonth) | |
{ | |
$this->costPerMonth = $costPerMonth; | |
return $this->costPerMonth; | |
} | |
/** | |
* Get the total cost per year | |
* | |
* @return float total cost per year | |
*/ | |
public function getCostPerYear() | |
{ | |
return 12 * $this->getCostPerMonth(); | |
} | |
/** | |
* Get the App's id | |
* | |
* @return integer | |
* @throws \DomainException | |
*/ | |
public function getId() | |
{ | |
if (!is_numeric($this->id)) { | |
throw new \DomainException('App id must be numeric'); | |
} | |
return $this->id; | |
} | |
/** | |
* Set the App's id | |
* | |
* @param integer $id the App's id | |
* | |
* @return integer | |
* @throws \DomainException | |
*/ | |
public function setId($id) | |
{ | |
if (!is_numeric($id)) { | |
throw new \DomainException('App id must be numeric'); | |
} | |
$this->id = $id; | |
return $this->id; | |
} |