|
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- <?php
-
-
- namespace yii\web;
-
- use yii\base\Object;
-
-
- class Link extends Object
- {
-
-
- const REL_SELF = 'self';
-
-
-
- public $href;
-
-
- public $name;
-
-
- public $type;
-
-
- public $templated = false;
-
-
- public $profile;
-
-
- public $title;
-
-
- public $hreflang;
-
-
-
-
- public static function serialize(array $links)
- {
- foreach ($links as $rel => $link) {
- if (is_array($link)) {
- foreach ($link as $i => $l) {
- $link[$i] = $l instanceof self ? array_filter((array) $l) : ['href' => $l];
- }
- $links[$rel] = $link;
- } elseif (!$link instanceof self) {
- $links[$rel] = ['href' => $link];
- }
- }
-
- return $links;
- }
- }
|