| 1 |
<?php |
| 2 |
namespace Depicter\Html; |
| 3 |
|
| 4 |
use TypeRocket\Html\Html as TypeRocketHtml; |
| 5 |
|
| 6 |
class Html extends TypeRocketHtml |
| 7 |
{ |
| 8 |
|
| 9 |
/** |
| 10 |
* Create new Tag |
| 11 |
* |
| 12 |
* @param string $tag |
| 13 |
* @param array|string|null $attributes |
| 14 |
* @param string|array|null $text |
| 15 |
* |
| 16 |
* @return TypeRocketHtml |
| 17 |
*/ |
| 18 |
protected function el($tag, $attributes = null, $text = null ) |
| 19 |
{ |
| 20 |
$this->tag = new Tag( $tag, $attributes, $text ); |
| 21 |
|
| 22 |
return $this; |
| 23 |
} |
| 24 |
|
| 25 |
/** |
| 26 |
* Create new link |
| 27 |
* |
| 28 |
* @param string|array $text |
| 29 |
* @param string $url |
| 30 |
* @param array $attributes |
| 31 |
* |
| 32 |
* @return TypeRocketHtml |
| 33 |
*/ |
| 34 |
protected function a($text = '', $url = '#', array $attributes = []) |
| 35 |
{ |
| 36 |
$attributes = array_merge( array_filter(['href' => $url], '\TypeRocket\Utility\Str::notBlank'), $attributes ); |
| 37 |
$this->tag = new Tag( 'a', $attributes, $text ); |
| 38 |
|
| 39 |
return $this; |
| 40 |
} |
| 41 |
|
| 42 |
/** |
| 43 |
* Create new image |
| 44 |
* |
| 45 |
* @param string $src |
| 46 |
* @param array $attributes |
| 47 |
* |
| 48 |
* @return $this |
| 49 |
*/ |
| 50 |
protected function img($src = '', array $attributes = []) |
| 51 |
{ |
| 52 |
$attributes = array_merge( ['src' => $src], $attributes ); |
| 53 |
$this->tag = new Tag( 'img', $attributes ); |
| 54 |
|
| 55 |
return $this; |
| 56 |
} |
| 57 |
} |
| 58 |
|