GildedRose-Refactoring-Kata/php/src/Services/Strategies/ConjuredStrategy.php
naciriii 66867fbe7a refactor: set global architecture and refactor code
- 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
2022-03-30 05:34:47 +01:00

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;
}
}