mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-18 16:01:42 +00:00
- Create an Ioc container and set factories and services - Adjust degrading Strategies - Clean up and do global chores here and there and avoid Dry code - Write unit and integration tests and ensure correct business logic
22 lines
510 B
PHP
22 lines
510 B
PHP
<?php
|
|
|
|
namespace GildedRose\Services\Strategies;
|
|
|
|
use GildedRose\Item;
|
|
|
|
class ConjuredStrategy extends DefaultStrategy
|
|
{
|
|
public function setSellIn(): Item
|
|
{
|
|
$this->item->sell_in--;
|
|
return $this->item;
|
|
}
|
|
|
|
public function setQuality(): Item
|
|
{
|
|
$this->item->quality = ($this->item->quality - ($this->degradeRate * 2)) < self::MIN_QUALITY_VALUE ?
|
|
self::MIN_QUALITY_VALUE : $this->item->quality -= ($this->degradeRate * 2);
|
|
return $this->item;
|
|
}
|
|
}
|