| @@ -1,28 +1,48 @@ | ||
| 1 | 1 | <?php |
| 2 | - | |
| 3 | -declare(strict_types=1); | |
| 4 | - | |
| 2 | +/** | |
| 3 | + * MultipleFormElement.php | |
| 4 | + * | |
| 5 | + * The MultipleFormElement class file. | |
| 6 | + * | |
| 7 | + * PHP versions 5 | |
| 8 | + * | |
| 9 | + * @author Alexander Schneider <[email protected]> | |
| 10 | + * @copyright 2008-2017 Alexander Schneider | |
| 11 | + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 | |
| 12 | + * @version SVN: $id$ | |
| 13 | + * @link http://wordpress.org/extend/plugins/user-access-manager/ | |
| 14 | + */ | |
| 5 | 15 | namespace UserAccessManager\Form; |
| 6 | 16 | |
| 7 | -use Exception; | |
| 8 | - | |
| 17 | +/** | |
| 18 | + * Class MultipleFormElement | |
| 19 | + * | |
| 20 | + * @package UserAccessManager\Form | |
| 21 | + */ | |
| 9 | 22 | abstract class MultipleFormElement extends ValueSetFormElement |
| 10 | 23 | { |
| 11 | 24 | /** |
| 25 | + * @var MultipleFormElementValue[] | |
| 26 | + */ | |
| 27 | + protected $possibleValues; | |
| 28 | + | |
| 29 | + /** | |
| 30 | + * MultipleFormElement constructor. | |
| 31 | + * | |
| 32 | + * @param string $id | |
| 12 | 33 | * @param MultipleFormElementValue[] $possibleValues |
| 13 | - * @throws Exception | |
| 34 | + * @param mixed|null $value | |
| 35 | + * @param string|null $label | |
| 36 | + * @param string|null $description | |
| 37 | + * | |
| 38 | + * @throws \Exception | |
| 14 | 39 | */ |
| 15 | - public function __construct( | |
| 16 | - string $id, | |
| 17 | - array $possibleValues, | |
| 18 | - mixed $value = null, | |
| 19 | - ?string $label = null, | |
| 20 | - ?string $description = null | |
| 21 | - ) { | |
| 40 | + public function __construct($id, array $possibleValues, $value = null, $label = null, $description = null) | |
| 41 | + { | |
| 22 | 42 | foreach ($possibleValues as $possibleValue) { |
| 23 | 43 | if (($possibleValue instanceof MultipleFormElementValue) === false) { |
| 24 | - throw new Exception('Values must be MultipleFormElementValue objects'); | |
| 44 | + throw new \Exception('Values must be MultipleFormElementValue objects'); | |
| 25 | 45 | } |
| 26 | 46 | } |
| 27 | 47 | |
| 28 | 48 | parent::__construct($id, $possibleValues, $value, $label, $description); |
| @@ -30,9 +50,9 @@ | ||
| 30 | 50 | |
| 31 | 51 | /** |
| 32 | 52 | * @return MultipleFormElementValue[] |
| 33 | 53 | */ |
| 34 | - public function getPossibleValues(): array | |
| 54 | + public function getPossibleValues() | |
| 35 | 55 | { |
| 36 | 56 | return $this->possibleValues; |
| 37 | 57 | } |
| 38 | 58 | } |