mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-15 14:31:28 +00:00
To begin taking advantage of new domain, use wrt Sulfuras
This commit is contained in:
parent
c1b9f465d3
commit
f826225132
@ -6,17 +6,32 @@ namespace GildedRose;
|
|||||||
|
|
||||||
final class GildedRose
|
final class GildedRose
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @var Item[]
|
||||||
|
*/
|
||||||
|
private array $items;
|
||||||
|
|
||||||
|
private GildedRoseItemFactory $gildedRoseItemFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Item[] $items
|
* @param Item[] $items
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(array $items)
|
||||||
private array $items
|
{
|
||||||
) {
|
$this->items = $items;
|
||||||
|
$this->gildedRoseItemFactory = new GildedRoseItemFactory();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updateQuality(): void
|
public function updateQuality(): void
|
||||||
{
|
{
|
||||||
foreach ($this->items as $item) {
|
foreach ($this->items as $item) {
|
||||||
|
|
||||||
|
if ($item->name === 'Sulfuras, Hand of Ragnaros') {
|
||||||
|
$gildedRoseItem = $this->gildedRoseItemFactory->createGildedRoseItem($item);
|
||||||
|
$gildedRoseItem->ageByOneDay();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if ($item->name !== 'Aged Brie' and $item->name !== 'Backstage passes to a TAFKAL80ETC concert') {
|
if ($item->name !== 'Aged Brie' and $item->name !== 'Backstage passes to a TAFKAL80ETC concert') {
|
||||||
if ($item->quality > 0) {
|
if ($item->quality > 0) {
|
||||||
if ($item->name !== 'Sulfuras, Hand of Ragnaros') {
|
if ($item->name !== 'Sulfuras, Hand of Ragnaros') {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user