@@ -43,7 +43,7 @@ |
||
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | /** |
| 46 | - * @param array $routes |
|
| 46 | + * @param array $routables |
|
| 47 | 47 | * @return AppConfig Chainable |
| 48 | 48 | */ |
| 49 | 49 | public function set_routables(array $routables) |
@@ -10,24 +10,24 @@ discard block |
||
| 10 | 10 | class AppConfig extends AbstractConfig |
| 11 | 11 | { |
| 12 | 12 | /** |
| 13 | - * @var array $routes |
|
| 14 | - */ |
|
| 13 | + * @var array $routes |
|
| 14 | + */ |
|
| 15 | 15 | private $routes = []; |
| 16 | 16 | |
| 17 | 17 | /** |
| 18 | - * @var array $routables |
|
| 19 | - */ |
|
| 18 | + * @var array $routables |
|
| 19 | + */ |
|
| 20 | 20 | private $routables = []; |
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | - * @var array $modules |
|
| 24 | - */ |
|
| 23 | + * @var array $modules |
|
| 24 | + */ |
|
| 25 | 25 | private $modules = []; |
| 26 | 26 | |
| 27 | 27 | /** |
| 28 | - * @param array $routes |
|
| 29 | - * @return AppConfig Chainable |
|
| 30 | - */ |
|
| 28 | + * @param array $routes |
|
| 29 | + * @return AppConfig Chainable |
|
| 30 | + */ |
|
| 31 | 31 | public function set_routes(array $routes) |
| 32 | 32 | { |
| 33 | 33 | $this->routes = $routes; |
@@ -35,17 +35,17 @@ discard block |
||
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | - * @return array |
|
| 39 | - */ |
|
| 38 | + * @return array |
|
| 39 | + */ |
|
| 40 | 40 | public function routes() |
| 41 | 41 | { |
| 42 | 42 | return $this->routes; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | /** |
| 46 | - * @param array $routes |
|
| 47 | - * @return AppConfig Chainable |
|
| 48 | - */ |
|
| 46 | + * @param array $routes |
|
| 47 | + * @return AppConfig Chainable |
|
| 48 | + */ |
|
| 49 | 49 | public function set_routables(array $routables) |
| 50 | 50 | { |
| 51 | 51 | $this->routables = $routables; |
@@ -53,17 +53,17 @@ discard block |
||
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | /** |
| 56 | - * @return array |
|
| 57 | - */ |
|
| 56 | + * @return array |
|
| 57 | + */ |
|
| 58 | 58 | public function routables() |
| 59 | 59 | { |
| 60 | 60 | return $this->routables; |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | /** |
| 64 | - * @param array $modules |
|
| 65 | - * @return AppConfig Chainable |
|
| 66 | - */ |
|
| 64 | + * @param array $modules |
|
| 65 | + * @return AppConfig Chainable |
|
| 66 | + */ |
|
| 67 | 67 | public function set_modules(array $modules) |
| 68 | 68 | { |
| 69 | 69 | $this->modules = $modules; |
@@ -71,8 +71,8 @@ discard block |
||
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | /** |
| 74 | - * @return array |
|
| 75 | - */ |
|
| 74 | + * @return array |
|
| 75 | + */ |
|
| 76 | 76 | public function modules() |
| 77 | 77 | { |
| 78 | 78 | return $this->modules; |
@@ -127,7 +127,6 @@ |
||
| 127 | 127 | * |
| 128 | 128 | * @link http://www.faqs.org/rfcs/rfc4646.html Tags for Identifying Languages |
| 129 | 129 | * @link http://www.faqs.org/rfcs/rfc4647.html Matching of Language Tags |
| 130 | - * @param string $ident Language identifier |
|
| 131 | 130 | * @return self |
| 132 | 131 | * |
| 133 | 132 | * @todo Implement proper ISO 639 sanitization |
@@ -13,30 +13,30 @@ discard block |
||
| 13 | 13 | class Language implements LanguageInterface |
| 14 | 14 | { |
| 15 | 15 | /** |
| 16 | - * The language identifier, commonly a ISO 639 code |
|
| 17 | - * |
|
| 18 | - * @var string $ident |
|
| 19 | - */ |
|
| 16 | + * The language identifier, commonly a ISO 639 code |
|
| 17 | + * |
|
| 18 | + * @var string $ident |
|
| 19 | + */ |
|
| 20 | 20 | private $ident; |
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | - * The language name |
|
| 24 | - * |
|
| 25 | - * @var TranslationString $name; |
|
| 26 | - */ |
|
| 23 | + * The language name |
|
| 24 | + * |
|
| 25 | + * @var TranslationString $name; |
|
| 26 | + */ |
|
| 27 | 27 | private $name; |
| 28 | 28 | |
| 29 | 29 | /** |
| 30 | - * The language locale |
|
| 31 | - * |
|
| 32 | - * @var string $locale; |
|
| 33 | - */ |
|
| 30 | + * The language locale |
|
| 31 | + * |
|
| 32 | + * @var string $locale; |
|
| 33 | + */ |
|
| 34 | 34 | private $locale; |
| 35 | 35 | |
| 36 | 36 | /** |
| 37 | - * @param array $data |
|
| 38 | - * @return self |
|
| 39 | - */ |
|
| 37 | + * @param array $data |
|
| 38 | + * @return self |
|
| 39 | + */ |
|
| 40 | 40 | public function set_data(array $data) |
| 41 | 41 | { |
| 42 | 42 | if (isset($data['ident']) && $data['ident'] !== null) { |
@@ -49,15 +49,15 @@ discard block |
||
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | /** |
| 52 | - * Set the language identifier |
|
| 53 | - * |
|
| 54 | - * A valid ISO 639 code is recommended (either 639-1, 639-2, or 639-3). |
|
| 55 | - * Within a routable application, the identifier is most often used |
|
| 56 | - * as a base URI path. |
|
| 57 | - * |
|
| 58 | - * @param string $ident Language identifier |
|
| 59 | - * @return self |
|
| 60 | - */ |
|
| 52 | + * Set the language identifier |
|
| 53 | + * |
|
| 54 | + * A valid ISO 639 code is recommended (either 639-1, 639-2, or 639-3). |
|
| 55 | + * Within a routable application, the identifier is most often used |
|
| 56 | + * as a base URI path. |
|
| 57 | + * |
|
| 58 | + * @param string $ident Language identifier |
|
| 59 | + * @return self |
|
| 60 | + */ |
|
| 61 | 61 | public function set_ident($ident) |
| 62 | 62 | { |
| 63 | 63 | $this->ident = $ident; |
@@ -65,30 +65,30 @@ discard block |
||
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | /** |
| 68 | - * Get the language identifier |
|
| 69 | - * |
|
| 70 | - * @return string |
|
| 71 | - */ |
|
| 68 | + * Get the language identifier |
|
| 69 | + * |
|
| 70 | + * @return string |
|
| 71 | + */ |
|
| 72 | 72 | public function ident() |
| 73 | 73 | { |
| 74 | 74 | return $this->ident; |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | /** |
| 78 | - * Set the name of the language and, optionally, |
|
| 79 | - * the name translated in other languages. |
|
| 80 | - * |
|
| 81 | - * @param TranslationString|array|string $name { |
|
| 82 | - * The language's name in one or more languages. |
|
| 83 | - * |
|
| 84 | - * Accept 3 types of arguments: |
|
| 85 | - * - object (TranslationStringInterface): The data will be copied from the object's. |
|
| 86 | - * - array: All languages available in the array. The format of the array should |
|
| 87 | - * be a hash in the `lang` => `string` format. |
|
| 88 | - * - string: The value will be assigned to the current language. |
|
| 89 | - * } |
|
| 90 | - * @return self |
|
| 91 | - */ |
|
| 78 | + * Set the name of the language and, optionally, |
|
| 79 | + * the name translated in other languages. |
|
| 80 | + * |
|
| 81 | + * @param TranslationString|array|string $name { |
|
| 82 | + * The language's name in one or more languages. |
|
| 83 | + * |
|
| 84 | + * Accept 3 types of arguments: |
|
| 85 | + * - object (TranslationStringInterface): The data will be copied from the object's. |
|
| 86 | + * - array: All languages available in the array. The format of the array should |
|
| 87 | + * be a hash in the `lang` => `string` format. |
|
| 88 | + * - string: The value will be assigned to the current language. |
|
| 89 | + * } |
|
| 90 | + * @return self |
|
| 91 | + */ |
|
| 92 | 92 | public function set_name($name) |
| 93 | 93 | { |
| 94 | 94 | if ($name instanceof TranslationStringInterface) { |
@@ -103,35 +103,35 @@ discard block |
||
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | /** |
| 106 | - * Get the name of the language |
|
| 107 | - * |
|
| 108 | - * @return TranslationString |
|
| 109 | - */ |
|
| 106 | + * Get the name of the language |
|
| 107 | + * |
|
| 108 | + * @return TranslationString |
|
| 109 | + */ |
|
| 110 | 110 | public function name() |
| 111 | 111 | { |
| 112 | 112 | return $this->name; |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | /** |
| 116 | - * Alias of self::name() |
|
| 117 | - * |
|
| 118 | - * @return string |
|
| 119 | - */ |
|
| 116 | + * Alias of self::name() |
|
| 117 | + * |
|
| 118 | + * @return string |
|
| 119 | + */ |
|
| 120 | 120 | public function __toString() |
| 121 | 121 | { |
| 122 | 122 | return (string)$this->name(); |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | /** |
| 126 | - * Set the language's locale |
|
| 127 | - * |
|
| 128 | - * @link http://www.faqs.org/rfcs/rfc4646.html Tags for Identifying Languages |
|
| 129 | - * @link http://www.faqs.org/rfcs/rfc4647.html Matching of Language Tags |
|
| 130 | - * @param string $ident Language identifier |
|
| 131 | - * @return self |
|
| 132 | - * |
|
| 133 | - * @todo Implement proper ISO 639 sanitization |
|
| 134 | - */ |
|
| 126 | + * Set the language's locale |
|
| 127 | + * |
|
| 128 | + * @link http://www.faqs.org/rfcs/rfc4646.html Tags for Identifying Languages |
|
| 129 | + * @link http://www.faqs.org/rfcs/rfc4647.html Matching of Language Tags |
|
| 130 | + * @param string $ident Language identifier |
|
| 131 | + * @return self |
|
| 132 | + * |
|
| 133 | + * @todo Implement proper ISO 639 sanitization |
|
| 134 | + */ |
|
| 135 | 135 | public function set_locale($locale) |
| 136 | 136 | { |
| 137 | 137 | $this->locale = $locale; |
@@ -139,24 +139,24 @@ discard block |
||
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | /** |
| 142 | - * Get the language's locale |
|
| 143 | - * |
|
| 144 | - * @return string |
|
| 145 | - */ |
|
| 142 | + * Get the language's locale |
|
| 143 | + * |
|
| 144 | + * @return string |
|
| 145 | + */ |
|
| 146 | 146 | public function locale() |
| 147 | 147 | { |
| 148 | 148 | return $this->locale; |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | /** |
| 152 | - * Get the language's ISO 639-1 (alpha-2) code. |
|
| 153 | - * |
|
| 154 | - * @link http://www.iso.org/iso/home/standards/language_codes.htm for specification |
|
| 155 | - * @return string |
|
| 156 | - * |
|
| 157 | - * @todo Implement proper ISO 639 sanitization |
|
| 158 | - * @todo Added support for retrieving codes in 639-1, 639-2/B, 639-2/T, and 639-3 |
|
| 159 | - */ |
|
| 152 | + * Get the language's ISO 639-1 (alpha-2) code. |
|
| 153 | + * |
|
| 154 | + * @link http://www.iso.org/iso/home/standards/language_codes.htm for specification |
|
| 155 | + * @return string |
|
| 156 | + * |
|
| 157 | + * @todo Implement proper ISO 639 sanitization |
|
| 158 | + * @todo Added support for retrieving codes in 639-1, 639-2/B, 639-2/T, and 639-3 |
|
| 159 | + */ |
|
| 160 | 160 | public function iso639() |
| 161 | 161 | { |
| 162 | 162 | return $this->ident(); |
@@ -94,7 +94,7 @@ |
||
| 94 | 94 | if ($name instanceof TranslationStringInterface) { |
| 95 | 95 | $config = $name->available_langs(); |
| 96 | 96 | } elseif (is_array($name)) { |
| 97 | - $config = [ 'languages' => array_keys($name) ]; |
|
| 97 | + $config = ['languages' => array_keys($name)]; |
|
| 98 | 98 | } else { |
| 99 | 99 | $config = null; |
| 100 | 100 | } |
@@ -44,7 +44,6 @@ |
||
| 44 | 44 | /** |
| 45 | 45 | * Set the language's locale |
| 46 | 46 | * |
| 47 | - * @param string $ident |
|
| 48 | 47 | * @return LanguageInterface Chainable |
| 49 | 48 | */ |
| 50 | 49 | public function set_locale($locale); |
@@ -5,61 +5,61 @@ |
||
| 5 | 5 | interface LanguageInterface |
| 6 | 6 | { |
| 7 | 7 | /** |
| 8 | - * @param array $data |
|
| 9 | - * @return LanguageInterface Chainable |
|
| 10 | - */ |
|
| 8 | + * @param array $data |
|
| 9 | + * @return LanguageInterface Chainable |
|
| 10 | + */ |
|
| 11 | 11 | public function set_data(array $data); |
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | - * Set the language identifier |
|
| 15 | - * |
|
| 16 | - * @param string $ident |
|
| 17 | - * @return LanguageInterface Chainable |
|
| 18 | - */ |
|
| 14 | + * Set the language identifier |
|
| 15 | + * |
|
| 16 | + * @param string $ident |
|
| 17 | + * @return LanguageInterface Chainable |
|
| 18 | + */ |
|
| 19 | 19 | public function set_ident($ident); |
| 20 | 20 | |
| 21 | 21 | /** |
| 22 | - * Get the language identifier |
|
| 23 | - * |
|
| 24 | - * @return string |
|
| 25 | - */ |
|
| 22 | + * Get the language identifier |
|
| 23 | + * |
|
| 24 | + * @return string |
|
| 25 | + */ |
|
| 26 | 26 | public function ident(); |
| 27 | 27 | |
| 28 | 28 | /** |
| 29 | - * Set the name of the language and, optionally, |
|
| 30 | - * the name translated in other languages. |
|
| 31 | - * |
|
| 32 | - * @param TranslationString|array|string $name |
|
| 33 | - * @return LanguageInterface Chainable |
|
| 34 | - */ |
|
| 29 | + * Set the name of the language and, optionally, |
|
| 30 | + * the name translated in other languages. |
|
| 31 | + * |
|
| 32 | + * @param TranslationString|array|string $name |
|
| 33 | + * @return LanguageInterface Chainable |
|
| 34 | + */ |
|
| 35 | 35 | public function set_name($name); |
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | - * Get the name of the language |
|
| 39 | - * |
|
| 40 | - * @return string |
|
| 41 | - */ |
|
| 38 | + * Get the name of the language |
|
| 39 | + * |
|
| 40 | + * @return string |
|
| 41 | + */ |
|
| 42 | 42 | public function name(); |
| 43 | 43 | |
| 44 | 44 | /** |
| 45 | - * Set the language's locale |
|
| 46 | - * |
|
| 47 | - * @param string $ident |
|
| 48 | - * @return LanguageInterface Chainable |
|
| 49 | - */ |
|
| 45 | + * Set the language's locale |
|
| 46 | + * |
|
| 47 | + * @param string $ident |
|
| 48 | + * @return LanguageInterface Chainable |
|
| 49 | + */ |
|
| 50 | 50 | public function set_locale($locale); |
| 51 | 51 | |
| 52 | 52 | /** |
| 53 | - * Get the language's locale |
|
| 54 | - * |
|
| 55 | - * @return string |
|
| 56 | - */ |
|
| 53 | + * Get the language's locale |
|
| 54 | + * |
|
| 55 | + * @return string |
|
| 56 | + */ |
|
| 57 | 57 | public function locale(); |
| 58 | 58 | |
| 59 | 59 | /** |
| 60 | - * Get the language's ISO 639 code. |
|
| 61 | - * |
|
| 62 | - * @return string |
|
| 63 | - */ |
|
| 60 | + * Get the language's ISO 639 code. |
|
| 61 | + * |
|
| 62 | + * @return string |
|
| 63 | + */ |
|
| 64 | 64 | public function iso639(); |
| 65 | 65 | } |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | * |
| 146 | 146 | * @param LanguageInterface &$lang The instance that needs resolution |
| 147 | 147 | * @param array $config Array element of fallbacks |
| 148 | - * @param mixed $ident Optional key/index of $config in previous method |
|
| 148 | + * @param string|null $ident Optional key/index of $config in previous method |
|
| 149 | 149 | * @return void |
| 150 | 150 | * @throws InvalidArgumentException |
| 151 | 151 | */ |
@@ -174,7 +174,6 @@ discard block |
||
| 174 | 174 | /** |
| 175 | 175 | * Set the manager's available languages |
| 176 | 176 | * |
| 177 | - * @param LanguageInterface[] $lang |
|
| 178 | 177 | * @return self |
| 179 | 178 | */ |
| 180 | 179 | public function set_languages($languages) |
@@ -18,25 +18,25 @@ discard block |
||
| 18 | 18 | class LanguageManager extends AbstractManager |
| 19 | 19 | { |
| 20 | 20 | /** |
| 21 | - * @var LanguageInterface[] |
|
| 22 | - */ |
|
| 21 | + * @var LanguageInterface[] |
|
| 22 | + */ |
|
| 23 | 23 | private $available_langs; |
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | - * @var TranslationConfig |
|
| 27 | - */ |
|
| 26 | + * @var TranslationConfig |
|
| 27 | + */ |
|
| 28 | 28 | private $translation_config; |
| 29 | 29 | |
| 30 | 30 | /** |
| 31 | - * @var GenericConfig |
|
| 32 | - */ |
|
| 31 | + * @var GenericConfig |
|
| 32 | + */ |
|
| 33 | 33 | private static $language_index; |
| 34 | 34 | |
| 35 | 35 | /** |
| 36 | - * Set up the available languages, defaults, and active |
|
| 37 | - * |
|
| 38 | - * @return void |
|
| 39 | - */ |
|
| 36 | + * Set up the available languages, defaults, and active |
|
| 37 | + * |
|
| 38 | + * @return void |
|
| 39 | + */ |
|
| 40 | 40 | public function setup() |
| 41 | 41 | { |
| 42 | 42 | $this->setup_translations(); |
@@ -44,14 +44,14 @@ discard block |
||
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | /** |
| 47 | - * Set up the available languages, defaults, and active |
|
| 48 | - * |
|
| 49 | - * Settings: |
|
| 50 | - * - languages |
|
| 51 | - * - default_lang |
|
| 52 | - * |
|
| 53 | - * @return void |
|
| 54 | - */ |
|
| 47 | + * Set up the available languages, defaults, and active |
|
| 48 | + * |
|
| 49 | + * Settings: |
|
| 50 | + * - languages |
|
| 51 | + * - default_lang |
|
| 52 | + * |
|
| 53 | + * @return void |
|
| 54 | + */ |
|
| 55 | 55 | public function setup_translations() |
| 56 | 56 | { |
| 57 | 57 | $config = $this->config(); |
@@ -76,10 +76,10 @@ discard block |
||
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | /** |
| 79 | - * Set up the available languages, defaults, and active |
|
| 80 | - * |
|
| 81 | - * @return void |
|
| 82 | - */ |
|
| 79 | + * Set up the available languages, defaults, and active |
|
| 80 | + * |
|
| 81 | + * @return void |
|
| 82 | + */ |
|
| 83 | 83 | public function setup_languages() |
| 84 | 84 | { |
| 85 | 85 | $config = $this->config(); |
@@ -140,13 +140,13 @@ discard block |
||
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | /** |
| 143 | - * Resolve a string identifier for a given Language. |
|
| 144 | - * |
|
| 145 | - * @param LanguageInterface &$lang The instance that needs resolution |
|
| 146 | - * @param mixed $ident Optional key/index of $config in previous method |
|
| 147 | - * @return void |
|
| 148 | - * @throws InvalidArgumentException |
|
| 149 | - */ |
|
| 143 | + * Resolve a string identifier for a given Language. |
|
| 144 | + * |
|
| 145 | + * @param LanguageInterface &$lang The instance that needs resolution |
|
| 146 | + * @param mixed $ident Optional key/index of $config in previous method |
|
| 147 | + * @return void |
|
| 148 | + * @throws InvalidArgumentException |
|
| 149 | + */ |
|
| 150 | 150 | public function resolve_ident(LanguageInterface &$lang, $ident = null) |
| 151 | 151 | { |
| 152 | 152 | if (is_string($ident)) { |
@@ -173,12 +173,12 @@ discard block |
||
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | /** |
| 176 | - * Set the manager's available languages |
|
| 177 | - * |
|
| 178 | - * @param LanguageInterface[] $lang |
|
| 179 | - * @return self |
|
| 180 | - * @throws InvalidArgumentException if array has a member that isn't an instance of Language |
|
| 181 | - */ |
|
| 176 | + * Set the manager's available languages |
|
| 177 | + * |
|
| 178 | + * @param LanguageInterface[] $lang |
|
| 179 | + * @return self |
|
| 180 | + * @throws InvalidArgumentException if array has a member that isn't an instance of Language |
|
| 181 | + */ |
|
| 182 | 182 | public function set_languages($languages) |
| 183 | 183 | { |
| 184 | 184 | $this->languages = []; |
@@ -194,11 +194,11 @@ discard block |
||
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | /** |
| 197 | - * Add or update an available language to the manager |
|
| 198 | - * |
|
| 199 | - * @param LanguageInterface $lang |
|
| 200 | - * @return self |
|
| 201 | - */ |
|
| 197 | + * Add or update an available language to the manager |
|
| 198 | + * |
|
| 199 | + * @param LanguageInterface $lang |
|
| 200 | + * @return self |
|
| 201 | + */ |
|
| 202 | 202 | public function add_language(LanguageInterface $lang) |
| 203 | 203 | { |
| 204 | 204 | $this->languages[$lang->ident()] = $lang; |
@@ -206,21 +206,21 @@ discard block |
||
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | /** |
| 209 | - * Get the manager's list of available languages |
|
| 210 | - * |
|
| 211 | - * @return LanguageInterface[] |
|
| 212 | - */ |
|
| 209 | + * Get the manager's list of available languages |
|
| 210 | + * |
|
| 211 | + * @return LanguageInterface[] |
|
| 212 | + */ |
|
| 213 | 213 | public function languages() |
| 214 | 214 | { |
| 215 | 215 | return $this->languages; |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | /** |
| 219 | - * Set the manager's translations for TranslationConfig |
|
| 220 | - * |
|
| 221 | - * @param array|TranslationConfig $translation |
|
| 222 | - * @return self |
|
| 223 | - */ |
|
| 219 | + * Set the manager's translations for TranslationConfig |
|
| 220 | + * |
|
| 221 | + * @param array|TranslationConfig $translation |
|
| 222 | + * @return self |
|
| 223 | + */ |
|
| 224 | 224 | public function set_translation($translation) |
| 225 | 225 | { |
| 226 | 226 | if ($translation instanceof TranslationConfig) { |
@@ -232,10 +232,10 @@ discard block |
||
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | /** |
| 235 | - * Get the manager's translations |
|
| 236 | - * |
|
| 237 | - * @return TranslationConfig |
|
| 238 | - */ |
|
| 235 | + * Get the manager's translations |
|
| 236 | + * |
|
| 237 | + * @return TranslationConfig |
|
| 238 | + */ |
|
| 239 | 239 | public function translation() |
| 240 | 240 | { |
| 241 | 241 | return $this->translation_config; |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | if (isset($config['languages'])) { |
| 66 | - $available_langs = array_filter($config['languages'], function ($config) { |
|
| 66 | + $available_langs = array_filter($config['languages'], function($config) { |
|
| 67 | 67 | return (!isset($config['active']) || $config['active']); |
| 68 | 68 | }); |
| 69 | 69 | |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | public static function language_index() |
| 134 | 134 | { |
| 135 | 135 | if (!isset(self::$language_index)) { |
| 136 | - self::$language_index = new GenericConfig(__DIR__ . '/../../../../config/languages.json'); |
|
| 136 | + self::$language_index = new GenericConfig(__DIR__.'/../../../../config/languages.json'); |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | return self::$language_index; |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | * @return void |
| 148 | 148 | * @throws InvalidArgumentException |
| 149 | 149 | */ |
| 150 | - public function resolve_ident(LanguageInterface &$lang, $ident = null) |
|
| 150 | + public function resolve_ident(LanguageInterface & $lang, $ident = null) |
|
| 151 | 151 | { |
| 152 | 152 | if (is_string($ident)) { |
| 153 | 153 | $lang->set_ident($ident); |
@@ -12,7 +12,6 @@ discard block |
||
| 12 | 12 | interface RoutableInterface |
| 13 | 13 | { |
| 14 | 14 | /** |
| 15 | - * @param boolean $data |
|
| 16 | 15 | * @return RoutableInterface Chainable |
| 17 | 16 | */ |
| 18 | 17 | public function set_routable($routable); |
@@ -23,7 +22,6 @@ discard block |
||
| 23 | 22 | public function routable(); |
| 24 | 23 | |
| 25 | 24 | /** |
| 26 | - * @param mixed $url |
|
| 27 | 25 | * @return RoutableInterface Chainable |
| 28 | 26 | */ |
| 29 | 27 | public function set_slug_pattern($pattern); |
@@ -12,53 +12,53 @@ |
||
| 12 | 12 | interface RoutableInterface |
| 13 | 13 | { |
| 14 | 14 | /** |
| 15 | - * @param boolean $data |
|
| 16 | - * @return RoutableInterface Chainable |
|
| 17 | - */ |
|
| 15 | + * @param boolean $data |
|
| 16 | + * @return RoutableInterface Chainable |
|
| 17 | + */ |
|
| 18 | 18 | public function set_routable($routable); |
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | - * @return boolean |
|
| 22 | - */ |
|
| 21 | + * @return boolean |
|
| 22 | + */ |
|
| 23 | 23 | public function routable(); |
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | - * @param mixed $url |
|
| 27 | - * @return RoutableInterface Chainable |
|
| 28 | - */ |
|
| 26 | + * @param mixed $url |
|
| 27 | + * @return RoutableInterface Chainable |
|
| 28 | + */ |
|
| 29 | 29 | public function set_slug_pattern($pattern); |
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | - * @return string |
|
| 33 | - */ |
|
| 32 | + * @return string |
|
| 33 | + */ |
|
| 34 | 34 | public function slug_pattern(); |
| 35 | 35 | |
| 36 | 36 | /** |
| 37 | - * @param mixed $slug |
|
| 38 | - * @return RoutableInterface Chainable |
|
| 39 | - */ |
|
| 37 | + * @param mixed $slug |
|
| 38 | + * @return RoutableInterface Chainable |
|
| 39 | + */ |
|
| 40 | 40 | public function set_slug($slug); |
| 41 | 41 | |
| 42 | 42 | /** |
| 43 | - * @return string |
|
| 44 | - */ |
|
| 43 | + * @return string |
|
| 44 | + */ |
|
| 45 | 45 | public function slug(); |
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | - * Generate a URL slug from the object's URL slug pattern. |
|
| 49 | - */ |
|
| 48 | + * Generate a URL slug from the object's URL slug pattern. |
|
| 49 | + */ |
|
| 50 | 50 | public function generate_slug(); |
| 51 | 51 | |
| 52 | 52 | /** |
| 53 | - * @return string |
|
| 54 | - */ |
|
| 53 | + * @return string |
|
| 54 | + */ |
|
| 55 | 55 | public function url(); |
| 56 | 56 | |
| 57 | 57 | /** |
| 58 | - * @param string $path |
|
| 59 | - * @param RequestInterface $request |
|
| 60 | - * @param ResponseInterface $response |
|
| 61 | - * @return callable|null Route callable |
|
| 62 | - */ |
|
| 58 | + * @param string $path |
|
| 59 | + * @param RequestInterface $request |
|
| 60 | + * @param ResponseInterface $response |
|
| 61 | + * @return callable|null Route callable |
|
| 62 | + */ |
|
| 63 | 63 | public function route_handler($path, RequestInterface $request, ResponseInterface $response); |
| 64 | 64 | } |
@@ -32,8 +32,7 @@ discard block |
||
| 32 | 32 | private $slug; |
| 33 | 33 | |
| 34 | 34 | /** |
| 35 | - * @param boolean $data |
|
| 36 | - * @return RoutableInterface Chainable |
|
| 35 | + * @return RoutableTrait Chainable |
|
| 37 | 36 | */ |
| 38 | 37 | public function set_routable($routable) |
| 39 | 38 | { |
@@ -50,8 +49,7 @@ discard block |
||
| 50 | 49 | } |
| 51 | 50 | |
| 52 | 51 | /** |
| 53 | - * @param mixed $url |
|
| 54 | - * @return RoutableInterface Chainable |
|
| 52 | + * @return RoutableTrait Chainable |
|
| 55 | 53 | */ |
| 56 | 54 | public function set_slug_pattern($pattern) |
| 57 | 55 | { |
@@ -69,7 +67,7 @@ discard block |
||
| 69 | 67 | |
| 70 | 68 | /** |
| 71 | 69 | * @param mixed $slug |
| 72 | - * @return RoutableInterface Chainable |
|
| 70 | + * @return RoutableTrait Chainable |
|
| 73 | 71 | */ |
| 74 | 72 | public function set_slug($slug) |
| 75 | 73 | { |
@@ -17,24 +17,24 @@ discard block |
||
| 17 | 17 | trait RoutableTrait |
| 18 | 18 | { |
| 19 | 19 | /** |
| 20 | - * @var boolean routable |
|
| 21 | - */ |
|
| 20 | + * @var boolean routable |
|
| 21 | + */ |
|
| 22 | 22 | private $routable = true; |
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | - * @var string |
|
| 26 | - */ |
|
| 25 | + * @var string |
|
| 26 | + */ |
|
| 27 | 27 | private $slug_pattern = ''; |
| 28 | 28 | |
| 29 | 29 | /** |
| 30 | - * @var string $slug |
|
| 31 | - */ |
|
| 30 | + * @var string $slug |
|
| 31 | + */ |
|
| 32 | 32 | private $slug; |
| 33 | 33 | |
| 34 | 34 | /** |
| 35 | - * @param boolean $data |
|
| 36 | - * @return RoutableInterface Chainable |
|
| 37 | - */ |
|
| 35 | + * @param boolean $data |
|
| 36 | + * @return RoutableInterface Chainable |
|
| 37 | + */ |
|
| 38 | 38 | public function set_routable($routable) |
| 39 | 39 | { |
| 40 | 40 | $this->routable = !!$routable; |
@@ -42,17 +42,17 @@ discard block |
||
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | /** |
| 45 | - * @return boolean |
|
| 46 | - */ |
|
| 45 | + * @return boolean |
|
| 46 | + */ |
|
| 47 | 47 | public function routable() |
| 48 | 48 | { |
| 49 | 49 | return $this->routable; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | /** |
| 53 | - * @param mixed $url |
|
| 54 | - * @return RoutableInterface Chainable |
|
| 55 | - */ |
|
| 53 | + * @param mixed $url |
|
| 54 | + * @return RoutableInterface Chainable |
|
| 55 | + */ |
|
| 56 | 56 | public function set_slug_pattern($pattern) |
| 57 | 57 | { |
| 58 | 58 | $this->slug_pattern = new TranslationString($pattern); |
@@ -60,17 +60,17 @@ discard block |
||
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | /** |
| 63 | - * @return TranslationString |
|
| 64 | - */ |
|
| 63 | + * @return TranslationString |
|
| 64 | + */ |
|
| 65 | 65 | public function slug_pattern() |
| 66 | 66 | { |
| 67 | 67 | return $this->slug_pattern; |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | /** |
| 71 | - * @param mixed $slug |
|
| 72 | - * @return RoutableInterface Chainable |
|
| 73 | - */ |
|
| 71 | + * @param mixed $slug |
|
| 72 | + * @return RoutableInterface Chainable |
|
| 73 | + */ |
|
| 74 | 74 | public function set_slug($slug) |
| 75 | 75 | { |
| 76 | 76 | $this->slug = $slug; |
@@ -78,8 +78,8 @@ discard block |
||
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | /** |
| 81 | - * @return string |
|
| 82 | - */ |
|
| 81 | + * @return string |
|
| 82 | + */ |
|
| 83 | 83 | public function slug() |
| 84 | 84 | { |
| 85 | 85 | if ($this->slug === null) { |
@@ -89,8 +89,8 @@ discard block |
||
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | /** |
| 92 | - * Generate a URL slug from the object's URL slug pattern. |
|
| 93 | - */ |
|
| 92 | + * Generate a URL slug from the object's URL slug pattern. |
|
| 93 | + */ |
|
| 94 | 94 | public function generate_slug() |
| 95 | 95 | { |
| 96 | 96 | $pattern = $this->slug_pattern(); |
@@ -103,20 +103,20 @@ discard block |
||
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | /** |
| 106 | - * @return string |
|
| 107 | - */ |
|
| 106 | + * @return string |
|
| 107 | + */ |
|
| 108 | 108 | public function url() |
| 109 | 109 | { |
| 110 | 110 | return $this->slug(); |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | /** |
| 114 | - * Get the route callback that matches a gien path (or null). |
|
| 115 | - * |
|
| 116 | - * @param string $path |
|
| 117 | - * @param RequestInterface $request |
|
| 118 | - * @param ResponseInterface $response |
|
| 119 | - * @return callable|null Route callable |
|
| 120 | - */ |
|
| 114 | + * Get the route callback that matches a gien path (or null). |
|
| 115 | + * |
|
| 116 | + * @param string $path |
|
| 117 | + * @param RequestInterface $request |
|
| 118 | + * @param ResponseInterface $response |
|
| 119 | + * @return callable|null Route callable |
|
| 120 | + */ |
|
| 121 | 121 | abstract public function route_handler($path, RequestInterface $request, ResponseInterface $response); |
| 122 | 122 | } |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | * Fulfills the PSR-1 style LoggerAwareInterface |
| 69 | 69 | * |
| 70 | 70 | * @param LoggerInterface $logger |
| 71 | - * @return AbstractEngine Chainable |
|
| 71 | + * @return TemplateRoute Chainable |
|
| 72 | 72 | */ |
| 73 | 73 | public function setLogger(LoggerInterface $logger) |
| 74 | 74 | { |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | |
| 78 | 78 | /** |
| 79 | 79 | * @param LoggerInterface $logger |
| 80 | - * @return AbstractEngine Chainable |
|
| 80 | + * @return TemplateRoute Chainable |
|
| 81 | 81 | */ |
| 82 | 82 | public function set_logger(LoggerInterface $logger = null) |
| 83 | 83 | { |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | /** |
| 105 | - * @return void |
|
| 105 | + * @return ResponseInterface |
|
| 106 | 106 | */ |
| 107 | 107 | public function __invoke(RequestInterface $request, ResponseInterface $response) |
| 108 | 108 | { |
@@ -29,23 +29,23 @@ discard block |
||
| 29 | 29 | use ConfigurableTrait; |
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | - * @var \Slim\App $app |
|
| 33 | - */ |
|
| 32 | + * @var \Slim\App $app |
|
| 33 | + */ |
|
| 34 | 34 | private $app; |
| 35 | 35 | |
| 36 | 36 | /** |
| 37 | 37 | * @var LoggerInterface $logger |
| 38 | - */ |
|
| 38 | + */ |
|
| 39 | 39 | private $logger; |
| 40 | 40 | |
| 41 | 41 | /** |
| 42 | - * Dependencies: |
|
| 43 | - * - `config` |
|
| 44 | - * - `app` |
|
| 45 | - * |
|
| 46 | - * @param array $data Dependencies |
|
| 47 | - * @throws InvalidArgumentException |
|
| 48 | - */ |
|
| 42 | + * Dependencies: |
|
| 43 | + * - `config` |
|
| 44 | + * - `app` |
|
| 45 | + * |
|
| 46 | + * @param array $data Dependencies |
|
| 47 | + * @throws InvalidArgumentException |
|
| 48 | + */ |
|
| 49 | 49 | public function __construct(array $data) |
| 50 | 50 | { |
| 51 | 51 | $this->set_config($data['config']); |
@@ -63,22 +63,22 @@ discard block |
||
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | /** |
| 66 | - * > LoggerAwareInterface > setLogger() |
|
| 67 | - * |
|
| 68 | - * Fulfills the PSR-1 style LoggerAwareInterface |
|
| 69 | - * |
|
| 70 | - * @param LoggerInterface $logger |
|
| 71 | - * @return AbstractEngine Chainable |
|
| 72 | - */ |
|
| 66 | + * > LoggerAwareInterface > setLogger() |
|
| 67 | + * |
|
| 68 | + * Fulfills the PSR-1 style LoggerAwareInterface |
|
| 69 | + * |
|
| 70 | + * @param LoggerInterface $logger |
|
| 71 | + * @return AbstractEngine Chainable |
|
| 72 | + */ |
|
| 73 | 73 | public function setLogger(LoggerInterface $logger) |
| 74 | 74 | { |
| 75 | 75 | return $this->set_logger($logger); |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | /** |
| 79 | - * @param LoggerInterface $logger |
|
| 80 | - * @return AbstractEngine Chainable |
|
| 81 | - */ |
|
| 79 | + * @param LoggerInterface $logger |
|
| 80 | + * @return AbstractEngine Chainable |
|
| 81 | + */ |
|
| 82 | 82 | public function set_logger(LoggerInterface $logger = null) |
| 83 | 83 | { |
| 84 | 84 | $this->logger = $logger; |
@@ -86,24 +86,24 @@ discard block |
||
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | /** |
| 89 | - * @erturn LoggerInterface |
|
| 90 | - */ |
|
| 89 | + * @erturn LoggerInterface |
|
| 90 | + */ |
|
| 91 | 91 | public function logger() |
| 92 | 92 | { |
| 93 | 93 | return $this->logger; |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | /** |
| 97 | - * ConfigurableTrait > create_config() |
|
| 98 | - */ |
|
| 97 | + * ConfigurableTrait > create_config() |
|
| 98 | + */ |
|
| 99 | 99 | public function create_config($data = null) |
| 100 | 100 | { |
| 101 | 101 | return new TemplateRouteConfig($data); |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | /** |
| 105 | - * @return void |
|
| 106 | - */ |
|
| 105 | + * @return void |
|
| 106 | + */ |
|
| 107 | 107 | public function __invoke(RequestInterface $request, ResponseInterface $response) |
| 108 | 108 | { |
| 109 | 109 | unset($request); |
@@ -10,8 +10,7 @@ |
||
| 10 | 10 | /** |
| 11 | 11 | * Getter for creating/returning the unique instance of this class |
| 12 | 12 | * |
| 13 | - * @param mixed $param,... |
|
| 14 | - * @return object |
|
| 13 | + * @return SingletonTrait |
|
| 15 | 14 | */ |
| 16 | 15 | public static function instance(); |
| 17 | 16 | } |
@@ -51,7 +51,6 @@ |
||
| 51 | 51 | /** |
| 52 | 52 | * Getter for creating/returning the unique instance of this class |
| 53 | 53 | * |
| 54 | - * @param mixed $param,... |
|
| 55 | 54 | * @return self |
| 56 | 55 | */ |
| 57 | 56 | public static function instance() |