mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-15 22:41:30 +00:00
Formatted intellephesnse and documented
processing unit.
This commit is contained in:
parent
7c4100b08b
commit
c956700c9c
@ -1,17 +1,54 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PHP version 7
|
||||
*
|
||||
* @category Scientific_R&D
|
||||
* @package Food_LIFO
|
||||
* @author Povilas Brilius <pbrilius@gmail.com>
|
||||
* @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 <pbrilius@gmail.com>
|
||||
* @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 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user