diff --git a/src/Block/BlockLoaderChain.php b/src/Block/BlockLoaderChain.php index 117f9df7..2fa646a5 100644 --- a/src/Block/BlockLoaderChain.php +++ b/src/Block/BlockLoaderChain.php @@ -47,32 +47,32 @@ public function exists(string $type): bool return false; } - public function load($block): BlockInterface + public function load($configuration): BlockInterface { - if (!\is_string($block) && !\is_array($block)) { + if (!\is_string($configuration) && !\is_array($configuration)) { throw new \TypeError(sprintf( 'Argument 1 passed to %s must be of type string or array, %s given', __METHOD__, - \is_object($block) ? 'object of type '.\get_class($block) : \gettype($block) + \is_object($configuration) ? 'object of type '.\get_class($configuration) : \gettype($configuration) )); } foreach ($this->loaders as $loader) { - if ($loader->support($block)) { - return $loader->load($block); + if ($loader->support($configuration)) { + return $loader->load($configuration); } } throw new BlockNotFoundException(); } - public function support($name): bool + public function support($configuration): bool { - if (!\is_string($name) && !\is_array($name)) { + if (!\is_string($configuration) && !\is_array($configuration)) { throw new \TypeError(sprintf( 'Argument 1 passed to %s must be of type string or array, %s given', __METHOD__, - \is_object($name) ? 'object of type '.\get_class($name) : \gettype($name) + \is_object($configuration) ? 'object of type '.\get_class($configuration) : \gettype($configuration) )); } diff --git a/src/Block/BlockLoaderInterface.php b/src/Block/BlockLoaderInterface.php index 7a6c0231..abca642d 100644 --- a/src/Block/BlockLoaderInterface.php +++ b/src/Block/BlockLoaderInterface.php @@ -19,16 +19,16 @@ interface BlockLoaderInterface { /** - * @param string|array $name + * @param string|array $configuration * * @throws BlockNotFoundException if no block with that name is found */ - public function load($name): BlockInterface; + public function load($configuration): BlockInterface; /** - * @param string|array $name + * @param string|array $configuration */ - public function support($name): bool; + public function support($configuration): bool; public function exists(string $type): bool; } diff --git a/src/Block/BlockServiceManager.php b/src/Block/BlockServiceManager.php index ac4fecd5..2efe0c3a 100644 --- a/src/Block/BlockServiceManager.php +++ b/src/Block/BlockServiceManager.php @@ -59,14 +59,14 @@ public function get(BlockInterface $block): BlockServiceInterface return $this->services[$block->getType()]; } - public function getService($id): BlockServiceInterface + public function getService($name): BlockServiceInterface { - return $this->load($id); + return $this->load($name); } - public function has(string $id): bool + public function has(string $name): bool { - return isset($this->services[$id]); + return isset($this->services[$name]); } /** diff --git a/src/Menu/MenuRegistry.php b/src/Menu/MenuRegistry.php index c9cd18af..183ea964 100644 --- a/src/Menu/MenuRegistry.php +++ b/src/Menu/MenuRegistry.php @@ -23,9 +23,9 @@ final class MenuRegistry implements MenuRegistryInterface */ private $names = []; - public function add(string $menu): void + public function add(string $name): void { - $this->names[$menu] = $menu; + $this->names[$name] = $name; } public function getAliasNames(): array diff --git a/src/Model/BaseBlock.php b/src/Model/BaseBlock.php index 8e9ae6ab..9e105cbc 100644 --- a/src/Model/BaseBlock.php +++ b/src/Model/BaseBlock.php @@ -160,11 +160,11 @@ public function getUpdatedAt(): ?\DateTime return $this->updatedAt; } - public function addChildren(BlockInterface $child): void + public function addChildren(BlockInterface $children): void { - $this->children[] = $child; + $this->children[] = $children; - $child->setParent($this); + $children->setParent($this); } public function getChildren(): array