mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-16 06:51:27 +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', 15, 20),
|
||||||
new Item('Backstage passes to a TAFKAL80ETC concert', 10, 49),
|
new Item('Backstage passes to a TAFKAL80ETC concert', 10, 49),
|
||||||
new Item('Backstage passes to a TAFKAL80ETC concert', 5, 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)
|
new Item('Conjured Mana Cake', 3, 6)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -28,8 +27,8 @@ if (count($argv) > 1) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for ($i = 0; $i < $days; $i++) {
|
for ($i = 0; $i < $days; $i++) {
|
||||||
echo("-------- day $i --------\n");
|
echo '-------- Day ' . ($i + 1) . ' --------' . PHP_EOL;
|
||||||
echo("name\tsellIn\tquality\n");
|
echo("Name\tSell in\tQuality\n");
|
||||||
foreach ($items as $item) {
|
foreach ($items as $item) {
|
||||||
echo $item . PHP_EOL;
|
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->name !== 'Aged Brie' && $item->name !== 'Backstage passes to a TAFKAL80ETC concert') {
|
||||||
if ($item->quality > 0) {
|
if ($item->quality > 0) {
|
||||||
if (strstr($item->name, 'Conjured') === 0) {
|
if (strstr($item->name, 'Conjured', true) === '') {
|
||||||
$item->quality -= 2;
|
$item->quality -= 2;
|
||||||
} else {
|
} else {
|
||||||
$item->quality--;
|
$item->quality--;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user