Test Failed
Push — master ( d820d2...d59132 )
by Kirill
02:27
created

src/Definition/Dependent/DirectiveLocation.php (1 issue)

Labels
Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/**
3
 * This file is part of Railt package.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
declare(strict_types=1);
9
10
namespace Railt\Reflection\Definition\Dependent;
11
12
use Railt\Reflection\Contracts\Definition\Dependent\DirectiveLocation as DirectiveLocationInterface;
13
use Railt\Reflection\Contracts\Type as TypeInterface;
14
use Railt\Reflection\Exception\TypeConflictException;
15
use Railt\Reflection\Type;
16
17
/**
18
 * Class DirectiveLocation
19
 */
20
class DirectiveLocation extends AbstractDependentTypeDefinition implements DirectiveLocationInterface
0 ignored issues
show
There is at least one abstract method in this class. Maybe declare it as abstract, or implement the remaining methods: isInputable, isRenderable
Loading history...
21
{
22
    /**
23
     * @return bool
24
     */
25
    public function isExecutable(): bool
26
    {
27
        return \in_array($this->getName(), static::EXECUTABLE_LOCATIONS, true);
28
    }
29
30
    /**
31
     * @return bool
32
     */
33
    public function isPrivate(): bool
34
    {
35
        return \in_array($this->getName(), static::SDL_LOCATIONS, true);
36
    }
37
38
    /**
39
     * @param TypeInterface $type
40
     * @return bool
41
     * @throws \Railt\Io\Exception\ExternalFileException
42
     */
43
    public function isAllowedFor(TypeInterface $type): bool
44
    {
45
        $location = static::LOCATION_TO_TYPES[$this->getName()] ?? Type::ANY;
46
47
        return $type->instanceOf(Type::of($location));
48
    }
49
50
    /**
51
     * @return TypeInterface
52
     */
53
    public static function getType(): TypeInterface
54
    {
55
        return Type::of(Type::DIRECTIVE_LOCATION);
56
    }
57
}
58