-
Notifications
You must be signed in to change notification settings - Fork 3
/
Framework.php
110 lines (97 loc) · 2.38 KB
/
Framework.php
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<?php
namespace Skeletor\Frameworks;
use League\Flysystem\Filesystem;
use League\Flysystem\MountManager;
use Skeletor\Exceptions\FailedFilesystem;
use Skeletor\Manager\ComposerManager;
abstract class Framework implements FrameworkInterface
{
protected $projectFilesystem;
protected $composerManager;
protected $mountManager;
protected $installSlug;
protected $options;
protected $version;
protected $paths;
protected $name;
/**
* Framework constructor.
* @param ComposerManager $composerManager
* @param Filesystem $projectFilesystem
* @param MountManager $mountManager
* @param array $options
*/
public function __construct(ComposerManager $composerManager, Filesystem $projectFilesystem, MountManager $mountManager, array $options)
{
$this->projectFilesystem = $projectFilesystem;
$this->composerManager = $composerManager;
$this->mountManager = $mountManager;
$this->options = $options;
$this->setup();
}
/**
* @return string
*/
public function getInstallSlug()
{
return $this->installSlug;
}
/**
* @param string $installSlug
*/
public function setInstallSlug(string $installSlug)
{
$this->installSlug = $installSlug;
}
/**
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* @param string $name
*/
public function setName(string $name)
{
$this->name = $name;
}
/**
* @return string
*/
public function getVersion()
{
return $this->version;
}
/**
* @param string $version
*/
public function setVersion(string $version)
{
$this->version = $version;
}
/**
* @param string $path
* @return string
*/
public function getPath(string $path)
{
if(array_key_exists($path, $this->paths) === false){
throw new FailedFilesystem("Couldn't find {$path}");
}
return $this->paths[$path];
}
/**
* @param array $paths
*/
public function setPaths(array $paths)
{
$this->paths = $paths;
}
public function install()
{
$command = $this->composerManager->prepareFrameworkCommand($this->getInstallSlug(), $this->getVersion());
$this->composerManager->runCommand($command);
}
}