forked from hestiacp/hestiacp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathComposerResource.php
More file actions
28 lines (22 loc) · 803 Bytes
/
ComposerResource.php
File metadata and controls
28 lines (22 loc) · 803 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
namespace Hestia\WebApp\Installers\Resources;
use Hestia\System\HestiaApp;
class ComposerResource
{
private $project;
private $folder;
private $appcontext;
public function __construct(HestiaApp $appcontext, $data, $destination)
{
$this->folder = dirname($destination);
$this->project = basename($destination);
$this->appcontext = $appcontext;
if (empty($data['version'])){
$data['version'] = 2;
}
$this->appcontext->runComposer(["create-project", "--no-progress", "--prefer-dist", $data['src'], "-d " . $this->folder, $this->project ], $status, $data['version']);
if($status->code !== 0){
throw new \Exception("Error fetching Composer resource: " . $status->text);
}
}
}