mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-14 22:21:20 +00:00
To simplify code, remove old business logic
This commit is contained in:
parent
4562b6d688
commit
ea9b680b55
@ -32,25 +32,13 @@ final class GildedRose
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($item->name !== 'Aged Brie' and $item->name !== 'Backstage passes to a TAFKAL80ETC concert') {
|
||||
if ($item->name !== 'Aged Brie') {
|
||||
if ($item->quality > 0) {
|
||||
$item->quality = $item->quality - 1;
|
||||
}
|
||||
} else {
|
||||
if ($item->quality < 50) {
|
||||
$item->quality = $item->quality + 1;
|
||||
if ($item->name === 'Backstage passes to a TAFKAL80ETC concert') {
|
||||
if ($item->sellIn < 11) {
|
||||
if ($item->quality < 50) {
|
||||
$item->quality = $item->quality + 1;
|
||||
}
|
||||
}
|
||||
if ($item->sellIn < 6) {
|
||||
if ($item->quality < 50) {
|
||||
$item->quality = $item->quality + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -58,12 +46,8 @@ final class GildedRose
|
||||
|
||||
if ($item->sellIn < 0) {
|
||||
if ($item->name !== 'Aged Brie') {
|
||||
if ($item->name !== 'Backstage passes to a TAFKAL80ETC concert') {
|
||||
if ($item->quality > 0) {
|
||||
$item->quality = $item->quality - 1;
|
||||
}
|
||||
} else {
|
||||
$item->quality = $item->quality - $item->quality;
|
||||
if ($item->quality > 0) {
|
||||
$item->quality = $item->quality - 1;
|
||||
}
|
||||
} else {
|
||||
if ($item->quality < 50) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user