| @@ -2,9 +2,9 @@ | ||
| 2 | 2 | |
| 3 | 3 | /* |
| 4 | 4 | * This file is part of Mustache.php. |
| 5 | 5 | * |
| 6 | - * (c) 2012 Justin Hileman | |
| 6 | + * (c) 2010-2017 Justin Hileman | |
| 7 | 7 | * |
| 8 | 8 | * For the full copyright and license information, please view the LICENSE |
| 9 | 9 | * file that was distributed with this source code. |
| 10 | 10 | */ |
| @@ -26,17 +26,19 @@ | ||
| 26 | 26 | * @param array|Traversable $helpers (default: null) |
| 27 | 27 | */ |
| 28 | 28 | public function __construct($helpers = null) |
| 29 | 29 | { |
| 30 | - if ($helpers !== null) { | |
| 31 | - if (!is_array($helpers) && !$helpers instanceof Traversable) { | |
| 32 | - throw new Mustache_Exception_InvalidArgumentException('HelperCollection constructor expects an array of helpers'); | |
| 33 | - } | |
| 30 | + if ($helpers === null) { | |
| 31 | + return; | |
| 32 | + } | |
| 34 | 33 | |
| 35 | - foreach ($helpers as $name => $helper) { | |
| 36 | - $this->add($name, $helper); | |
| 37 | - } | |
| 34 | + if (!is_array($helpers) && !$helpers instanceof Traversable) { | |
| 35 | + throw new Mustache_Exception_InvalidArgumentException('HelperCollection constructor expects an array of helpers'); | |
| 38 | 36 | } |
| 37 | + | |
| 38 | + foreach ($helpers as $name => $helper) { | |
| 39 | + $this->add($name, $helper); | |
| 40 | + } | |
| 39 | 41 | } |
| 40 | 42 | |
| 41 | 43 | /** |
| 42 | 44 | * Magic mutator. |
| @@ -78,9 +80,9 @@ | ||
| 78 | 80 | |
| 79 | 81 | /** |
| 80 | 82 | * Get a helper by name. |
| 81 | 83 | * |
| 82 | - * @throws Mustache_Exception_UnknownHelperException If helper does not exist. | |
| 84 | + * @throws Mustache_Exception_UnknownHelperException If helper does not exist | |
| 83 | 85 | * |
| 84 | 86 | * @param string $name |
| 85 | 87 | * |
| 86 | 88 | * @return mixed Helper |
| @@ -100,9 +102,9 @@ | ||
| 100 | 102 | * @see Mustache_HelperCollection::has |
| 101 | 103 | * |
| 102 | 104 | * @param string $name |
| 103 | 105 | * |
| 104 | - * @return boolean True if helper is present | |
| 106 | + * @return bool True if helper is present | |
| 105 | 107 | */ |
| 106 | 108 | public function __isset($name) |
| 107 | 109 | { |
| 108 | 110 | return $this->has($name); |
| @@ -112,9 +114,9 @@ | ||
| 112 | 114 | * Check whether a given helper is present in the collection. |
| 113 | 115 | * |
| 114 | 116 | * @param string $name |
| 115 | 117 | * |
| 116 | - * @return boolean True if helper is present | |
| 118 | + * @return bool True if helper is present | |
| 117 | 119 | */ |
| 118 | 120 | public function has($name) |
| 119 | 121 | { |
| 120 | 122 | return array_key_exists($name, $this->helpers); |
| @@ -134,9 +136,9 @@ | ||
| 134 | 136 | |
| 135 | 137 | /** |
| 136 | 138 | * Check whether a given helper is present in the collection. |
| 137 | 139 | * |
| 138 | - * @throws Mustache_Exception_UnknownHelperException if the requested helper is not present. | |
| 140 | + * @throws Mustache_Exception_UnknownHelperException if the requested helper is not present | |
| 139 | 141 | * |
| 140 | 142 | * @param string $name |
| 141 | 143 | */ |
| 142 | 144 | public function remove($name) |
| @@ -160,9 +162,9 @@ | ||
| 160 | 162 | |
| 161 | 163 | /** |
| 162 | 164 | * Check whether the helper collection is empty. |
| 163 | 165 | * |
| 164 | - * @return boolean True if the collection is empty | |
| 166 | + * @return bool True if the collection is empty | |
| 165 | 167 | */ |
| 166 | 168 | public function isEmpty() |
| 167 | 169 | { |
| 168 | 170 | return empty($this->helpers); |