generated from yii-tools/template
/
A.php
52 lines (48 loc) · 1.95 KB
/
A.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
declare(strict_types=1);
namespace Forge\Html\Tag\Element;
use Forge\Html\Attribute\Attributes;
use Forge\Html\Tag\Tag;
/**
* The <a> HTML element (or anchor element), with its href attribute, creates a hyperlink to web pages, files, email
* addresses, locations in the same page, or anything else a URL can address.
*
* @link https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-a-element
*/
final class A
{
/**
* The created <a> HTML element.
*
* @param array $attributes The tag attributes in terms of name-value pairs. These will be rendered as the
* attributes of the resulting tag. The values will be HTML-encoded using {@see Attributes::encode()}.
* See {@see Attributes::render()} for details on how attributes are being rendered.
* @param string $content The content of the tag.
*
* @return string The generated li tag.
*
* @psalm-param array{
* download: bool,
* href: string,
* hreflang: string,
* ping: string,
* referrerpolicy: string,
* rel: string,
* target: string,
* type: string,
* }|array $attributes
*
* @link https://html.spec.whatwg.org/multipage/links.html#attr-hyperlink-download
* @link https://www.w3.org/TR/html52/links.html#element-attrdef-a-href
* @link https://html.spec.whatwg.org/multipage/links.html#attr-hyperlink-hreflang
* @link https://html.spec.whatwg.org/multipage/links.html#ping
* @link https://html.spec.whatwg.org/multipage/links.html#attr-hyperlink-referrerpolicy
* @link https://www.w3.org/TR/html52/links.html#element-attrdef-a-rel
* @link https://html.spec.whatwg.org/multipage/links.html#attr-hyperlink-target
* @link https://html.spec.whatwg.org/multipage/links.html#attr-hyperlink-type
*/
public function create(array $attributes = [], string $content = ''): string
{
return (new Tag())->create('a', $content, $attributes);
}
}