EmittingMiddleware   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 19
rs 10
c 0
b 0
f 0
ccs 7
cts 7
cp 1
wmc 2
lcom 0
cbo 4

1 Method

Rating   Name   Duplication   Size   Complexity  
A execute() 0 13 2
1
<?php
2
declare(strict_types=1);
3
4
/**
5
 * This file is part of phpDocumentor.
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 *
10
 * @author    Mike van Riel <[email protected]>
11
 * @copyright 2010-2018 Mike van Riel / Naenius (http://www.naenius.com)
12
 * @license   http://www.opensource.org/licenses/mit-license.php MIT
13
 * @link      http://phpdoc.org
14
 */
15
16
namespace phpDocumentor\Parser\Middleware;
17
18
use phpDocumentor\Event\Dispatcher;
19
use phpDocumentor\Parser\Event\PreFileEvent;
20
use phpDocumentor\Reflection\Middleware\Command;
21
use phpDocumentor\Reflection\Middleware\Middleware;
22
use phpDocumentor\Reflection\Php\Factory\File\CreateCommand;
23
24
final class EmittingMiddleware implements Middleware
25
{
26
    /**
27
     * @return object
28
     */
29 1
    public function execute(Command $command, callable $next)
30
    {
31 1
        assert($command instanceof CreateCommand);
32
33 1
        if (class_exists('phpDocumentor\Event\Dispatcher')) {
34 1
            Dispatcher::getInstance()->dispatch(
35 1
                'parser.file.pre',
36 1
                PreFileEvent::createInstance($this)->setFile($command->getFile()->path())
37
            );
38
        }
39
40 1
        return $next($command);
41
    }
42
}
43