src/main/php/routing/api/Links.php
public function add(string $rel, HttpUri $uri): Link
    {
        $link = new Link($rel, $uri);
        if (isset($this->links[$rel])) {
            if (!is_array($this->links[$rel])) {
                $this->links[$rel] = [$this->links[$rel]];
            }

            $this->links[$rel][] = $link;
        } else {
            $this->links[$rel] = $link;
        }

        return $link;
    }
public function add(string $rel, HttpUri $uri): Link
    {
        $link = new Link($rel, $uri);
        if (isset($this->links[$rel])) {
            if (!is_array($this->links[$rel])) {
                $this->links[$rel] = [$this->links[$rel]];
            }

            $this->links[$rel][] = $link;
        } else {
            $this->links[$rel] = $link;
        }

        return $link;
    }
public function add ( string $ rel , HttpUri $ uri ) : Link { $ link = new Link ( $ rel , $ uri ) ; if ( isset ( $ this -> links [ $ rel ] ) ) { if ( ! is_array ( $ this -> links [ $ rel ] ) ) { $ this -> links [ $ rel ] = [ $ this -> links [ $ rel ] ] ; } $ this -> links [ $ rel ] [ ] = $ link ; } else { $ this -> links [ $ rel ] = $ link ; } return $ link ; }
adds link to collection of links

@param   string                       $rel
@param   \stubbles\peer\http\HttpUri  $uri
@return  \stubbles\webapp\routing\api\Link
adds link to collection of links