@@ 72-83 (lines=12) @@ | ||
69 | * |
|
70 | * @throws DuplicateException if another link is already using that $key but is not an array |
|
71 | */ |
|
72 | public function append($key, $href, array $meta=[]) { |
|
73 | Validator::checkMemberName($key); |
|
74 | ||
75 | if (isset($this->links[$key]) === false) { |
|
76 | $this->addLinksArray($key, new LinksArray()); |
|
77 | } |
|
78 | elseif ($this->links[$key] instanceof LinksArray === false) { |
|
79 | throw new DuplicateException('can not add to key "'.$key.'", it is not an array of links'); |
|
80 | } |
|
81 | ||
82 | $this->links[$key]->add($href, $meta); |
|
83 | } |
|
84 | ||
85 | /** |
|
86 | * spec api |
|
@@ 143-154 (lines=12) @@ | ||
140 | * |
|
141 | * @throws DuplicateException if another link is already using that $key but is not an array |
|
142 | */ |
|
143 | public function appendLinkObject($key, LinkObject $linkObject) { |
|
144 | Validator::checkMemberName($key); |
|
145 | ||
146 | if (isset($this->links[$key]) === false) { |
|
147 | $this->addLinksArray($key, new LinksArray()); |
|
148 | } |
|
149 | elseif ($this->links[$key] instanceof LinksArray === false) { |
|
150 | throw new DuplicateException('can not add to key "'.$key.'", it is not an array of links'); |
|
151 | } |
|
152 | ||
153 | $this->links[$key]->addLinkObject($linkObject); |
|
154 | } |
|
155 | ||
156 | /** |
|
157 | * ObjectInterface |