diff --git a/php7/src/GildedRose.php b/php7/src/GildedRose.php index 183519ed..134f1488 100644 --- a/php7/src/GildedRose.php +++ b/php7/src/GildedRose.php @@ -1,17 +1,54 @@ + * @license eupl-1.1 https://help.github.com/en/github/creating-cloning-and-archiving-repositories/licensing-a-repository + * @link pbgroupeu.wordpress.com + */ + namespace App; -final class GildedRose { +/** + * Items processing unit + * + * @category Accountancy + * @package Timeline_Graph + * @author Povilas Brilius + * @license eupl-1.1 https://help.github.com/en/github/creating-cloning-and-archiving-repositories/licensing-a-repository + * @link pbgroupeu.wordpress.com + */ +final class GildedRose +{ - private $items = []; + /** + * Stock items + * + * @var array + */ + private $_items = []; - public function __construct($items) { - $this->items = $items; + /** + * Constructor with items + * + * @param array $items stock + */ + public function __construct(array $items) + { + $this->_items = $items; } - public function updateQuality() { - foreach ($this->items as $item) { + /** + * Advance by a time frame of 1 day + * + * @return void + */ + public function updateQuality() + { + foreach ($this->_items as $item) { if ($item->name != 'Aged Brie' and $item->name != 'Backstage passes to a TAFKAL80ETC concert') { if ($item->quality > 0) { if ($item->name != 'Sulfuras, Hand of Ragnaros') { @@ -35,11 +72,11 @@ final class GildedRose { } } } - + if ($item->name != 'Sulfuras, Hand of Ragnaros') { $item->sell_in = $item->sell_in - 1; } - + if ($item->sell_in < 0) { if ($item->name != 'Aged Brie') { if ($item->name != 'Backstage passes to a TAFKAL80ETC concert') { @@ -60,4 +97,3 @@ final class GildedRose { } } } -