R-03 Creating methods for the first level of conditional expressions

This commit is contained in:
dashiwa 2020-12-31 17:17:41 +03:00
parent bd3dd7b791
commit cafa70a7b6

View File

@ -19,12 +19,22 @@ class FirstProcessingRule
$item = $this->item; $item = $this->item;
if ($item->name != 'Aged Brie' and $item->name != 'Backstage passes to a TAFKAL80ETC concert') { if ($item->name != 'Aged Brie' and $item->name != 'Backstage passes to a TAFKAL80ETC concert') {
$this->isNotAgedBrieBackstagePasses($item);
} else {
$this->isAgedBrieBackstagePasses($item);
}
}
public function isNotAgedBrieBackstagePasses(& $item){
if ($item->quality > 0) { if ($item->quality > 0) {
if ($item->name != 'Sulfuras, Hand of Ragnaros') { if ($item->name != 'Sulfuras, Hand of Ragnaros') {
$item->quality = $item->quality - 1; $item->quality = $item->quality - 1;
} }
} }
} else { }
public function isAgedBrieBackstagePasses(& $item)
{
if ($item->quality < 50) { if ($item->quality < 50) {
$item->quality = $item->quality + 1; $item->quality = $item->quality + 1;
if ($item->name == 'Backstage passes to a TAFKAL80ETC concert') { if ($item->name == 'Backstage passes to a TAFKAL80ETC concert') {
@ -41,6 +51,5 @@ class FirstProcessingRule
} }
} }
} }
}
} }