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
3declare( strict_types = 1 );
4
5namespace EntitySchema\DataAccess;
6
7use EntitySchema\Domain\Model\EntitySchemaId;
8use InvalidArgumentException;
9use MediaWiki\CommentStore\CommentStoreComment;
10use RuntimeException;
11
12/**
13 * @license GPL-2.0-or-later
14 */
15interface EntitySchemaUpdater {
16
17    /**
18     * Update a Schema with new content. This will remove existing schema content.
19     *
20     * @param EntitySchemaId $id
21     * @param string[] $labels
22     * @param string[] $descriptions
23     * @param string[][] $aliasGroups
24     * @param string $schemaText
25     * @param int $baseRevId
26     * @param CommentStoreComment $summary
27     *
28     * @throws InvalidArgumentException if bad parameters are passed
29     * @throws RuntimeException if Schema to update does not exist or saving fails
30     */
31    public function overwriteWholeSchema(
32        EntitySchemaId $id,
33        array $labels,
34        array $descriptions,
35        array $aliasGroups,
36        string $schemaText,
37        int $baseRevId,
38        CommentStoreComment $summary
39    ): void;
40
41    /**
42     * @param EntitySchemaId $id
43     * @param string   $langCode
44     * @param string   $label
45     * @param string   $description
46     * @param string[] $aliases
47     * @param int      $baseRevId
48     */
49    public function updateSchemaNameBadge(
50        EntitySchemaId $id,
51        string $langCode,
52        string $label,
53        string $description,
54        array $aliases,
55        int $baseRevId
56    ): void;
57
58    /**
59     * @param EntitySchemaId $id
60     * @param string $schemaText
61     * @param int $baseRevId id of the base revision for detecting edit conflicts.
62     * @param string|null $userSummary
63     *
64     * @throws InvalidArgumentException if bad parameters are passed
65     * @throws EditConflict if another revision has been saved after $baseRevId
66     * @throws RuntimeException if Schema to update does not exist or saving fails
67     */
68    public function updateSchemaText(
69        EntitySchemaId $id,
70        string $schemaText,
71        int $baseRevId,
72        ?string $userSummary = null
73    ): void;
74
75}