mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-15 22:41:30 +00:00
Working conjured items.
This commit is contained in:
parent
82dc714539
commit
1e1826519f
@ -16,7 +16,6 @@ $items = array(
|
||||
new Item('Backstage passes to a TAFKAL80ETC concert', 15, 20),
|
||||
new Item('Backstage passes to a TAFKAL80ETC concert', 10, 49),
|
||||
new Item('Backstage passes to a TAFKAL80ETC concert', 5, 49),
|
||||
// this conjured item does not work properly yet
|
||||
new Item('Conjured Mana Cake', 3, 6)
|
||||
);
|
||||
|
||||
@ -28,8 +27,8 @@ if (count($argv) > 1) {
|
||||
}
|
||||
|
||||
for ($i = 0; $i < $days; $i++) {
|
||||
echo("-------- day $i --------\n");
|
||||
echo("name\tsellIn\tquality\n");
|
||||
echo '-------- Day ' . ($i + 1) . ' --------' . PHP_EOL;
|
||||
echo("Name\tSell in\tQuality\n");
|
||||
foreach ($items as $item) {
|
||||
echo $item . PHP_EOL;
|
||||
}
|
||||
|
||||
@ -57,7 +57,7 @@ final class GildedRose
|
||||
|
||||
if ($item->name !== 'Aged Brie' && $item->name !== 'Backstage passes to a TAFKAL80ETC concert') {
|
||||
if ($item->quality > 0) {
|
||||
if (strstr($item->name, 'Conjured') === 0) {
|
||||
if (strstr($item->name, 'Conjured', true) === '') {
|
||||
$item->quality -= 2;
|
||||
} else {
|
||||
$item->quality--;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user