1 | <?php |
||
24 | class Executor |
||
25 | { |
||
26 | /** |
||
27 | * Docker client |
||
28 | * |
||
29 | * @var Docker |
||
30 | */ |
||
31 | protected $docker; |
||
32 | |||
33 | /** |
||
34 | * Logger to log message when building |
||
35 | * |
||
36 | * @var LoggerCallback |
||
37 | */ |
||
38 | protected $logger; |
||
39 | |||
40 | /** |
||
41 | * @var boolean Use cache when building |
||
42 | */ |
||
43 | private $usecache = true; |
||
44 | |||
45 | /** |
||
46 | * @var boolean Use cache when building |
||
47 | */ |
||
48 | private $quietBuild = true; |
||
49 | |||
50 | /** |
||
51 | * @var integer Default timeout for run |
||
52 | */ |
||
53 | private $timeout = 600; |
||
54 | |||
55 | /** |
||
56 | * @var string Base directory where builds are located |
||
57 | */ |
||
58 | private $buildPath; |
||
59 | |||
60 | public function __construct(LoggerCallback $logger, Docker $docker, $buildPath, $usecache = true, $quietBuild = true, $timeout = 600) |
||
69 | |||
70 | /** |
||
71 | * Test a build |
||
72 | * |
||
73 | * @param Job $build |
||
74 | * @param array|string $command |
||
75 | * |
||
76 | * @return integer |
||
77 | */ |
||
78 | public function test(Job $build, $command = null) |
||
88 | |||
89 | /** |
||
90 | * Create a build |
||
91 | * |
||
92 | * @param Job $job Build used to create image |
||
93 | * |
||
94 | * @return \Docker\API\Model\Image|boolean Return the image created if successful or false otherwise |
||
95 | */ |
||
96 | public function create(Job $job) |
||
119 | |||
120 | /** |
||
121 | * Run a build (it's suppose the image exist in docker |
||
122 | * |
||
123 | * @param Job $job Build to run |
||
124 | * @param string|array $command Command to use when run the build (null, by default, will use the command registered to the image) |
||
125 | * |
||
126 | * @return integer The exit code of the command run inside (0 = success, otherwise it has failed) |
||
127 | */ |
||
128 | public function run(Job $job, $command) |
||
178 | } |
||
179 |
This check looks at variables that have been passed in as parameters and are passed out again to other methods.
If the outgoing method call has stricter type requirements than the method itself, an issue is raised.
An additional type check may prevent trouble.