Modify conditional statment

This commit is contained in:
kitfbgh 2022-04-02 11:26:24 +08:00
parent d7a4efeef7
commit 468ff532ea

View File

@ -24,13 +24,7 @@ final class GildedRose
public function updateQuality(): void
{
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') {
$item->quality = $item->quality - 1;
}
}
} else {
if ($item->name === 'Aged Brie' || $item->name === 'Backstage passes to a TAFKAL80ETC concert') {
if ($item->quality < 50) {
$item->quality = $item->quality + 1;
if ($item->name === 'Backstage passes to a TAFKAL80ETC concert') {
@ -46,26 +40,34 @@ final class GildedRose
}
}
}
} else {
if ($item->quality > 0) {
if ($item->name !== 'Sulfuras, Hand of Ragnaros') {
$item->quality = $item->quality - 1;
}
}
}
if ($item->name !== 'Sulfuras, Hand of Ragnaros') {
if ($item->name === 'Sulfuras, Hand of Ragnaros') {
} else {
$item->sellIn = $item->sellIn - 1;
}
if ($item->sellIn < 0) {
if ($item->name !== 'Aged Brie') {
if ($item->name !== 'Backstage passes to a TAFKAL80ETC concert') {
if ($item->name === 'Aged Brie') {
if ($item->quality < 50) {
$item->quality = $item->quality + 1;
}
} else {
if ($item->name === 'Backstage passes to a TAFKAL80ETC concert') {
$item->quality = $item->quality - $item->quality;
} else {
if ($item->quality > 0) {
if ($item->name !== 'Sulfuras, Hand of Ragnaros') {
if ($item->name === 'Sulfuras, Hand of Ragnaros') {
} else {
$item->quality = $item->quality - 1;
}
}
} else {
$item->quality = $item->quality - $item->quality;
}
} else {
if ($item->quality < 50) {
$item->quality = $item->quality + 1;
}
}
}