mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-15 22:41:30 +00:00
Structural sencentes - statements improvement.
This commit is contained in:
parent
e5f4e5e30d
commit
5d1185e9fb
@ -49,32 +49,28 @@ final class GildedRose
|
||||
public function updateQuality()
|
||||
{
|
||||
foreach ($this->_items as $item) {
|
||||
if ($item->name != 'Aged Brie' and $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->name != 'Sulfuras, Hand of Ragnaros') {
|
||||
$item->quality = $item->quality - 1;
|
||||
$item->quality--;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($item->quality < 50) {
|
||||
$item->quality = $item->quality + 1;
|
||||
$item->quality = $item->quality++;
|
||||
if ($item->name == 'Backstage passes to a TAFKAL80ETC concert') {
|
||||
if ($item->sell_in < 11) {
|
||||
if ($item->quality < 50) {
|
||||
$item->quality = $item->quality + 2;
|
||||
}
|
||||
$item->quality += 2;
|
||||
}
|
||||
if ($item->sell_in < 6) {
|
||||
if ($item->quality < 50) {
|
||||
$item->quality = $item->quality + 3;
|
||||
}
|
||||
$item->quality += 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($item->name != 'Sulfuras, Hand of Ragnaros') {
|
||||
$item->sell_in = $item->sell_in - 1;
|
||||
$item->sell_in--;
|
||||
}
|
||||
|
||||
if ($item->sell_in < 0) {
|
||||
@ -82,15 +78,15 @@ final class GildedRose
|
||||
if ($item->name != 'Backstage passes to a TAFKAL80ETC concert') {
|
||||
if ($item->quality > 0) {
|
||||
if ($item->name != 'Sulfuras, Hand of Ragnaros') {
|
||||
$item->quality = $item->quality - 2;
|
||||
$item->quality -= 2;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$item->quality = $item->quality - $item->quality;
|
||||
$item->quality = 0;
|
||||
}
|
||||
} else {
|
||||
if ($item->quality < 50) {
|
||||
$item->quality = $item->quality + 1;
|
||||
$item->quality++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user