UpdateAddonsTask::run()   A
last analyzed

Complexity

Conditions 2
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 1
nop 1
1
<?php
2
/**
3
 * Runs the add-on updater.
4
 *
5
 * @package mysite
6
 */
7
class UpdateAddonsTask extends BuildTask
8
{
9
    /**
10
     * {@inheritDoc}
11
     * @var string
12
     */
13
    protected $title = 'Update Add-ons';
14
15
    /**
16
     * {@inheritDoc}
17
     * @var string
18
     */
19
    protected $description = 'Updates add-ons from Packagist';
20
21
    /**
22
     * @var AddonUpdater
23
     */
24
    private $updater;
25
26
    /**
27
     * @param AddonUpdater $updater
28
     */
29
    public function __construct(AddonUpdater $updater)
30
    {
31
        $this->updater = $updater;
32
    }
33
34
    /**
35
     * {@inheritDoc}
36
     * @param SS_HTTPRequest $request
37
     */
38
    public function run($request)
39
    {
40
        $this->updater->update(
41
            (bool)$request->getVar('clear'),
42
            $request->getVar('addons') ? explode(',', $request->getVar('addons')) : null
43
        );
44
    }
45
}
46