1 | <?php |
||
41 | class PackPhar extends BaseTask implements PrintedInterface, ProgressIndicatorAwareInterface |
||
42 | { |
||
43 | /** |
||
44 | * @var \Phar |
||
45 | */ |
||
46 | protected $phar; |
||
47 | |||
48 | /** |
||
49 | * @var null|string |
||
50 | */ |
||
51 | protected $compileDir = null; |
||
52 | |||
53 | /** |
||
54 | * @var string |
||
55 | */ |
||
56 | protected $filename; |
||
57 | |||
58 | /** |
||
59 | * @var bool |
||
60 | */ |
||
61 | protected $compress = false; |
||
62 | |||
63 | protected $stub; |
||
64 | |||
65 | protected $bin; |
||
66 | |||
67 | /** |
||
68 | * @var string |
||
69 | */ |
||
70 | protected $stubTemplate = <<<EOF |
||
71 | #!/usr/bin/env php |
||
72 | <?php |
||
73 | Phar::mapPhar(); |
||
74 | %s |
||
75 | __HALT_COMPILER(); |
||
76 | EOF; |
||
77 | |||
78 | /** |
||
79 | * @var string[] |
||
80 | */ |
||
81 | protected $files = []; |
||
82 | |||
83 | /** |
||
84 | * {@inheritdoc} |
||
85 | */ |
||
86 | public function getPrinted() |
||
90 | |||
91 | /** |
||
92 | * @param string $filename |
||
93 | */ |
||
94 | public function __construct($filename) |
||
103 | |||
104 | /** |
||
105 | * @param bool $compress |
||
106 | * |
||
107 | * @return $this |
||
108 | */ |
||
109 | public function compress($compress = true) |
||
114 | |||
115 | /** |
||
116 | * @param string $stub |
||
117 | * |
||
118 | * @return $this |
||
119 | */ |
||
120 | public function stub($stub) |
||
125 | |||
126 | /** |
||
127 | * {@inheritdoc} |
||
128 | */ |
||
129 | public function progressIndicatorSteps() |
||
135 | |||
136 | /** |
||
137 | * {@inheritdoc} |
||
138 | */ |
||
139 | public function run() |
||
168 | |||
169 | /** |
||
170 | * @param string $path |
||
171 | * @param string $file |
||
172 | * |
||
173 | * @return $this |
||
174 | */ |
||
175 | public function addStripped($path, $file) |
||
180 | |||
181 | /** |
||
182 | * @param string $path |
||
183 | * @param string $file |
||
184 | * |
||
185 | * @return $this |
||
186 | */ |
||
187 | public function addFile($path, $file) |
||
192 | |||
193 | /** |
||
194 | * @param \Symfony\Component\Finder\SplFileInfo[] $files |
||
195 | */ |
||
196 | public function addFiles($files) |
||
202 | |||
203 | /** |
||
204 | * @param string $file |
||
205 | * |
||
206 | * @return $this |
||
207 | */ |
||
208 | public function executable($file) |
||
217 | |||
218 | /** |
||
219 | * Strips whitespace from source. Taken from composer |
||
220 | * |
||
221 | * @param string $source |
||
222 | * |
||
223 | * @return string |
||
224 | */ |
||
225 | private function stripWhitespace($source) |
||
253 | } |
||
254 |
If you suppress an error, we recommend checking for the error condition explicitly: