Completed
Push — develop ( ad187c...f818a7 )
by Jaap
09:04
created

FileConstants   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 18 2
1
<?php
2
/**
3
 * This file is part of phpDocumentor.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 *
8
 * @copyright 2010-2016 Mike van Riel<[email protected]>
9
 * @license   http://www.opensource.org/licenses/mit-license.php MIT
10
 * @link      http://phpdoc.org
11
 */
12
13
namespace phpDocumentor\Application\ReadModel\Mapper\Project;
14
15
use phpDocumentor\DomainModel\ReadModel\Mapper\Project\Interpret as InterpretInterface;
16
use phpDocumentor\Reflection\Php\File as FileType;
17
18
final class FileConstants extends AbstractReducer
19
{
20
    public function __invoke(InterpretInterface $command, $state)
21
    {
22
        if (!$command->subject() instanceof FileType) {
23
            return $command->interpreter()->next($command, $state);
24
        }
25
26
        $file = $command->subject();
27
28
        $state['constants'] = $this->convertItems(
29
            $file->getConstants(),
30
            $command->interpreter(),
31
            $command->context()
32
        );
33
34
        $state = $command->interpreter()->next($command, $state);
35
36
        return $state;
37
    }
38
}
39