| Total Complexity | 4 |
| Total Lines | 33 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php declare(strict_types=1); |
||
| 8 | class Prefix |
||
| 9 | { |
||
| 10 | /** @var Config */ |
||
| 11 | private $config; |
||
| 12 | |||
| 13 | /** @var Hash */ |
||
| 14 | private $sourceHash; |
||
| 15 | |||
| 16 | |||
| 17 | public function __construct(Config $config, Hash $sourceHash) |
||
| 18 | { |
||
| 19 | $this->config = $config; |
||
| 20 | $this->sourceHash = $sourceHash; |
||
| 21 | } |
||
| 22 | |||
| 23 | |||
| 24 | public function config(): Config |
||
| 25 | { |
||
| 26 | $config = clone $this->config; |
||
| 27 | $config->database = $this->database(); |
||
| 28 | return $config; |
||
| 29 | } |
||
| 30 | |||
| 31 | |||
| 32 | public function database(): string |
||
| 33 | { |
||
| 34 | return $this->prefix() . $this->sourceHash->md5(); |
||
| 35 | } |
||
| 36 | |||
| 37 | |||
| 38 | public function prefix(): string |
||
| 41 | } |
||
| 42 | |||
| 43 | } |
||
| 44 |