mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-17 15:31:27 +00:00
Syntax operators and Conjured brand.
This commit is contained in:
parent
9fc06142b3
commit
efb4e9b9bf
@ -52,9 +52,16 @@ final class GildedRose
|
|||||||
if ($item->name === 'Sulfuras, Hand of Ragnaros') {
|
if ($item->name === 'Sulfuras, Hand of Ragnaros') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$item->sell_in--;
|
||||||
|
|
||||||
if ($item->name !== 'Aged Brie' && $item->name !== 'Backstage passes to a TAFKAL80ETC concert') {
|
if ($item->name !== 'Aged Brie' && $item->name !== 'Backstage passes to a TAFKAL80ETC concert') {
|
||||||
if ($item->quality > 0) {
|
if ($item->quality > 0) {
|
||||||
$item->quality--;
|
if (strstr($item->name, 'Conjured') === 0) {
|
||||||
|
$item->quality -= 2;
|
||||||
|
} else {
|
||||||
|
$item->quality--;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ($item->quality < 50) {
|
if ($item->quality < 50) {
|
||||||
@ -70,16 +77,14 @@ final class GildedRose
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$item->sell_in--;
|
|
||||||
|
|
||||||
if ($item->sell_in < 0) {
|
if ($item->sell_in < 0) {
|
||||||
if ($item->name !== 'Aged Brie') {
|
if ($item->name !== 'Aged Brie') {
|
||||||
if ($item->name !== 'BackstageString passes to a TAFKAL80ETC concert') {
|
if ($item->name === 'Backstage passes to a TAFKAL80ETC concert') {
|
||||||
|
$item->quality = 0;
|
||||||
|
} else {
|
||||||
if ($item->quality > 0) {
|
if ($item->quality > 0) {
|
||||||
$item->quality -= 2;
|
$item->quality -= 2;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
$item->quality = 0;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ($item->quality < 50) {
|
if ($item->quality < 50) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user