1 | <?php |
||
27 | abstract class AbstractBinaryAdapter extends AbstractAdapter implements BinaryAdapterInterface |
||
28 | { |
||
29 | /** |
||
30 | * The parser to use to parse command output |
||
31 | * |
||
32 | * @var ParserInterface |
||
33 | */ |
||
34 | protected $parser; |
||
35 | |||
36 | /** |
||
37 | * The deflator process builder factory to use to build binary command line |
||
38 | * |
||
39 | * @var ProcessBuilderFactoryInterface |
||
40 | */ |
||
41 | protected $deflator; |
||
42 | |||
43 | /** |
||
44 | * The inflator process builder factory to use to build binary command line |
||
45 | * |
||
46 | * @var ProcessBuilderFactoryInterface |
||
47 | */ |
||
48 | protected $inflator; |
||
49 | |||
50 | /** |
||
51 | * Constructor |
||
52 | * |
||
53 | * @param ParserInterface $parser An output parser |
||
54 | * @param ResourceManager $manager A resource manager |
||
55 | * @param ProcessBuilderFactoryInterface $inflator A process builder factory for the inflator binary |
||
56 | * @param ProcessBuilderFactoryInterface $deflator A process builder factory for the deflator binary |
||
57 | */ |
||
58 | public function __construct( |
||
69 | |||
70 | /** |
||
71 | * @inheritdoc |
||
72 | */ |
||
73 | public function getParser() |
||
77 | |||
78 | /** |
||
79 | * @inheritdoc |
||
80 | */ |
||
81 | public function setParser(ParserInterface $parser) |
||
87 | |||
88 | /** |
||
89 | * @inheritdoc |
||
90 | */ |
||
91 | public function getDeflator() |
||
95 | |||
96 | /** |
||
97 | * @inheritdoc |
||
98 | */ |
||
99 | public function getInflator() |
||
103 | |||
104 | /** |
||
105 | * @inheritdoc |
||
106 | */ |
||
107 | public function setDeflator(ProcessBuilderFactoryInterface $processBuilder) |
||
113 | |||
114 | public function setInflator(ProcessBuilderFactoryInterface $processBuilder) |
||
120 | |||
121 | /** |
||
122 | * @inheritdoc |
||
123 | */ |
||
124 | public function getInflatorVersion() |
||
130 | |||
131 | /** |
||
132 | * @inheritdoc |
||
133 | */ |
||
134 | public function getDeflatorVersion() |
||
140 | |||
141 | /** |
||
142 | * Returns a new instance of the invoked adapter |
||
143 | * |
||
144 | * @param ExecutableFinder $finder |
||
145 | * @param ResourceManager $manager |
||
146 | * @param string|null $inflatorBinaryName The inflator binary name to use |
||
147 | * @param string|null $deflatorBinaryName The deflator binary name to use |
||
148 | * |
||
149 | * @return AbstractBinaryAdapter |
||
150 | */ |
||
151 | public static function newInstance( |
||
181 | |||
182 | private static function findABinary($wish, array $defaults, ExecutableFinder $finder) |
||
197 | |||
198 | /** |
||
199 | * Adds files to argument list |
||
200 | * |
||
201 | * @param MemberInterface[]|\SplFileInfo[]|string[] $files An array of files |
||
202 | * @param ProcessBuilder $builder A Builder instance |
||
203 | * |
||
204 | * @return bool |
||
205 | */ |
||
206 | protected function addBuilderFileArgument(array $files, ProcessBuilder $builder) |
||
221 | |||
222 | protected function createResource($path) |
||
226 | |||
227 | /** |
||
228 | * Fetch the inflator version after having check that the current adapter is supported |
||
229 | * |
||
230 | * @return string |
||
231 | */ |
||
232 | abstract protected function doGetInflatorVersion(); |
||
233 | |||
234 | /** |
||
235 | * Fetch the Deflator version after having check that the current adapter is supported |
||
236 | * |
||
237 | * @return string |
||
238 | */ |
||
239 | abstract protected function doGetDeflatorVersion(); |
||
240 | } |
||
241 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.