1 | <?php |
||
11 | class Context implements ContextInterface |
||
12 | { |
||
13 | const FORMAT_STREAM = 'stream'; |
||
14 | |||
15 | const FORMAT_TAR = 'tar'; |
||
16 | |||
17 | /** |
||
18 | * @var string |
||
19 | */ |
||
20 | private $directory; |
||
21 | |||
22 | /** |
||
23 | * @var process Tar process |
||
24 | */ |
||
25 | private $process; |
||
26 | |||
27 | /** |
||
28 | * @var resource Tar stream |
||
29 | */ |
||
30 | private $stream; |
||
31 | |||
32 | /** |
||
33 | * @var string Format of the context (stream or tar) |
||
34 | */ |
||
35 | private $format = self::FORMAT_STREAM; |
||
36 | |||
37 | /** |
||
38 | * @param string $directory Directory of context |
||
39 | * @param string $format Format to use when sending the call (stream or tar: string) |
||
40 | */ |
||
41 | 14 | public function __construct($directory, $format = self::FORMAT_STREAM) |
|
42 | { |
||
43 | 14 | $this->directory = $directory; |
|
44 | 14 | $this->format = $format; |
|
45 | 14 | } |
|
46 | |||
47 | /** |
||
48 | * Get directory of Context |
||
49 | * |
||
50 | * @return string |
||
51 | */ |
||
52 | 7 | public function getDirectory() |
|
56 | |||
57 | /** |
||
58 | * Set directory of Context |
||
59 | * |
||
60 | * @param string $directory Targeted directory |
||
61 | */ |
||
62 | public function setDirectory($directory) |
||
66 | |||
67 | /** |
||
68 | * Return content of Dockerfile of this context |
||
69 | * |
||
70 | * @return string Content of dockerfile |
||
71 | */ |
||
72 | 2 | public function getDockerfileContent() |
|
76 | |||
77 | /** |
||
78 | * @return boolean |
||
79 | */ |
||
80 | 4 | public function isStreamed() |
|
84 | |||
85 | /** |
||
86 | * @return resource|string |
||
87 | */ |
||
88 | 4 | public function read() |
|
92 | |||
93 | /** |
||
94 | * Return the context as a tar archive |
||
95 | * |
||
96 | * @throws \Symfony\Component\Process\Exception\ProcessFailedException |
||
97 | * |
||
98 | * @return string Tar content |
||
99 | */ |
||
100 | 1 | public function toTar() |
|
111 | |||
112 | /** |
||
113 | * Return a stream for this context |
||
114 | * |
||
115 | * @return resource Stream resource in memory |
||
116 | */ |
||
117 | 5 | public function toStream() |
|
126 | |||
127 | 14 | public function __destruct() |
|
137 | } |
||
138 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..