xref: /plugin/combo/ComboStrap/Path.php (revision 4cadd4f8c541149bdda95f080e38a6d4e3a640ca)
1c3437056SNickeau<?php
2c3437056SNickeau
3c3437056SNickeau
4c3437056SNickeaunamespace ComboStrap;
5c3437056SNickeau
6c3437056SNickeau/**
7c3437056SNickeau * Interface Path
8c3437056SNickeau * @package ComboStrap
9c3437056SNickeau *
10c3437056SNickeau * An interface that implements path operation
11c3437056SNickeau *
12c3437056SNickeau * The {@link Path::toString()} function is just the path part (no other URI query parameters)
13c3437056SNickeau *
14c3437056SNickeau * TODO: because a path should be able to go to an URI format, it should also allow query parameters
15c3437056SNickeau *  We could then add a `toPath` function to {@link DokuwikiUrl} and delete the tag attributes
16c3437056SNickeau *  as parameter of all {@link MediaLink::createMediaLinkFromPath()} creator function
17c3437056SNickeau */
18c3437056SNickeauinterface Path
19c3437056SNickeau{
20c3437056SNickeau
21c3437056SNickeau    function getExtension();
22c3437056SNickeau
23c3437056SNickeau    function getLastNameWithoutExtension();
24c3437056SNickeau
25c3437056SNickeau    function getScheme();
26c3437056SNickeau
27c3437056SNickeau    /**
28c3437056SNickeau     * The last name of the path with or without the extension
29c3437056SNickeau     *
30c3437056SNickeau     * The Path class does not have a notion of "extension"
31c3437056SNickeau     * because the file does not have one but we provide the
32c3437056SNickeau     * {@link PathAbs::getExtension()} as utility
33c3437056SNickeau     *
34c3437056SNickeau     * @return mixed
35c3437056SNickeau     */
36c3437056SNickeau    function getLastName();
37c3437056SNickeau
38c3437056SNickeau    function getNames();
39c3437056SNickeau
40c3437056SNickeau    function getParent(): ?Path;
41c3437056SNickeau
42*4cadd4f8SNickeau    /**
43*4cadd4f8SNickeau     * @return string only the string representation of the path
44*4cadd4f8SNickeau     */
45*4cadd4f8SNickeau    function toString(): string;
46*4cadd4f8SNickeau
47*4cadd4f8SNickeau    /**
48*4cadd4f8SNickeau     * @return string the uri string representation of this path (with all information, drive, attributes)
49*4cadd4f8SNickeau     */
50*4cadd4f8SNickeau    function toUriString(): string;
51c3437056SNickeau
52c3437056SNickeau    function toAbsolutePath(): Path;
53c3437056SNickeau
54c3437056SNickeau    /**
55c3437056SNickeau     * @return Mime the mime from the extension
56c3437056SNickeau     */
57c3437056SNickeau    function getMime(): ?Mime;
58*4cadd4f8SNickeau
59*4cadd4f8SNickeau    function resolve(string $name);
60*4cadd4f8SNickeau
61*4cadd4f8SNickeau    /**
62*4cadd4f8SNickeau     * @return DokuPath
63*4cadd4f8SNickeau     * @throws ExceptionCombo - if the path cannot be transformed to a doku path
64*4cadd4f8SNickeau     */
65*4cadd4f8SNickeau    function toDokuPath(): DokuPath;
66c3437056SNickeau}
67