mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-15 22:41:30 +00:00
R-03 Creating methods for the first level of conditional expressions
This commit is contained in:
parent
bd3dd7b791
commit
cafa70a7b6
@ -19,24 +19,33 @@ 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') {
|
||||||
if ($item->quality > 0) {
|
$this->isNotAgedBrieBackstagePasses($item);
|
||||||
if ($item->name != 'Sulfuras, Hand of Ragnaros') {
|
|
||||||
$item->quality = $item->quality - 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if ($item->quality < 50) {
|
$this->isAgedBrieBackstagePasses($item);
|
||||||
$item->quality = $item->quality + 1;
|
}
|
||||||
if ($item->name == 'Backstage passes to a TAFKAL80ETC concert') {
|
}
|
||||||
if ($item->sell_in < 11) {
|
|
||||||
if ($item->quality < 50) {
|
public function isNotAgedBrieBackstagePasses(& $item){
|
||||||
$item->quality = $item->quality + 1;
|
if ($item->quality > 0) {
|
||||||
}
|
if ($item->name != 'Sulfuras, Hand of Ragnaros') {
|
||||||
|
$item->quality = $item->quality - 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isAgedBrieBackstagePasses(& $item)
|
||||||
|
{
|
||||||
|
if ($item->quality < 50) {
|
||||||
|
$item->quality = $item->quality + 1;
|
||||||
|
if ($item->name == 'Backstage passes to a TAFKAL80ETC concert') {
|
||||||
|
if ($item->sell_in < 11) {
|
||||||
|
if ($item->quality < 50) {
|
||||||
|
$item->quality = $item->quality + 1;
|
||||||
}
|
}
|
||||||
if ($item->sell_in < 6) {
|
}
|
||||||
if ($item->quality < 50) {
|
if ($item->sell_in < 6) {
|
||||||
$item->quality = $item->quality + 1;
|
if ($item->quality < 50) {
|
||||||
}
|
$item->quality = $item->quality + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user