1 | <?php |
||
10 | class Composer extends Command |
||
11 | { |
||
12 | /** |
||
13 | * The console command name. |
||
14 | * |
||
15 | * @var string |
||
16 | */ |
||
17 | protected $name = 'composer'; |
||
18 | |||
19 | /** |
||
20 | * The console command description. |
||
21 | * |
||
22 | * @var string |
||
23 | */ |
||
24 | protected $description = 'composer'; |
||
25 | |||
26 | /** |
||
27 | * $files. |
||
28 | * |
||
29 | * @var \Illuminate\Filesystem\Filesystem |
||
30 | */ |
||
31 | protected $files; |
||
32 | |||
33 | /** |
||
34 | * __construct. |
||
35 | * |
||
36 | * @param \Illuminate\Filesystem\Filesystem $files |
||
37 | */ |
||
38 | public function __construct(Filesystem $files) |
||
44 | |||
45 | /** |
||
46 | * Handle the command. |
||
47 | * |
||
48 | * @throws \InvalidArgumentException |
||
49 | */ |
||
50 | public function handle() |
||
65 | |||
66 | /** |
||
67 | * install. |
||
68 | */ |
||
69 | protected function install() |
||
89 | |||
90 | /** |
||
91 | * init. |
||
92 | */ |
||
93 | protected function init() |
||
94 | { |
||
95 | error_reporting(-1); |
||
96 | |||
97 | // $xdebug = new \Composer\XdebugHandler($this->getOutput()); |
||
98 | // $xdebug->check(); |
||
99 | // unset($xdebug); |
||
100 | if (function_exists('ini_set')) { |
||
101 | @ini_set('display_errors', 1); |
||
102 | $memoryInBytes = function ($value) { |
||
103 | $unit = strtolower(substr($value, -1, 1)); |
||
104 | $value = (int) $value; |
||
105 | switch ($unit) { |
||
106 | case 'g': |
||
107 | $value *= 1024; |
||
108 | // no break (cumulative multiplier) |
||
109 | case 'm': |
||
110 | $value *= 1024; |
||
111 | // no break (cumulative multiplier) |
||
112 | case 'k': |
||
113 | $value *= 1024; |
||
114 | } |
||
115 | |||
116 | return $value; |
||
117 | }; |
||
118 | $memoryLimit = trim(ini_get('memory_limit')); |
||
119 | // Increase memory_limit if it is lower than 1GB |
||
120 | if ($memoryLimit != -1 && $memoryInBytes($memoryLimit) < 1024 * 1024 * 1024) { |
||
121 | @ini_set('memory_limit', '1G'); |
||
122 | } |
||
123 | unset($memoryInBytes, $memoryLimit); |
||
124 | } |
||
125 | |||
126 | if (defined('STDIN') === false) { |
||
127 | define('STDIN', fopen('php://stdin', 'r')); |
||
128 | } |
||
129 | |||
130 | $basePath = $this->getLaravel()->basePath(); |
||
131 | chdir($basePath); |
||
132 | } |
||
133 | |||
134 | /** |
||
135 | * Get the console command options. |
||
136 | * |
||
137 | * @return array |
||
138 | */ |
||
139 | protected function getOptions() |
||
145 | } |
||
146 |