Completed
Push — apply-code-style ( 1a43bf...37cc85 )
by
unknown
45:48
created

NewDraftEvaluator   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A accept() 0 4 1
A evaluate() 0 4 1
1
<?php
2
3
/**
4
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
5
 * @license For full copyright and license information view LICENSE file distributed with this source code.
6
 */
7
declare(strict_types=1);
8
9
namespace eZ\Publish\Core\Limitation\LanguageLimitation;
10
11
use eZ\Publish\API\Repository\Values\Content\VersionInfo;
12
use eZ\Publish\API\Repository\Values\User\Limitation;
13
use eZ\Publish\Core\Limitation\LanguageLimitationType;
14
use eZ\Publish\SPI\Limitation\Target;
15
16
/**
17
 * @internal for internal use by LanguageLimitation
18
 */
19
final class NewDraftEvaluator implements VersionTargetEvaluator
20
{
21
    public function accept(Target\Version $targetVersion): bool
22
    {
23
        return $targetVersion->newStatus === VersionInfo::STATUS_DRAFT;
24
    }
25
26
    public function evaluate(Target\Version $targetVersion, Limitation $limitationValue): ?bool
27
    {
28
        return LanguageLimitationType::ACCESS_GRANTED;
29
    }
30
}
31