This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Robo\Task\Vcs; |
||
4 | |||
5 | use Robo\Task\CommandStack; |
||
6 | |||
7 | /** |
||
8 | * Runs hg commands in stack. You can use `stopOnFail()` to point that stack should be terminated on first fail. |
||
9 | * |
||
10 | * ``` php |
||
11 | * <?php |
||
12 | * $this->hgStack |
||
13 | * ->cloneRepo('https://bitbucket.org/durin42/hgsubversion') |
||
14 | * ->pull() |
||
15 | * ->add() |
||
16 | * ->commit('changed') |
||
17 | * ->push() |
||
18 | * ->tag('0.6.0') |
||
19 | * ->push('0.6.0') |
||
20 | * ->run(); |
||
21 | * ?> |
||
22 | * ``` |
||
23 | */ |
||
24 | class HgStack extends CommandStack |
||
25 | { |
||
26 | |||
27 | /** |
||
28 | * @param string $pathToHg |
||
29 | */ |
||
30 | public function __construct($pathToHg = 'hg') |
||
31 | { |
||
32 | $this->executable = $pathToHg; |
||
33 | } |
||
34 | |||
35 | /** |
||
36 | * Executes `hg clone` |
||
37 | * |
||
38 | * @param string $repo |
||
39 | * @param string $to |
||
40 | * |
||
41 | * @return $this |
||
42 | */ |
||
43 | public function cloneRepo($repo, $to = '') |
||
44 | { |
||
45 | return $this->exec(['clone', $repo, $to]); |
||
46 | } |
||
47 | |||
48 | /** |
||
49 | * Executes `hg add` command with files to add by pattern |
||
50 | * |
||
51 | * @param string $include |
||
52 | * @param string $exclude |
||
53 | * |
||
54 | * @return $this |
||
55 | */ |
||
56 | public function add($include = '', $exclude = '') |
||
57 | { |
||
58 | if (strlen($include) > 0) { |
||
59 | $include = "-I {$include}"; |
||
60 | } |
||
61 | |||
62 | if (strlen($exclude) > 0) { |
||
63 | $exclude = "-X {$exclude}"; |
||
64 | } |
||
65 | |||
66 | return $this->exec([__FUNCTION__, $include, $exclude]); |
||
67 | } |
||
68 | |||
69 | /** |
||
70 | * Executes `hg commit` command with a message |
||
71 | * |
||
72 | * @param string $message |
||
73 | * @param string $options |
||
74 | * |
||
75 | * @return $this |
||
76 | */ |
||
77 | public function commit($message, $options = '') |
||
78 | { |
||
79 | return $this->exec([__FUNCTION__, "-m '{$message}'", $options]); |
||
80 | } |
||
81 | |||
82 | /** |
||
83 | * Executes `hg pull` command. |
||
84 | * |
||
85 | * @param string $branch |
||
86 | * |
||
87 | * @return $this |
||
88 | */ |
||
89 | View Code Duplication | public function pull($branch = '') |
|
0 ignored issues
–
show
|
|||
90 | { |
||
91 | if (strlen($branch) > 0) { |
||
92 | $branch = "-b '{$branch}''"; |
||
93 | } |
||
94 | |||
95 | return $this->exec([__FUNCTION__, $branch]); |
||
96 | } |
||
97 | |||
98 | /** |
||
99 | * Executes `hg push` command |
||
100 | * |
||
101 | * @param string $branch |
||
102 | * |
||
103 | * @return $this |
||
104 | */ |
||
105 | View Code Duplication | public function push($branch = '') |
|
0 ignored issues
–
show
This method 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...
|
|||
106 | { |
||
107 | if (strlen($branch) > 0) { |
||
108 | $branch = "-b '{$branch}'"; |
||
109 | } |
||
110 | |||
111 | return $this->exec([__FUNCTION__, $branch]); |
||
112 | } |
||
113 | |||
114 | /** |
||
115 | * Performs hg merge |
||
116 | * |
||
117 | * @param string $revision |
||
118 | * |
||
119 | * @return $this |
||
120 | */ |
||
121 | public function merge($revision = '') |
||
122 | { |
||
123 | if (strlen($revision) > 0) { |
||
124 | $revision = "-r {$revision}"; |
||
125 | } |
||
126 | |||
127 | return $this->exec([__FUNCTION__, $revision]); |
||
128 | } |
||
129 | |||
130 | /** |
||
131 | * Executes `hg tag` command |
||
132 | * |
||
133 | * @param string $tag_name |
||
134 | * @param string $message |
||
135 | * |
||
136 | * @return $this |
||
137 | */ |
||
138 | View Code Duplication | public function tag($tag_name, $message = '') |
|
0 ignored issues
–
show
This method 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...
|
|||
139 | { |
||
140 | if ($message !== '') { |
||
141 | $message = "-m '{$message}'"; |
||
142 | } |
||
143 | return $this->exec([__FUNCTION__, $message, $tag_name]); |
||
144 | } |
||
145 | |||
146 | /** |
||
147 | * {@inheritdoc} |
||
148 | */ |
||
149 | public function run() |
||
150 | { |
||
151 | $this->printTaskInfo('Running hg commands...'); |
||
152 | return parent::run(); |
||
153 | } |
||
154 | } |
||
155 |
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.