1
|
|
|
<?php |
2
|
|
|
namespace Robo\Task\Composer; |
3
|
|
|
|
4
|
|
|
trait loadTasks |
5
|
|
|
{ |
6
|
|
|
/** |
7
|
|
|
* @param null|string $pathToComposer |
8
|
|
|
* |
9
|
|
|
* @return Install |
10
|
|
|
*/ |
11
|
|
|
protected function taskComposerInstall($pathToComposer = null) |
12
|
|
|
{ |
13
|
|
|
return $this->task(Install::class, $pathToComposer); |
|
|
|
|
14
|
|
|
} |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* @param null|string $pathToComposer |
18
|
|
|
* |
19
|
|
|
* @return Update |
20
|
|
|
*/ |
21
|
|
|
protected function taskComposerUpdate($pathToComposer = null) |
22
|
|
|
{ |
23
|
|
|
return $this->task(Update::class, $pathToComposer); |
|
|
|
|
24
|
|
|
} |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* @param null|string $pathToComposer |
28
|
|
|
* |
29
|
|
|
* @return DumpAutoload |
30
|
|
|
*/ |
31
|
|
|
protected function taskComposerDumpAutoload($pathToComposer = null) |
32
|
|
|
{ |
33
|
|
|
return $this->task(DumpAutoload::class, $pathToComposer); |
|
|
|
|
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @param null|string $pathToComposer |
38
|
|
|
* |
39
|
|
|
* @return Init |
40
|
|
|
*/ |
41
|
|
|
protected function taskComposerInit($pathToComposer = null) |
42
|
|
|
{ |
43
|
|
|
return $this->task(Init::class, $pathToComposer); |
|
|
|
|
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* @param null|string $pathToComposer |
48
|
|
|
* |
49
|
|
|
* @return Config |
50
|
|
|
*/ |
51
|
|
|
protected function taskComposerConfig($pathToComposer = null) |
52
|
|
|
{ |
53
|
|
|
return $this->task(Config::class, $pathToComposer); |
|
|
|
|
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* @param null|string $pathToComposer |
58
|
|
|
* |
59
|
|
|
* @return Validate |
60
|
|
|
*/ |
61
|
|
|
protected function taskComposerValidate($pathToComposer = null) |
62
|
|
|
{ |
63
|
|
|
return $this->task(Validate::class, $pathToComposer); |
|
|
|
|
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* @param null|string $pathToComposer |
68
|
|
|
* |
69
|
|
|
* @return Remove |
70
|
|
|
*/ |
71
|
|
|
protected function taskComposerRemove($pathToComposer = null) |
72
|
|
|
{ |
73
|
|
|
return $this->task(Remove::class, $pathToComposer); |
|
|
|
|
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* @param null|string $pathToComposer |
78
|
|
|
* |
79
|
|
|
* @return RequireDependency |
80
|
|
|
*/ |
81
|
|
|
protected function taskComposerRequire($pathToComposer = null) |
82
|
|
|
{ |
83
|
|
|
return $this->task(RequireDependency::class, $pathToComposer); |
|
|
|
|
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* @param null|string $pathToComposer |
88
|
|
|
* |
89
|
|
|
* @return CreateProject |
90
|
|
|
*/ |
91
|
|
|
protected function taskComposerCreateProject($pathToComposer = null) |
92
|
|
|
{ |
93
|
|
|
return $this->task(CreateProject::class, $pathToComposer); |
|
|
|
|
94
|
|
|
} |
95
|
|
|
} |
96
|
|
|
|
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.