xref: /dokuwiki/inc/Remote/Response/Link.php (revision 093fe67e98c0cdb4b73fd46938e49b64971483c2)
16cce3332SAndreas Gohr<?php
26cce3332SAndreas Gohr
36cce3332SAndreas Gohrnamespace dokuwiki\Remote\Response;
46cce3332SAndreas Gohr
56cce3332SAndreas Gohrclass Link extends ApiResponse
66cce3332SAndreas Gohr{
76cce3332SAndreas Gohr    /** @var string The type of this link: `internal`, `external` or `interwiki` */
86cce3332SAndreas Gohr    public $type;
96cce3332SAndreas Gohr    /** @var string The wiki page this link points to, same as `href` for external links */
106cce3332SAndreas Gohr    public $page;
116cce3332SAndreas Gohr    /** @var string A hyperlink pointing to the linked target */
126cce3332SAndreas Gohr    public $href;
136cce3332SAndreas Gohr
1458ae4747SAndreas Gohr    /**
1558ae4747SAndreas Gohr     * @param string $type One of `internal`, `external` or `interwiki`
1658ae4747SAndreas Gohr     * @param string $page The wiki page this link points to, same as `href` for external links
1758ae4747SAndreas Gohr     * @param string $href A hyperlink pointing to the linked target
1858ae4747SAndreas Gohr     */
1958ae4747SAndreas Gohr    public function __construct($type, $page, $href)
206cce3332SAndreas Gohr    {
2158ae4747SAndreas Gohr        $this->type = $type;
2258ae4747SAndreas Gohr        $this->page = $page;
2358ae4747SAndreas Gohr        $this->href = $href;
246cce3332SAndreas Gohr    }
258268b284SAndreas Gohr
268268b284SAndreas Gohr    /** @inheritdoc */
27*093fe67eSAndreas Gohr    public function __toString(): string
288268b284SAndreas Gohr    {
298268b284SAndreas Gohr        return $this->href;
308268b284SAndreas Gohr    }
316cce3332SAndreas Gohr}
32