Completed
Push — master ( d3a073...5737c8 )
by Greg
02:21
created

src/Task/Composer/Validate.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
namespace Robo\Task\Composer;
3
4
/**
5
 * Composer Validate
6
 *
7
 * ``` php
8
 * <?php
9
 * // simple execution
10
 * $this->taskComposerValidate()->run();
11
 * ?>
12
 * ```
13
 */
14 View Code Duplication
class Validate extends Base
0 ignored issues
show
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...
15
{
16
    /**
17
     * {@inheritdoc}
18
     */
19
    protected $action = 'validate';
20
21
    /**
22
     * @return $this
23
     */
24
    public function noCheckAll($noCheckAll = true)
25
    {
26
        if ($noCheckAll) {
27
            $this->option('--no-check-all');
28
        }
29
        return $this;
30
    }
31
32
    /**
33
     * @return $this
34
     */
35
    public function noCheckLock($noCheckLock = true)
36
    {
37
        if ($noCheckLock) {
38
            $this->option('--no-check-lock');
39
        }
40
        return $this;
41
    }
42
43
    /**
44
     * @return $this
45
     */
46
    public function noCheckPublish($noCheckPublish = true)
47
    {
48
        if ($noCheckPublish) {
49
            $this->option('--no-check-publish');
50
        }
51
        return $this;
52
    }
53
54
    /**
55
     * @return $this
56
     */
57
    public function withDependencies($withDependencies = true)
58
    {
59
        if ($withDependencies) {
60
            $this->option('--with-dependencies');
61
        }
62
        return $this;
63
    }
64
65
    /**
66
     * @return $this
67
     */
68
    public function strict($strict = true)
69
    {
70
        if ($strict) {
71
            $this->option('--strict');
72
        }
73
        return $this;
74
    }
75
76
    /**
77
     * {@inheritdoc}
78
     */
79
    public function run()
80
    {
81
        $command = $this->getCommand();
82
        $this->printTaskInfo('Validating composer.json: {command}', ['command' => $command]);
83
        return $this->executeCommand($command);
84
    }
85
}
86