diff --git a/Exception.php b/Source/Exception.php similarity index 92% rename from Exception.php rename to Source/Exception.php index a47ff42..c31b085 100644 --- a/Exception.php +++ b/Source/Exception.php @@ -1,5 +1,7 @@ _parameters = $parameters; @@ -187,11 +163,8 @@ private function setDefault(array $parameters) /** * Set parameters. - * - * @param array $parameters Parameters. - * @return void */ - public function setParameters(array $parameters) + public function setParameters(array $parameters): void { $this->resetCache(); @@ -204,22 +177,16 @@ public function setParameters(array $parameters) /** * Get parameters. - * - * @return array */ - public function getParameters() + public function getParameters(): array { return $this->_parameters; } /** * Set a parameter. - * - * @param string $key Key. - * @param mixed $value Value. - * @return mixed */ - public function setParameter($key, $value) + public function setParameter(string $key, $value) { $this->resetCache(); $old = null; @@ -235,11 +202,8 @@ public function setParameter($key, $value) /** * Get a parameter. - * - * @param string $parameter Parameter. - * @return mixed */ - public function getParameter($parameter) + public function getParameter(string $parameter) { if (array_key_exists($parameter, $this->_parameters)) { return $this->_parameters[$parameter]; @@ -250,11 +214,8 @@ public function getParameter($parameter) /** * Get a formatted parameter (i.e. zFormatted). - * - * @param string $parameter Parameter. - * @return mixed */ - public function getFormattedParameter($parameter) + public function getFormattedParameter(string $parameter) { if (null === $value = $this->getParameter($parameter)) { return null; @@ -265,11 +226,8 @@ public function getFormattedParameter($parameter) /** * Check a branch exists. - * - * @param string $branch Branch. - * @return bool */ - public function branchExists($branch) + public function branchExists(string $branch): bool { $qBranch = preg_quote($branch); @@ -284,11 +242,8 @@ public function branchExists($branch) /** * Unlinearize a branch to an array. - * - * @param string $branch Branch. - * @return array */ - public function unlinearizeBranch($branch) + public function unlinearizeBranch(string $branch): array { $parameters = $this->getParameters(); $out = []; @@ -329,12 +284,8 @@ public function unlinearizeBranch($branch) /** * Set keywords. - * - * @param array $keywords Keywords. - * @return void - * @throws \Hoa\Zformat\Exception */ - public function setKeywords($keywords) + public function setKeywords(array $keywords): void { $this->resetCache(); @@ -347,22 +298,16 @@ public function setKeywords($keywords) /** * Get keywords. - * - * @return array */ - public function getKeywords() + public function getKeywords(): array { return $this->_keywords; } /** * Set a keyword. - * - * @param string $key Key. - * @param mixed $value Value. - * @return mixed */ - public function setKeyword($key, $value) + public function setKeyword(string $key, $value) { $this->resetCache(); $old = null; @@ -378,11 +323,8 @@ public function setKeyword($key, $value) /** * Get a keyword. - * - * @param string $keyword Keyword. - * @return mixed */ - public function getKeyword($keyword) + public function getKeyword(string $keyword) { if (true === array_key_exists($keyword, $this->_keywords)) { return $this->_keywords[$keyword]; @@ -478,12 +420,8 @@ public function getKeyword($keyword) * and add the extension of power; * • recursion: 'oofarBaz', get 'arbar' first, and then, replace the * suffix 'ar' by 'az'. - * - * @param string $value Parameter value. - * @return string - * @throws \Hoa\Zformat\Exception */ - public function zFormat($value) + public function zFormat(string $value): string { if (!is_string($value)) { return $value; @@ -666,10 +604,8 @@ function ($match) use ($self, $value, &$keywords, &$parameters) { /** * Reset zFormat cache. - * - * @return void */ - private function resetCache() + private function resetCache(): void { unset($this->_cache); $this->_cache = []; diff --git a/Parameterizable.php b/Source/Parameterizable.php similarity index 88% rename from Parameterizable.php rename to Source/Parameterizable.php index d3a9a68..85109a0 100644 --- a/Parameterizable.php +++ b/Source/Parameterizable.php @@ -1,5 +1,7 @@ =7.1", + "hoa/consistency": "dev-master", + "hoa/exception" : "dev-master" }, "autoload": { "psr-4": { - "Hoa\\Zformat\\": "." + "Hoa\\Zformat\\": "Source" } }, "extra": { "branch-alias": { "dev-master": "1.x-dev" } - } + }, + "minimum-stability": "dev" }