Completed
Push — master ( c612e7...f3e1c8 )
by Christian
06:23
created

AbstractPackageManipulatingTask   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getPackage() 0 4 1
A getHome() 0 4 1
A prepareInput() 0 7 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 Symfony\Component\Console\Input\ArrayInput;
24
25
/**
26
 * This task provides the basic framework for building tasks that perform composer commands.
27
 */
28
abstract class AbstractPackageManipulatingTask extends AbstractComposerCommandTask
29
{
30
    /**
31
     * The package to install.
32
     */
33
    const SETTING_PACKAGE = 'package';
34
35
    /**
36
     * The home path of tenside.
37
     */
38
    const SETTING_HOME = 'home';
39
40
    /**
41
     * Retrieve the names of the packages to upgrade or null if none.
42
     *
43
     * @return array
44
     */
45
    public function getPackage()
46
    {
47
        return (array) $this->file->get(self::SETTING_PACKAGE);
48
    }
49
50
    /**
51
     * Retrieve the home path of tenside.
52
     *
53
     * @return string
0 ignored issues
show
Documentation introduced by
Should the return type not be array|string|integer|null? Also, consider making the array more specific, something like array<String>, or String[].

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

If the return type contains the type array, this check recommends the use of a more specific type like String[] or array<String>.

Loading history...
54
     */
55
    public function getHome()
56
    {
57
        return $this->file->get(self::SETTING_HOME);
58
    }
59
60
    /**
61
     * {@inheritDoc}
62
     */
63
    protected function prepareInput()
64
    {
65
        $input = new ArrayInput(['packages' => $this->getPackage()]);
66
        $input->setInteractive(false);
67
68
        return $input;
69
    }
70
}
71