To simplify code, remove old business logic

This commit is contained in:
Sam Burns 2024-01-24 15:47:22 +00:00
parent f826225132
commit df7caf6747

View File

@ -34,10 +34,8 @@ final class GildedRose
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') {
$item->quality = $item->quality - 1; $item->quality = $item->quality - 1;
} }
}
} else { } else {
if ($item->quality < 50) { if ($item->quality < 50) {
$item->quality = $item->quality + 1; $item->quality = $item->quality + 1;
@ -56,18 +54,14 @@ final class GildedRose
} }
} }
if ($item->name !== 'Sulfuras, Hand of Ragnaros') {
$item->sellIn = $item->sellIn - 1; $item->sellIn = $item->sellIn - 1;
}
if ($item->sellIn < 0) { if ($item->sellIn < 0) {
if ($item->name !== 'Aged Brie') { if ($item->name !== 'Aged Brie') {
if ($item->name !== 'Backstage passes to a TAFKAL80ETC concert') { if ($item->name !== 'Backstage passes to a TAFKAL80ETC concert') {
if ($item->quality > 0) { if ($item->quality > 0) {
if ($item->name !== 'Sulfuras, Hand of Ragnaros') {
$item->quality = $item->quality - 1; $item->quality = $item->quality - 1;
} }
}
} else { } else {
$item->quality = $item->quality - $item->quality; $item->quality = $item->quality - $item->quality;
} }