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\Filesystem; |
||
3 | |||
4 | trait loadShortcuts |
||
5 | { |
||
6 | /** |
||
7 | * @param string $src |
||
8 | * @param string $dst |
||
9 | * |
||
10 | * @return \Robo\Result |
||
11 | */ |
||
12 | protected function _copyDir($src, $dst) |
||
13 | { |
||
14 | return $this->taskCopyDir([$src => $dst])->run(); |
||
15 | } |
||
16 | |||
17 | /** |
||
18 | * @param string $src |
||
19 | * @param string $dst |
||
20 | * |
||
21 | * @return \Robo\Result |
||
22 | */ |
||
23 | protected function _mirrorDir($src, $dst) |
||
24 | { |
||
25 | return $this->taskMirrorDir([$src => $dst])->run(); |
||
26 | } |
||
27 | |||
28 | /** |
||
29 | * @param string|string[] $dir |
||
30 | * |
||
31 | * @return \Robo\Result |
||
32 | */ |
||
33 | protected function _deleteDir($dir) |
||
34 | { |
||
35 | return $this->taskDeleteDir($dir)->run(); |
||
36 | } |
||
37 | |||
38 | /** |
||
39 | * @param string|string[] $dir |
||
40 | * |
||
41 | * @return \Robo\Result |
||
42 | */ |
||
43 | protected function _cleanDir($dir) |
||
44 | { |
||
45 | return $this->taskCleanDir($dir)->run(); |
||
46 | } |
||
47 | |||
48 | /** |
||
49 | * @param string $from |
||
50 | * @param string $to |
||
51 | * @param bool $overwrite |
||
52 | * |
||
53 | * @return \Robo\Result |
||
54 | */ |
||
55 | protected function _rename($from, $to, $overwrite = false) |
||
56 | { |
||
57 | return $this->taskFilesystemStack()->rename($from, $to, $overwrite)->run(); |
||
0 ignored issues
–
show
|
|||
58 | } |
||
59 | |||
60 | /** |
||
61 | * @param string|string[] $dir |
||
62 | * |
||
63 | * @return \Robo\Result |
||
64 | */ |
||
65 | protected function _mkdir($dir) |
||
66 | { |
||
67 | return $this->taskFilesystemStack()->mkdir($dir)->run(); |
||
68 | } |
||
69 | |||
70 | /** |
||
71 | * @param string $prefix |
||
72 | * @param string $base |
||
73 | * @param bool $includeRandomPart |
||
74 | * |
||
75 | * @return string |
||
76 | */ |
||
77 | protected function _tmpDir($prefix = 'tmp', $base = '', $includeRandomPart = true) |
||
78 | { |
||
79 | $result = $this->taskTmpDir($prefix, $base, $includeRandomPart)->run(); |
||
80 | return isset($result['path']) ? $result['path'] : ''; |
||
81 | } |
||
82 | |||
83 | /** |
||
84 | * @param string $file |
||
85 | * |
||
86 | * @return \Robo\Result |
||
87 | */ |
||
88 | protected function _touch($file) |
||
89 | { |
||
90 | return $this->taskFilesystemStack()->touch($file)->run(); |
||
91 | } |
||
92 | |||
93 | /** |
||
94 | * @param string|string[] $file |
||
95 | * |
||
96 | * @return \Robo\Result |
||
97 | */ |
||
98 | protected function _remove($file) |
||
99 | { |
||
100 | return $this->taskFilesystemStack()->remove($file)->run(); |
||
101 | } |
||
102 | |||
103 | /** |
||
104 | * @param string|string[] $file |
||
105 | * @param string $group |
||
106 | * |
||
107 | * @return \Robo\Result |
||
108 | */ |
||
109 | protected function _chgrp($file, $group) |
||
110 | { |
||
111 | return $this->taskFilesystemStack()->chgrp($file, $group)->run(); |
||
112 | } |
||
113 | |||
114 | /** |
||
115 | * @param string|string[] $file |
||
116 | * @param int $permissions |
||
117 | * @param int $umask |
||
118 | * @param bool $recursive |
||
119 | * |
||
120 | * @return \Robo\Result |
||
121 | */ |
||
122 | protected function _chmod($file, $permissions, $umask = 0000, $recursive = false) |
||
123 | { |
||
124 | return $this->taskFilesystemStack()->chmod($file, $permissions, $umask, $recursive)->run(); |
||
125 | } |
||
126 | |||
127 | /** |
||
128 | * @param string $from |
||
129 | * @param string $to |
||
130 | * |
||
131 | * @return \Robo\Result |
||
132 | */ |
||
133 | protected function _symlink($from, $to) |
||
134 | { |
||
135 | return $this->taskFilesystemStack()->symlink($from, $to)->run(); |
||
136 | } |
||
137 | |||
138 | /** |
||
139 | * @param string $from |
||
140 | * @param string $to |
||
141 | * |
||
142 | * @return \Robo\Result |
||
143 | */ |
||
144 | protected function _copy($from, $to) |
||
145 | { |
||
146 | return $this->taskFilesystemStack()->copy($from, $to)->run(); |
||
147 | } |
||
148 | |||
149 | /** |
||
150 | * @param string $from |
||
151 | * @param string $to |
||
152 | * |
||
153 | * @return \Robo\Result |
||
154 | */ |
||
155 | protected function _flattenDir($from, $to) |
||
156 | { |
||
157 | return $this->taskFlattenDir([$from => $to])->run(); |
||
158 | } |
||
159 | } |
||
160 |
This check looks for methods that are used by a trait but not required by it.
To illustrate, let’s look at the following code example
The trait
Idable
provides a methodequalsId
that in turn relies on the methodgetId()
. If this method does not exist on a class mixing in this trait, the method will fail.Adding the
getId()
as an abstract method to the trait will make sure it is available.