| @@ -1,5 +1,18 @@ | ||
| 1 | 1 | <?php |
| 2 | +/** | |
| 3 | + * MultipleFormElement.php | |
| 4 | + * | |
| 5 | + * The MultipleFormElement class file. | |
| 6 | + * | |
| 7 | + * PHP versions 5 | |
| 8 | + * | |
| 9 | + * @author Alexander Schneider <alexanderschneider85@gmail.com> | |
| 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 | + */ | |
| 2 | 15 | |
| 3 | 16 | declare(strict_types=1); |
| 4 | 17 | |
| 5 | 18 | namespace UserAccessManager\Form; |
| @@ -5,21 +18,31 @@ | ||
| 5 | 18 | namespace UserAccessManager\Form; |
| 6 | 19 | |
| 7 | 20 | use Exception; |
| 8 | 21 | |
| 22 | +/** | |
| 23 | + * Class MultipleFormElement | |
| 24 | + * | |
| 25 | + * @package UserAccessManager\Form | |
| 26 | + */ | |
| 9 | 27 | abstract class MultipleFormElement extends ValueSetFormElement |
| 10 | 28 | { |
| 11 | 29 | /** |
| 30 | + * @var MultipleFormElementValue[] | |
| 31 | + */ | |
| 32 | + protected $possibleValues; | |
| 33 | + | |
| 34 | + /** | |
| 35 | + * MultipleFormElement constructor. | |
| 36 | + * @param string $id | |
| 12 | 37 | * @param MultipleFormElementValue[] $possibleValues |
| 38 | + * @param mixed|null $value | |
| 39 | + * @param string|null $label | |
| 40 | + * @param string|null $description | |
| 13 | 41 | * @throws Exception |
| 14 | 42 | */ |
| 15 | - public function __construct( | |
| 16 | - string $id, | |
| 17 | - array $possibleValues, | |
| 18 | - mixed $value = null, | |
| 19 | - ?string $label = null, | |
| 20 | - ?string $description = null | |
| 21 | - ) { | |
| 43 | + public function __construct(string $id, array $possibleValues, $value = null, $label = null, $description = null) | |
| 44 | + { | |
| 22 | 45 | foreach ($possibleValues as $possibleValue) { |
| 23 | 46 | if (($possibleValue instanceof MultipleFormElementValue) === false) { |
| 24 | 47 | throw new Exception('Values must be MultipleFormElementValue objects'); |
| 25 | 48 | } |