Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2
3namespace MediaWiki\Extension\CommunityConfiguration\Schema;
4
5use InvalidArgumentException;
6
7/**
8 * Class capable of reading a schema from a file (represented as a PHP class, or otherwise).
9 * Implementations remember which schema they are reading
10 */
11interface SchemaReader {
12
13    /**
14     * Are we pointed at a schema?
15     *
16     * Answer is based on the data passed through the constructor.
17     *
18     * @see SchemaReader::assertIsSchema()
19     * @return bool
20     */
21    public function isSchema(): bool;
22
23    /**
24     * Throw an exception if not pointed at a schema
25     *
26     * @throws InvalidArgumentException when not processing a schema (isSchema returns false);
27     * this is based on data passed through the constructor.
28     * @see SchemaReader::isSchema()
29     * @return void
30     */
31    public function assertIsSchema(): void;
32
33    /**
34     * Get the schema version (if applicable)
35     *
36     * Returned versions should be comparable via PHP's version_compare.
37     *
38     * @return string|null Version (or null if unavailable)
39     */
40    public function getVersion(): ?string;
41
42    /**
43     * Get the next schema version (if available)
44     *
45     * Returned versions should be comparable via PHP's version_compare.
46     *
47     * @return string|null Version (or null if not available)
48     */
49    public function getNextVersion(): ?string;
50
51    /**
52     * Get the previous schema version (if available)
53     *
54     * Returned versions should be comparable via PHP's version_compare.
55     *
56     * @return string|null Version (or null if not available)
57     */
58    public function getPreviousVersion(): ?string;
59
60    /**
61     * Get a schema ID
62     *
63     * A schema ID uniquely identifies a certain schema.
64     *
65     * @return string
66     */
67    public function getSchemaId(): string;
68
69    /**
70     * Return a schema converter
71     *
72     * A schema converter is able to convert data to conform
73     * to this schema version, using data conforming to the immediately preceding
74     * (or succeeding) schema versions.
75     *
76     * @see ISchemaConverter
77     * @return string|null Classname of an ISchemaConverter implementation
78     */
79    public function getSchemaConverterId(): ?string;
80}