File tree Expand file tree Collapse file tree 2 files changed +7
-8
lines changed Expand file tree Collapse file tree 2 files changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -31,27 +31,26 @@ public function __construct()
3131 /**
3232 * @return self
3333 */
34- public function add ()
34+ public function add (... $ items )
3535 {
36- foreach (func_get_args () as $ num => $ item ) {
36+ foreach ($ items as $ item ) {
3737 if ($ item instanceof IControl) {
3838 $ this ->controls ->attach ($ item );
3939
4040 } elseif ($ item instanceof \Traversable || is_array ($ item )) {
41- foreach ($ item as $ control ) {
42- $ this ->controls ->attach ($ control );
43- }
41+ $ this ->add (...$ item );
4442
4543 } else {
46- throw new Nette \InvalidArgumentException ("Only IFormControl items are allowed, the # $ num parameter is invalid. " );
44+ $ type = is_object ($ item ) ? get_class ($ item ) : gettype ($ item );
45+ throw new Nette \InvalidArgumentException ("IControl items expected, $ type given. " );
4746 }
4847 }
4948 return $ this ;
5049 }
5150
5251
5352 /**
54- * @return array IFormControl
53+ * @return IControl[]
5554 */
5655 public function getControls ()
5756 {
Original file line number Diff line number Diff line change @@ -134,7 +134,7 @@ public function getHtmlName()
134134 }
135135
136136
137- /********************* interface IFormControl ****************d*g**/
137+ /********************* interface IControl ****************d*g**/
138138
139139
140140 /**
You can’t perform that action at this time.
0 commit comments