Updater::update()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 14
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 14
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 7
nc 2
nop 1
1
<?php
2
3
namespace Consigliere\Components\Process;
4
5
class Updater extends Runner
6
{
7
    /**
8
     * Update the dependencies for the specified component by given the component name.
9
     *
10
     * @param string $component
11
     */
12
    public function update($component)
13
    {
14
        $component = $this->component->findOrFail($component);
15
16
        $packages = $component->getComposerAttr('require', []);
17
18
        chdir(base_path());
19
20
        foreach ($packages as $name => $version) {
21
            $package = "\"{$name}:{$version}\"";
22
23
            $this->run("composer require {$package}");
24
        }
25
    }
26
}
27