Parser   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A parseClassDocComment() 0 10 2
1
<?php
2
/**
3
 * This file is part of Properties 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 Serafim\Properties\Parser;
11
12
use Railt\Io\File;
13
use Railt\Parser\Ast\RuleInterface;
14
15
/**
16
 * Class Parser
17
 */
18
class Parser extends BaseParser
19
{
20
    /**
21
     * @param string $class
22
     * @return RuleInterface|null
23
     */
24
    public function parseClassDocComment(string $class): ?RuleInterface
25
    {
26
        try {
27
            $comment = (new \ReflectionClass($class))->getDocComment();
28
29
            return $this->parse(File::fromSources($comment, $class));
30
        } catch (\Throwable $e) {
31
            return null;
32
        }
33
    }
34
}
35