-
Notifications
You must be signed in to change notification settings - Fork 0
/
RuleSetInterface.php
71 lines (60 loc) · 1.74 KB
/
RuleSetInterface.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?php
/**
* Bit&Black TypoRules.
*
* @author Tobias Köngeter
* @copyright Copyright © Bit&Black
* @link https://www.bitandblack.com
* @license MIT
*/
namespace BitAndBlack\TypoRules\RuleSet;
use BitAndBlack\TypoRules\Rule\RuleInterface;
use BitAndBlack\TypoRules\Violation;
interface RuleSetInterface
{
public static function create(): self;
/**
* Returns a list of all rules in this rule set.
*
* @return array<int, RuleInterface>
*/
public function getRuleSet(): array;
/**
* Returns a list of all violations in the given input.
*
* @return array<int, Violation>
*/
public function getViolations(string $content): array;
/**
* Returns the fixed content.
*
* @return string
*/
public function getContentFixed(string $content): string;
/**
* Adds one or more rules to the set list.
*
* @return RuleSetInterface
*/
public function withRule(RuleInterface ...$rules): RuleSetInterface;
/**
* Removes one or more rules from the set list.
*
* @param RuleInterface|class-string<RuleInterface> ...$rules
* @return RuleSetInterface
*/
public function withoutRule(RuleInterface|string ...$rules): RuleSetInterface;
/**
* Adds one or more rule sets with all its rules to the set list.
*
* @return RuleSetInterface
*/
public function withRuleSet(RuleSetInterface ...$ruleSets): RuleSetInterface;
/**
* Removes one or more rule sets with all its rules from the set list.
*
* @param RuleSetInterface|class-string<RuleSetInterface> ...$ruleSets
* @return RuleSetInterface
*/
public function withoutRuleSet(RuleSetInterface|string ...$ruleSets): RuleSetInterface;
}