Completed
Push — master ( f657d9...210110 )
by ARCANEDEV
8s
created

SuggestsTrait   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 3
dl 0
loc 25
rs 10

1 Method

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