-
-
Notifications
You must be signed in to change notification settings - Fork 50
Expand file tree
/
Copy pathNoClass.php
More file actions
42 lines (32 loc) · 1.01 KB
/
NoClass.php
File metadata and controls
42 lines (32 loc) · 1.01 KB
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
<?php
declare(strict_types=1);
namespace Arkitect\Rules;
use Arkitect\Expression\Expression;
use Arkitect\Expression\NegateDecorator;
use Arkitect\Rules\DSL\AndThatShouldParser;
use Arkitect\Rules\DSL\BecauseParser;
use Arkitect\Rules\DSL\ThatParser;
class NoClass implements ThatParser
{
/** @var RuleBuilder */
protected $ruleBuilder;
public function __construct()
{
$this->ruleBuilder = (new RuleBuilder())->negateShoulds();
}
public function should(Expression $expression): BecauseParser
{
$this->ruleBuilder->addShould(new NegateDecorator($expression));
return new Because($this->ruleBuilder);
}
public function that(Expression $expression): AndThatShouldParser
{
$this->ruleBuilder->addThat($expression);
return new AndThatShould($this->ruleBuilder);
}
public function except(string ...$classesToBeExcluded): ThatParser
{
$this->ruleBuilder->classesToBeExcluded(...$classesToBeExcluded);
return $this;
}
}