xref: /dokuwiki/inc/TreeBuilder/Node/WikiStartpage.php (revision a8e9ec06570f392919a588ec98f916aab604b5a1)
1*78a26510SAndreas Gohr<?php
2*78a26510SAndreas Gohr
3*78a26510SAndreas Gohrnamespace dokuwiki\TreeBuilder\Node;
4*78a26510SAndreas Gohr
5*78a26510SAndreas Gohr/**
6*78a26510SAndreas Gohr * A node representing a namespace startpage
7*78a26510SAndreas Gohr */
8*78a26510SAndreas Gohrclass WikiStartpage extends WikiNamespace
9*78a26510SAndreas Gohr{
10*78a26510SAndreas Gohr    protected string $originalNamespace;
11*78a26510SAndreas Gohr
12*78a26510SAndreas Gohr    /**
13*78a26510SAndreas Gohr     * Constructor
14*78a26510SAndreas Gohr     *
15*78a26510SAndreas Gohr     * @param string $id The pageID of the startpage
16*78a26510SAndreas Gohr     * @param string|null $title The title as given in the link
17*78a26510SAndreas Gohr     * @param string $originalNamespace The original namespace
18*78a26510SAndreas Gohr     */
19*78a26510SAndreas Gohr    public function __construct(string $id, ?string $title, string $originalNamespace)
20*78a26510SAndreas Gohr    {
21*78a26510SAndreas Gohr        $this->originalNamespace = $originalNamespace;
22*78a26510SAndreas Gohr        parent::__construct($id, $title);
23*78a26510SAndreas Gohr    }
24*78a26510SAndreas Gohr
25*78a26510SAndreas Gohr    /**
26*78a26510SAndreas Gohr     * This will return the namespace this startpage is for
27*78a26510SAndreas Gohr     *
28*78a26510SAndreas Gohr     * This might differ from the namespace of the pageID, because a startpage may be outside
29*78a26510SAndreas Gohr     * the namespace.
30*78a26510SAndreas Gohr     *
31*78a26510SAndreas Gohr     * @inheritdoc
32*78a26510SAndreas Gohr     */
33*78a26510SAndreas Gohr    public function getNs(): string
34*78a26510SAndreas Gohr    {
35*78a26510SAndreas Gohr        return $this->originalNamespace;
36*78a26510SAndreas Gohr    }
37*78a26510SAndreas Gohr}
38