Completed
Pull Request — develop (#92)
by Jaap
02:48
created

Implements_::execute()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 15
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 15
ccs 0
cts 11
cp 0
rs 9.4285
cc 3
eloc 8
nc 2
nop 2
crap 12
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-2015 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\Reflection\Php\Factory\Middleware;
14
15
16
use phpDocumentor\Reflection\Fqsen;
17
use phpDocumentor\Reflection\Middleware\Middleware;
18
19
final class Implements_ implements Middleware
0 ignored issues
show
Coding Style introduced by
This class is not in CamelCase format.

Classes in PHP are usually named in CamelCase.

In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. The whole name starts with a capital letter as well.

Thus the name database provider becomes DatabaseProvider.

Loading history...
20
{
21
22
    /**
23
     * Executes this middle ware class.
24
     *
25
     * @param $command
26
     * @param callable $next
27
     *
28
     * @return object
29
     */
30
    public function execute($command, callable $next)
31
    {
32
        $element = $next($command);
33
        $object = $command->getObject();
34
35
        if (isset($object->implements)) {
36
            foreach ($object->implements as $interfaceClassName) {
37
                $element->addInterface(
38
                    new Fqsen('\\' . $interfaceClassName->toString())
39
                );
40
            }
41
        }
42
43
        return $element;
44
    }
45
}
46