AutoloadTrait   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A mergeAutoload() 0 9 2
1
<?php namespace Arcanedev\Composer\Entities\PackageTraits;
2
3
use Arcanedev\Composer\Utilities\Util;
4
use Composer\Package\RootPackageInterface;
5
6
/**
7
 * Trait     AutoloadTrait
8
 *
9
 * @package  Arcanedev\Composer\Entities\PackageTraits
10
 * @author   ARCANEDEV <[email protected]>
11
 */
12
trait AutoloadTrait
13
{
14
    /* ------------------------------------------------------------------------------------------------
15
     |  Traits
16
     | ------------------------------------------------------------------------------------------------
17
     */
18
    use PackageTrait;
19
20
    /* ------------------------------------------------------------------------------------------------
21
     |  Main Functions
22
     | ------------------------------------------------------------------------------------------------
23
     */
24
    /**
25
     * Merge autoload into a RootPackage.
26
     *
27
     * @param  \Composer\Package\RootPackageInterface  $root
28
     */
29 99
    private function mergeAutoload(RootPackageInterface $root)
30
    {
31 99
        if ( ! empty($autoload = $this->getPackage()->getAutoload())) {
32 9
            static::unwrapIfNeeded($root, 'setAutoload')
33 9
                ->setAutoload(array_merge_recursive(
34 9
                    $root->getAutoload(), Util::fixRelativePaths($this->getPath(), $autoload)
35
                ));
36
        }
37 99
    }
38
}
39