-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWebLink.php
48 lines (40 loc) · 1009 Bytes
/
WebLink.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
<?php
namespace Xanweb\C5\WebLink;
use Fig\Link\LinkProviderTrait;
use Psr\Link\LinkProviderInterface;
use Psr\Link\LinkInterface;
class WebLink implements LinkProviderInterface
{
use LinkProviderTrait;
/**
* Push link onto the queue for the middleware.
*
* @param LinkInterface $link a link object that should be included in this collection
*
* @return static
*/
public function queueLink(LinkInterface $link): self
{
$this->links[\spl_object_id($link)] = $link;
return $this;
}
/**
* Remove link from the queue.
*
* @param LinkInterface $link a link object that should be included in this collection
*
* @return static
*/
public function dequeueLink(LinkInterface $link): self
{
unset($this->links[\spl_object_id($link)]);
return $this;
}
/**
* Clear all links out of the queue.
*/
public function clear(): void
{
$this->links = [];
}
}