Structural sencentes - statements improvement.

This commit is contained in:
Povilas Brilius 2020-05-01 19:54:43 +03:00
parent e5f4e5e30d
commit 5d1185e9fb

View File

@ -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++;
}
}
}