| 1 | <?php |
||
| 10 | abstract class AbstractFactory implements Factorable |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * @var Config |
||
| 14 | */ |
||
| 15 | protected $config; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * @return string |
||
| 19 | */ |
||
| 20 | abstract public function getModuleName(); |
||
| 21 | |||
| 22 | 1 | public function __construct() |
|
| 23 | { |
||
| 24 | 1 | if (!$this->moduleIsInstalled()) { |
|
| 25 | 1 | throw new ModuleIsNotInstalled($this->getModuleName()); |
|
| 26 | } |
||
| 27 | } |
||
| 28 | |||
| 29 | /** |
||
| 30 | * @return bool |
||
| 31 | */ |
||
| 32 | public function moduleIsInstalled() |
||
| 40 | |||
| 41 | /** |
||
| 42 | * @param Config $config |
||
| 43 | * |
||
| 44 | * @return CacheProvider |
||
| 45 | * |
||
| 46 | * @throws InvalidCacheConfigException |
||
| 47 | */ |
||
| 48 | 4 | public function create(Config $config) |
|
| 66 | |||
| 67 | /** |
||
| 68 | * @param CacheProvider $cacheProvider |
||
| 69 | * |
||
| 70 | * @return CacheProvider |
||
| 71 | */ |
||
| 72 | abstract protected function decorateWithConnectable(CacheProvider $cacheProvider); |
||
| 73 | |||
| 74 | /** |
||
| 75 | * @param Config $config |
||
| 76 | * |
||
| 77 | * @return bool |
||
| 78 | */ |
||
| 79 | abstract protected function isValidConfig(Config $config); |
||
| 80 | } |
||
| 81 |