| Total Complexity | 6 |
| Total Lines | 54 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 10 | abstract class StyleContainer |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * @var StyleBuilder |
||
| 14 | */ |
||
| 15 | protected $styles; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * @var StyleCollection |
||
| 19 | */ |
||
| 20 | protected $collection; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @var string |
||
| 24 | */ |
||
| 25 | protected $name; |
||
| 26 | |||
| 27 | public function __construct(StyleBuilder $styles, StyleCollection $collection) |
||
| 28 | { |
||
| 29 | $this->styles = $styles; |
||
| 30 | $this->collection = $collection; |
||
| 31 | $this->name = $this->getName(); |
||
| 32 | } |
||
| 33 | |||
| 34 | abstract protected function getName() : string; |
||
| 35 | |||
| 36 | final protected function setStyle(string $value, bool $important) : StyleBuilder |
||
| 37 | { |
||
| 38 | $this->collection->style($this->name, $value, $important); |
||
| 39 | return $this->styles; |
||
| 40 | } |
||
| 41 | |||
| 42 | final protected function setStylePX(int $value, bool $important) : StyleBuilder |
||
| 46 | } |
||
| 47 | |||
| 48 | final protected function setStylePercent(float $value, bool $important) : StyleBuilder |
||
| 52 | } |
||
| 53 | |||
| 54 | final protected function setStyleEM(float $value, bool $important) : StyleBuilder |
||
| 55 | { |
||
| 56 | $this->collection->styleEM($this->name, $value, $important); |
||
| 57 | return $this->styles; |
||
| 58 | } |
||
| 59 | |||
| 60 | final protected function setStyleREM(float $value, bool $important) : StyleBuilder |
||
| 64 | } |
||
| 65 | } |
||
| 66 |