PublishStubs::__invoke()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 15
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 8
c 1
b 0
f 0
nc 2
nop 3
dl 0
loc 15
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Scriptura\QuickStart\Tasks;
6
7
use Scriptura\QuickStart\CommandRunner;
8
use Symfony\Component\Console\Input\InputInterface;
9
use Symfony\Component\Console\Output\OutputInterface;
10
11
class PublishStubs
12
{
13
    public function __construct()
14
    {
15
    }
16
17
    public function __invoke(string $name, InputInterface $input, OutputInterface $output)
18
    {
19
        $output->writeln('<info># Publishing stubs...</info>');
20
21
        $directory = getcwd() . '/' . $name;
22
23
        $commands = [
24
            'php artisan stub:publish',
25
        ];
26
27
        $runner = new CommandRunner($output, $directory);
28
        $isSuccessful = $runner->run($commands);
29
30
        if ($isSuccessful) {
31
            $output->writeln('<comment>Stubs published.</comment>');
32
        }
33
    }
34
}
35