DumpAutoload::optimize()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7

Duplication

Lines 7
Ratio 100 %

Importance

Changes 0
Metric Value
dl 7
loc 7
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
1
<?php
2
3
namespace Robo\Task\Composer;
4
5
/**
6
 * Composer Dump Autoload
7
 *
8
 * ``` php
9
 * <?php
10
 * // simple execution
11
 * $this->taskComposerDumpAutoload()->run();
12
 *
13
 * // dump auto loader with custom path
14
 * $this->taskComposerDumpAutoload('path/to/my/composer.phar')
15
 *      ->preferDist()
16
 *      ->run();
17
 *
18
 * // optimize autoloader dump with custom path
19
 * $this->taskComposerDumpAutoload('path/to/my/composer.phar')
20
 *      ->optimize()
21
 *      ->run();
22
 *
23
 * // optimize autoloader dump with custom path and no dev
24
 * $this->taskComposerDumpAutoload('path/to/my/composer.phar')
25
 *      ->optimize()
26
 *      ->noDev()
27
 *      ->run();
28
 * ?>
29
 * ```
30
 */
31 View Code Duplication
class DumpAutoload extends Base
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
32
{
33
    /**
34
     * {@inheritdoc}
35
     */
36
    protected $action = 'dump-autoload';
37
38
    /**
39
     * @var string
40
     */
41
    protected $optimize;
42
43
    /**
44
     * @param bool $optimize
45
     *
46
     * @return $this
47
     */
48
    public function optimize($optimize = true)
49
    {
50
        if ($optimize) {
51
            $this->option("--optimize");
52
        }
53
        return $this;
54
    }
55
56
    /**
57
     * {@inheritdoc}
58
     */
59
    public function run()
60
    {
61
        $command = $this->getCommand();
62
        $this->printTaskInfo('Dumping Autoloader: {command}', ['command' => $command]);
63
        return $this->executeCommand($command);
64
    }
65
}
66