PluginProbe
User Access Manager / 2.2.25
User Access Manager v2.2.25
2.3.20 2.3.19 2.3.18 2.3.17 2.3.16 2.3.15 2.3.14 2.3.13 trunk 0.6 0.6.1 0.6.2 0.7 0.7 Beta 0.7.0.1 0.8 0.8.0.1 0.8.0.2 0.9 0.9.1 0.9.1.1 0.9.1.2 0.9.1.3 0.9.1.4 1.0 All 136 releases
← All changes | src/Form/FormFactory.php +78 -20 2.3.172.2.25 View file →
@@ -1,5 +1,18 @@
1 1 <?php
2 +/**
3 + * FormFactory.php
4 + *
5 + * The FormFactory 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,62 +18,107 @@
5 18 namespace UserAccessManager\Form;
6 19
7 20 use Exception;
8 21
22 +/**
23 + * Class FormFactory
24 + *
25 + * @package UserAccessManager\Form
26 + */
9 27 class FormFactory
10 28 {
29 + /**
30 + * Creates a form object.
31 + * @return Form
32 + */
11 33 public function createFrom(): Form
12 34 {
13 35 return new Form();
14 36 }
15 37
16 - public function createValueSetFromElementValue(mixed $value, string $label): ValueSetFormElementValue
38 + /**
39 + * Creates a ValueSetFormElementValue object.
40 + * @param mixed $value
41 + * @param string $label
42 + * @return ValueSetFormElementValue
43 + */
44 + public function createValueSetFromElementValue($value, string $label): ValueSetFormElementValue
17 45 {
18 46 return new ValueSetFormElementValue($value, $label);
19 47 }
20 48
21 - public function createMultipleFormElementValue(mixed $value, string $label): MultipleFormElementValue
49 + /**
50 + * Creates a MultipleFormElementValue object.
51 + * @param mixed $value
52 + * @param string $label
53 + * @return MultipleFormElementValue
54 + */
55 + public function createMultipleFormElementValue($value, string $label): MultipleFormElementValue
22 56 {
23 57 return new MultipleFormElementValue($value, $label);
24 58 }
25 59
26 - public function createInput(
27 - string $id,
28 - mixed $value = null,
29 - ?string $label = null,
30 - ?string $description = null
31 - ): Input {
60 + /**
61 + * Creates a Input object.
62 + * @param string $id
63 + * @param null|mixed $value
64 + * @param null|string $label
65 + * @param null|string $description
66 + * @return Input
67 + */
68 + public function createInput(string $id, $value = null, $label = null, $description = null): Input
69 + {
32 70 return new Input($id, $value, $label, $description);
33 71 }
34 72
35 - public function createTextarea(
36 - string $id,
37 - mixed $value = null,
38 - ?string $label = null,
39 - ?string $description = null
40 - ): Textarea {
73 + /**
74 + * Creates a Textarea object.
75 + * @param string $id
76 + * @param null|mixed $value
77 + * @param null|string $label
78 + * @param null|string $description
79 + * @return Textarea
80 + */
81 + public function createTextarea(string $id, $value = null, $label = null, $description = null): Textarea
82 + {
41 83 return new Textarea($id, $value, $label, $description);
42 84 }
43 85
86 + /**
87 + * Creates a Select object.
88 + * @param string $id
89 + * @param ValueSetFormElementValue[] $possibleValues
90 + * @param null|mixed $value
91 + * @param null|string $label
92 + * @param null|string $description
93 + * @return Select
94 + */
44 95 public function createSelect(
45 96 string $id,
46 97 array $possibleValues,
47 - mixed $value = null,
48 - ?string $label = null,
49 - ?string $description = null
98 + $value = null,
99 + $label = null,
100 + $description = null
50 101 ): Select {
51 102 return new Select($id, $possibleValues, $value, $label, $description);
52 103 }
53 104
54 105 /**
106 + * Creates a Radio object.
107 + * @param string $id
108 + * @param MultipleFormElementValue[] $possibleValues
109 + * @param null|mixed $value
110 + * @param null|string $label
111 + * @param null|string $description
112 + * @return Radio
55 113 * @throws Exception
56 114 */
57 115 public function createRadio(
58 116 string $id,
59 117 array $possibleValues,
60 - mixed $value = null,
61 - ?string $label = null,
62 - ?string $description = null
118 + $value = null,
119 + $label = null,
120 + $description = null
63 121 ): Radio {
64 122 return new Radio($id, $possibleValues, $value, $label, $description);
65 123 }
66 124 }