| Total Complexity | 5 |
| Total Lines | 39 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 16 | class PatchEvent extends AbstractEvent |
||
| 17 | { |
||
| 18 | public const NAME = 'dotfiles.patch'; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * @var array |
||
| 22 | */ |
||
| 23 | private $patches; |
||
| 24 | |||
| 25 | public function __construct(array $patches) |
||
| 26 | { |
||
| 27 | $this->patches = $patches; |
||
| 28 | } |
||
| 29 | |||
| 30 | public function addPatch($target, $patch): void |
||
| 31 | { |
||
| 32 | if (!isset($this->patches[$target])) { |
||
| 33 | $this->patches[$target] = array(); |
||
| 34 | } |
||
| 35 | $this->patches[$target][] = $patch; |
||
| 36 | } |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @return array |
||
| 40 | */ |
||
| 41 | public function getPatches(): array |
||
| 42 | { |
||
| 43 | return $this->patches; |
||
| 44 | } |
||
| 45 | |||
| 46 | /** |
||
| 47 | * Override current patch. |
||
| 48 | * |
||
| 49 | * @param string $relativePathName |
||
| 50 | * @param array $value |
||
| 51 | */ |
||
| 52 | public function setPatch(string $relativePathName, array $value): void |
||
| 55 | } |
||
| 56 | } |
||
| 57 |