1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Robo\Task\Docker; |
4
|
|
|
|
5
|
|
|
trait loadTasks |
6
|
|
|
{ |
7
|
|
|
/** |
8
|
|
|
* @param string $image |
9
|
|
|
* |
10
|
|
|
* @return \Robo\Task\Docker\Run|\Robo\Collection\CollectionBuilder |
11
|
|
|
*/ |
12
|
|
|
protected function taskDockerRun($image) |
13
|
|
|
{ |
14
|
|
|
return $this->task(Run::class, $image); |
|
|
|
|
15
|
|
|
} |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* @param string $image |
19
|
|
|
* |
20
|
|
|
* @return \Robo\Task\Docker\Pull|\Robo\Collection\CollectionBuilder |
21
|
|
|
*/ |
22
|
|
|
protected function taskDockerPull($image) |
23
|
|
|
{ |
24
|
|
|
return $this->task(Pull::class, $image); |
|
|
|
|
25
|
|
|
} |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @param string $path |
29
|
|
|
* |
30
|
|
|
* @return \Robo\Task\Docker\Build|\Robo\Collection\CollectionBuilder |
31
|
|
|
*/ |
32
|
|
|
protected function taskDockerBuild($path = '.') |
33
|
|
|
{ |
34
|
|
|
return $this->task(Build::class, $path); |
|
|
|
|
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @param string|\Robo\Task\Docker\Result $cidOrResult |
39
|
|
|
* |
40
|
|
|
* @return \Robo\Task\Docker\Stop|\Robo\Collection\CollectionBuilder |
41
|
|
|
*/ |
42
|
|
|
protected function taskDockerStop($cidOrResult) |
43
|
|
|
{ |
44
|
|
|
return $this->task(Stop::class, $cidOrResult); |
|
|
|
|
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @param string|\Robo\Task\Docker\Result $cidOrResult |
49
|
|
|
* |
50
|
|
|
* @return \Robo\Task\Docker\Commit|\Robo\Collection\CollectionBuilder |
51
|
|
|
*/ |
52
|
|
|
protected function taskDockerCommit($cidOrResult) |
53
|
|
|
{ |
54
|
|
|
return $this->task(Commit::class, $cidOrResult); |
|
|
|
|
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* @param string|\Robo\Task\Docker\Result $cidOrResult |
59
|
|
|
* |
60
|
|
|
* @return \Robo\Task\Docker\Start|\Robo\Collection\CollectionBuilder |
61
|
|
|
*/ |
62
|
|
|
protected function taskDockerStart($cidOrResult) |
63
|
|
|
{ |
64
|
|
|
return $this->task(Start::class, $cidOrResult); |
|
|
|
|
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* @param string|\Robo\Task\Docker\Result $cidOrResult |
69
|
|
|
* |
70
|
|
|
* @return \Robo\Task\Docker\Remove|\Robo\Collection\CollectionBuilder |
71
|
|
|
*/ |
72
|
|
|
protected function taskDockerRemove($cidOrResult) |
73
|
|
|
{ |
74
|
|
|
return $this->task(Remove::class, $cidOrResult); |
|
|
|
|
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* @param string|\Robo\Task\Docker\Result $cidOrResult |
79
|
|
|
* |
80
|
|
|
* @return \Robo\Task\Docker\Exec|\Robo\Collection\CollectionBuilder |
81
|
|
|
*/ |
82
|
|
|
protected function taskDockerExec($cidOrResult) |
83
|
|
|
{ |
84
|
|
|
return $this->task(Exec::class, $cidOrResult); |
|
|
|
|
85
|
|
|
} |
86
|
|
|
} |
87
|
|
|
|
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.