| @@ -1,37 +1,119 @@ | ||
| 1 | 1 | #!/usr/bin/env php |
| 2 | 2 | <?php |
| 3 | 3 | |
| 4 | -use tubalmartin\CssMin\Command; | |
| 4 | +/** | |
| 5 | + * Proxy PHP file generated by Composer | |
| 6 | + * | |
| 7 | + * This file includes the referenced bin path (../tubalmartin/cssmin/cssmin) | |
| 8 | + * using a stream wrapper to prevent the shebang from being output on PHP<8 | |
| 9 | + * | |
| 10 | + * @generated | |
| 11 | + */ | |
| 5 | 12 | |
| 6 | -$autoloadPath = null; | |
| 7 | -$autoloadPaths = array( | |
| 8 | - __DIR__ . '/../../autoload.php', | |
| 9 | - __DIR__ . '/../vendor/autoload.php', | |
| 10 | - __DIR__ . '/vendor/autoload.php' | |
| 11 | -); | |
| 13 | +namespace Composer; | |
| 12 | 14 | |
| 13 | -foreach ($autoloadPaths as $file) { | |
| 14 | - if (file_exists($file)) { | |
| 15 | - $autoloadPath = $file; | |
| 16 | - break; | |
| 17 | - } | |
| 18 | -} | |
| 15 | +$GLOBALS['_composer_bin_dir'] = __DIR__; | |
| 16 | +$GLOBALS['_composer_autoload_path'] = __DIR__ . '/..'.'/autoload.php'; | |
| 19 | 17 | |
| 20 | -unset($file); | |
| 21 | -unset($autoloadPaths); | |
| 18 | +if (PHP_VERSION_ID < 80000) { | |
| 19 | + if (!class_exists('Composer\BinProxyWrapper')) { | |
| 20 | + /** | |
| 21 | + * @internal | |
| 22 | + */ | |
| 23 | + final class BinProxyWrapper | |
| 24 | + { | |
| 25 | + private $handle; | |
| 26 | + private $position; | |
| 27 | + private $realpath; | |
| 22 | 28 | |
| 23 | -if (is_null($autoloadPath)) { | |
| 24 | - fwrite( | |
| 25 | - STDERR, | |
| 26 | - 'You need to set up the project dependencies using Composer:' . PHP_EOL . PHP_EOL . | |
| 27 | - ' composer install' . PHP_EOL . PHP_EOL . | |
| 28 | - 'You can learn all about Composer on https://getcomposer.org/.' . PHP_EOL | |
| 29 | - ); | |
| 30 | - die(1); | |
| 31 | -} | |
| 29 | + public function stream_open($path, $mode, $options, &$opened_path) | |
| 30 | + { | |
| 31 | + // get rid of phpvfscomposer:// prefix for __FILE__ & __DIR__ resolution | |
| 32 | + $opened_path = substr($path, 17); | |
| 33 | + $this->realpath = realpath($opened_path) ?: $opened_path; | |
| 34 | + $opened_path = $this->realpath; | |
| 35 | + $this->handle = fopen($this->realpath, $mode); | |
| 36 | + $this->position = 0; | |
| 32 | 37 | |
| 33 | -require $autoloadPath; | |
| 38 | + return (bool) $this->handle; | |
| 39 | + } | |
| 34 | 40 | |
| 35 | -unset($autoloadPath); | |
| 41 | + public function stream_read($count) | |
| 42 | + { | |
| 43 | + $data = fread($this->handle, $count); | |
| 36 | 44 | |
| 37 | -Command::main(); | |
| 45 | + if ($this->position === 0) { | |
| 46 | + $data = preg_replace('{^#!.*\r?\n}', '', $data); | |
| 47 | + } | |
| 48 | + | |
| 49 | + $this->position += strlen($data); | |
| 50 | + | |
| 51 | + return $data; | |
| 52 | + } | |
| 53 | + | |
| 54 | + public function stream_cast($castAs) | |
| 55 | + { | |
| 56 | + return $this->handle; | |
| 57 | + } | |
| 58 | + | |
| 59 | + public function stream_close() | |
| 60 | + { | |
| 61 | + fclose($this->handle); | |
| 62 | + } | |
| 63 | + | |
| 64 | + public function stream_lock($operation) | |
| 65 | + { | |
| 66 | + return $operation ? flock($this->handle, $operation) : true; | |
| 67 | + } | |
| 68 | + | |
| 69 | + public function stream_seek($offset, $whence) | |
| 70 | + { | |
| 71 | + if (0 === fseek($this->handle, $offset, $whence)) { | |
| 72 | + $this->position = ftell($this->handle); | |
| 73 | + return true; | |
| 74 | + } | |
| 75 | + | |
| 76 | + return false; | |
| 77 | + } | |
| 78 | + | |
| 79 | + public function stream_tell() | |
| 80 | + { | |
| 81 | + return $this->position; | |
| 82 | + } | |
| 83 | + | |
| 84 | + public function stream_eof() | |
| 85 | + { | |
| 86 | + return feof($this->handle); | |
| 87 | + } | |
| 88 | + | |
| 89 | + public function stream_stat() | |
| 90 | + { | |
| 91 | + return array(); | |
| 92 | + } | |
| 93 | + | |
| 94 | + public function stream_set_option($option, $arg1, $arg2) | |
| 95 | + { | |
| 96 | + return true; | |
| 97 | + } | |
| 98 | + | |
| 99 | + public function url_stat($path, $flags) | |
| 100 | + { | |
| 101 | + $path = substr($path, 17); | |
| 102 | + if (file_exists($path)) { | |
| 103 | + return stat($path); | |
| 104 | + } | |
| 105 | + | |
| 106 | + return false; | |
| 107 | + } | |
| 108 | + } | |
| 109 | + } | |
| 110 | + | |
| 111 | + if ( | |
| 112 | + (function_exists('stream_get_wrappers') && in_array('phpvfscomposer', stream_get_wrappers(), true)) | |
| 113 | + || (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper')) | |
| 114 | + ) { | |
| 115 | + return include("phpvfscomposer://" . __DIR__ . '/..'.'/tubalmartin/cssmin/cssmin'); | |
| 116 | + } | |
| 117 | +} | |
| 118 | + | |
| 119 | +return include __DIR__ . '/..'.'/tubalmartin/cssmin/cssmin'; | |