RequirePackageTask   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getType() 0 4 1
A prepareCommand() 0 8 1
1
<?php
2
3
/**
4
 * This file is part of tenside/core.
5
 *
6
 * (c) Christian Schiffler <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 *
11
 * This project is provided in good faith and hope to be usable by anyone.
12
 *
13
 * @package    tenside/core
14
 * @author     Christian Schiffler <[email protected]>
15
 * @copyright  2015 Christian Schiffler <[email protected]>
16
 * @license    https://github.com/tenside/core/blob/master/LICENSE MIT
17
 * @link       https://github.com/tenside/core
18
 * @filesource
19
 */
20
21
namespace Tenside\Core\Task\Composer;
22
23
use Tenside\Core\Task\Composer\WrappedCommand\RequireCommand;
24
use Tenside\Core\Util\RuntimeHelper;
25
26
/**
27
 * This class holds the information for an installation request of a package (composer require).
28
 */
29
class RequirePackageTask extends AbstractPackageManipulatingTask
30
{
31
    /**
32
     * Returns 'upgrade'.
33
     *
34
     * {@inheritdoc}
35
     */
36
    public function getType()
37
    {
38
        return 'require-package';
39
    }
40
41
    /**
42
     * {@inheritDoc}
43
     */
44
    protected function prepareCommand()
45
    {
46
        // Switch home first, this is needed as the command manipulates the RAW composer.json prior to creating the
47
        // composer instance.
48
        RuntimeHelper::setupHome($this->getHome());
49
50
        return $this->attachComposerFactory(new RequireCommand());
51
    }
52
}
53