Completed
Pull Request — master (#6)
by Tomáš
03:49
created

DefinitionValidator::validate()   B

Complexity

Conditions 5
Paths 4

Size

Total Lines 16
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 5

Importance

Changes 0
Metric Value
dl 0
loc 16
ccs 8
cts 8
cp 1
rs 8.8571
c 0
b 0
f 0
cc 5
eloc 8
nc 4
nop 1
crap 5
1
<?php
2
3
/*
4
 * This file is part of Symplify
5
 * Copyright (c) 2016 Tomas Votruba (http://tomasvotruba.cz).
6
 */
7
8
namespace Symplify\DefaultAutowire\DependencyInjection\Definition;
9
10
use Symfony\Component\DependencyInjection\Definition;
11
12
final class DefinitionValidator
13
{
14 2
    public function validate(Definition $definition) : bool
15
    {
16 2
        if (null === $definition->getClass()) {
17 1
            return false;
18
        }
19
20 2
        if (!$definition->isPublic() || $definition->isAbstract()) {
21 1
            return false;
22
        }
23
24 2
        if (!class_exists($definition->getClass())) {
25 1
            return false;
26
        }
27
28 2
        return true;
29
    }
30
}
31