Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM php:8.1-apache-buster

COPY --from=composer:2.1 /usr/bin/composer /usr/bin/composer

ENV APACHE_DOCUMENT_ROOT /opt/disguise/public

RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf
RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf

RUN apt-get update && apt-get install -y \
unzip \
zip \
&& rm -rf /var/lib/apt/lists/* \
2 changes: 0 additions & 2 deletions spec/GildedRoseSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@
expect($gr->getItem(0)->sellIn)->toBe(-2);
});
});
/*
context("Conjured Items", function () {
it('updates Conjured items before the sell date', function () {
$gr = new GildedRose([new Item('Conjured Mana Cake', 10, 10)]);
Expand Down Expand Up @@ -190,6 +189,5 @@
expect($gr->getItem(0)->sellIn)->toBe(-11);
});
});
*/
});
});
13 changes: 11 additions & 2 deletions src/GildedRose.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace App;

const DOUBLEDEGRADE = ['Conjured Mana Cake'] ;
class GildedRose
{
private $items;
Expand All @@ -25,7 +26,11 @@ public function nextDay()
if ($item->name != 'Aged Brie' and $item->name != 'Backstage passes to a TAFKAL80ETC concert') {
if ($item->quality > 0) {
if ($item->name != 'Sulfuras, Hand of Ragnaros') {
$item->quality = $item->quality - 1;
if (in_array($item->name, DOUBLEDEGRADE )) {
$item->quality = $item->quality - 2;
} else {
$item->quality = $item->quality - 1;
}
}
}
} else {
Expand Down Expand Up @@ -53,7 +58,11 @@ public function nextDay()
if ($item->name != 'Backstage passes to a TAFKAL80ETC concert') {
if ($item->quality > 0) {
if ($item->name != 'Sulfuras, Hand of Ragnaros') {
$item->quality = $item->quality - 1;
if (in_array($item->name, DOUBLEDEGRADE )) {
$item->quality = $item->quality - 2;
} else {
$item->quality = $item->quality - 1;
}
}
}
} else {
Expand Down