From 1e1826519f2935d13a42accb261fc9e8015a100c Mon Sep 17 00:00:00 2001 From: Povilas Brilius Date: Fri, 1 May 2020 20:52:03 +0300 Subject: [PATCH] Working conjured items. --- php7/fixtures/texttest_fixture.php | 5 ++--- php7/src/GildedRose.php | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/php7/fixtures/texttest_fixture.php b/php7/fixtures/texttest_fixture.php index 049bc593..f9d4c352 100644 --- a/php7/fixtures/texttest_fixture.php +++ b/php7/fixtures/texttest_fixture.php @@ -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; } diff --git a/php7/src/GildedRose.php b/php7/src/GildedRose.php index d28f7e93..40127d29 100644 --- a/php7/src/GildedRose.php +++ b/php7/src/GildedRose.php @@ -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--;