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