@@ -2,12 +2,12 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Spatie\Html; |
| 4 | 4 | |
| 5 | +use Illuminate\Contracts\Support\Htmlable; |
|
| 5 | 6 | use Illuminate\Support\Collection; |
| 6 | 7 | use Illuminate\Support\HtmlString; |
| 7 | -use Spatie\Html\Exceptions\MissingTag; |
|
| 8 | -use Spatie\Html\Exceptions\InvalidHtml; |
|
| 9 | 8 | use Spatie\Html\Exceptions\InvalidChild; |
| 10 | -use Illuminate\Contracts\Support\Htmlable; |
|
| 9 | +use Spatie\Html\Exceptions\InvalidHtml; |
|
| 10 | +use Spatie\Html\Exceptions\MissingTag; |
|
| 11 | 11 | |
| 12 | 12 | abstract class BaseElement implements Htmlable, HtmlElement |
| 13 | 13 | { |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | /** |
| 174 | 174 | * Alias for `addChildren`. |
| 175 | 175 | * |
| 176 | - * @param \Spatie\Html\HtmlElement|string|iterable|null $children |
|
| 176 | + * @param Elements\Input $child |
|
| 177 | 177 | * @param callable|null $mapper |
| 178 | 178 | * |
| 179 | 179 | * @return static |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | /** |
| 187 | 187 | * Alias for `addChildren`. |
| 188 | 188 | * |
| 189 | - * @param \Spatie\Html\HtmlElement|string|iterable|null $children |
|
| 189 | + * @param \Spatie\Html\HtmlElement|string|iterable|null $child |
|
| 190 | 190 | * @param callable|null $mapper |
| 191 | 191 | * |
| 192 | 192 | * @return static |
@@ -358,6 +358,9 @@ discard block |
||
| 358 | 358 | return $this->render(); |
| 359 | 359 | } |
| 360 | 360 | |
| 361 | + /** |
|
| 362 | + * @param callable $mapper |
|
| 363 | + */ |
|
| 361 | 364 | protected function parseChildren($children, $mapper = null): Collection |
| 362 | 365 | { |
| 363 | 366 | if ($children instanceof HtmlElement) { |
@@ -9,7 +9,6 @@ |
||
| 9 | 9 | protected $tag = 'fieldset'; |
| 10 | 10 | |
| 11 | 11 | /** |
| 12 | - * @param \Spatie\Html\HtmlElement|string $text |
|
| 13 | 12 | * |
| 14 | 13 | * @return static |
| 15 | 14 | */ |
@@ -2,8 +2,8 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Spatie\Html\Elements; |
| 4 | 4 | |
| 5 | -use Spatie\Html\BaseElement; |
|
| 6 | 5 | use Illuminate\Support\Traits\Macroable; |
| 6 | +use Spatie\Html\BaseElement; |
|
| 7 | 7 | |
| 8 | 8 | class Fieldset extends BaseElement |
| 9 | 9 | { |
@@ -2,11 +2,11 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Spatie\Html\Elements; |
| 4 | 4 | |
| 5 | -use Illuminate\Support\Str; |
|
| 6 | -use Spatie\Html\Selectable; |
|
| 7 | -use Spatie\Html\BaseElement; |
|
| 8 | 5 | use Illuminate\Support\Collection; |
| 6 | +use Illuminate\Support\Str; |
|
| 9 | 7 | use Illuminate\Support\Traits\Macroable; |
| 8 | +use Spatie\Html\BaseElement; |
|
| 9 | +use Spatie\Html\Selectable; |
|
| 10 | 10 | |
| 11 | 11 | class Select extends BaseElement |
| 12 | 12 | { |
@@ -137,6 +137,9 @@ |
||
| 137 | 137 | $this->children = $this->applyValueToElements($value, $this->children); |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | + /** |
|
| 141 | + * @param Collection $value |
|
| 142 | + */ |
|
| 140 | 143 | protected function applyValueToElements($value, Collection $children) |
| 141 | 144 | { |
| 142 | 145 | return $children->map(function ($child) use ($value) { |
@@ -2,8 +2,8 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Spatie\Html\Elements; |
| 4 | 4 | |
| 5 | -use Spatie\Html\BaseElement; |
|
| 6 | 5 | use Illuminate\Support\Traits\Macroable; |
| 6 | +use Spatie\Html\BaseElement; |
|
| 7 | 7 | |
| 8 | 8 | class File extends BaseElement |
| 9 | 9 | { |
@@ -49,7 +49,6 @@ |
||
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | /** |
| 52 | - * @param string|null $name |
|
| 53 | 52 | * |
| 54 | 53 | * @return static |
| 55 | 54 | */ |
@@ -2,25 +2,25 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Spatie\Html; |
| 4 | 4 | |
| 5 | -use Spatie\Html\Elements\A; |
|
| 5 | +use Illuminate\Contracts\Support\Htmlable; |
|
| 6 | 6 | use Illuminate\Http\Request; |
| 7 | +use Illuminate\Support\Collection; |
|
| 8 | +use Illuminate\Support\HtmlString; |
|
| 9 | +use Illuminate\Support\Traits\Macroable; |
|
| 10 | +use Spatie\Html\Elements\A; |
|
| 11 | +use Spatie\Html\Elements\Button; |
|
| 7 | 12 | use Spatie\Html\Elements\Div; |
| 13 | +use Spatie\Html\Elements\Element; |
|
| 14 | +use Spatie\Html\Elements\Fieldset; |
|
| 8 | 15 | use Spatie\Html\Elements\File; |
| 9 | 16 | use Spatie\Html\Elements\Form; |
| 10 | -use Spatie\Html\Elements\Span; |
|
| 11 | 17 | use Spatie\Html\Elements\Input; |
| 12 | 18 | use Spatie\Html\Elements\Label; |
| 13 | -use Spatie\Html\Elements\Button; |
|
| 14 | 19 | use Spatie\Html\Elements\Legend; |
| 15 | 20 | use Spatie\Html\Elements\Option; |
| 16 | 21 | use Spatie\Html\Elements\Select; |
| 17 | -use Spatie\Html\Elements\Element; |
|
| 18 | -use Illuminate\Support\Collection; |
|
| 19 | -use Illuminate\Support\HtmlString; |
|
| 20 | -use Spatie\Html\Elements\Fieldset; |
|
| 22 | +use Spatie\Html\Elements\Span; |
|
| 21 | 23 | use Spatie\Html\Elements\Textarea; |
| 22 | -use Illuminate\Support\Traits\Macroable; |
|
| 23 | -use Illuminate\Contracts\Support\Htmlable; |
|
| 24 | 24 | |
| 25 | 25 | class Html |
| 26 | 26 | { |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | /** |
| 41 | 41 | * @param string|null $href |
| 42 | - * @param string|null $text |
|
| 42 | + * @param string $contents |
|
| 43 | 43 | * |
| 44 | 44 | * @return \Spatie\Html\Elements\A |
| 45 | 45 | */ |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | /** |
| 54 | 54 | * @param string|null $type |
| 55 | - * @param string|null $text |
|
| 55 | + * @param string $contents |
|
| 56 | 56 | * |
| 57 | 57 | * @return \Spatie\Html\Elements\Button |
| 58 | 58 | */ |
@@ -259,7 +259,6 @@ discard block |
||
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | /** |
| 262 | - * @param string|null $value |
|
| 263 | 262 | * |
| 264 | 263 | * @return \Spatie\Html\Elements\Input |
| 265 | 264 | */ |
@@ -433,7 +432,7 @@ discard block |
||
| 433 | 432 | * @param string $name |
| 434 | 433 | * @param mixed $value |
| 435 | 434 | * |
| 436 | - * @return mixed |
|
| 435 | + * @return string|null |
|
| 437 | 436 | */ |
| 438 | 437 | protected function old($name, $value = null) |
| 439 | 438 | { |
@@ -2,8 +2,8 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Spatie\Html\Elements; |
| 4 | 4 | |
| 5 | -use Spatie\Html\BaseElement; |
|
| 6 | 5 | use Illuminate\Support\Traits\Macroable; |
| 6 | +use Spatie\Html\BaseElement; |
|
| 7 | 7 | |
| 8 | 8 | class Optgroup extends BaseElement |
| 9 | 9 | { |
@@ -12,8 +12,8 @@ |
||
| 12 | 12 | protected $tag = 'optgroup'; |
| 13 | 13 | |
| 14 | 14 | /** |
| 15 | - * @param string|null $href |
|
| 16 | 15 | * |
| 16 | + * @param string $label |
|
| 17 | 17 | * @return static |
| 18 | 18 | */ |
| 19 | 19 | public function label($label) |