| Total Complexity | 7 |
| Total Lines | 54 |
| Duplicated Lines | 0 % |
| Coverage | 88.89% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 12 | class blocks_factory |
||
| 13 | { |
||
| 14 | /** @var array */ |
||
| 15 | private $blocks; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * Constructor |
||
| 19 | * |
||
| 20 | * @param \phpbb\di\service_collection $blocks Service Collection |
||
| 21 | */ |
||
| 22 | 3 | public function __construct(\phpbb\di\service_collection $blocks) |
|
| 23 | { |
||
| 24 | 3 | $this->register_blocks($blocks); |
|
| 25 | 3 | } |
|
| 26 | |||
| 27 | /** |
||
| 28 | * Register available topic blocks |
||
| 29 | * @param \phpbb\di\service_collection $blocks |
||
| 30 | */ |
||
| 31 | 3 | protected function register_blocks(\phpbb\di\service_collection $blocks) |
|
| 32 | { |
||
| 33 | 3 | $this->blocks = array(); |
|
| 34 | 3 | foreach ($blocks as $driver) |
|
| 35 | { |
||
| 36 | 3 | $this->blocks[$driver->get_name()] = $driver; |
|
| 37 | 3 | } |
|
| 38 | 3 | } |
|
| 39 | |||
| 40 | /** |
||
| 41 | * Get topic block object |
||
| 42 | * |
||
| 43 | * @param string $service_name |
||
| 44 | * @return null|\blitze\content\services\topic\driver\block_interface |
||
| 45 | */ |
||
| 46 | public function get($service_name) |
||
| 49 | } |
||
| 50 | |||
| 51 | /** |
||
| 52 | * Get available content topic blocks |
||
| 53 | * @return array |
||
| 54 | */ |
||
| 55 | 2 | public function get_all() |
|
| 66 | } |
||
| 67 | } |
||
| 68 |