1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Copyright MediaCT. All rights reserved. |
4
|
|
|
* https://www.mediact.nl |
5
|
|
|
*/ |
6
|
|
|
namespace Mediact\CodingStandard\PhpStorm; |
7
|
|
|
|
8
|
|
|
use Composer\Composer; |
9
|
|
|
use Composer\IO\IOInterface; |
10
|
|
|
|
11
|
|
|
class Environment implements EnvironmentInterface |
12
|
|
|
{ |
13
|
|
|
/** |
14
|
|
|
* @var FilesystemInterface |
15
|
|
|
*/ |
16
|
|
|
private $ideConfigFilesystem; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* @var FilesystemInterface |
20
|
|
|
*/ |
21
|
|
|
private $defaultsFilesystem; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* @var FilesystemInterface |
25
|
|
|
*/ |
26
|
|
|
private $projectFilesystem; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @var IOInterface |
30
|
|
|
*/ |
31
|
|
|
private $inputOutput; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @var Composer |
35
|
|
|
*/ |
36
|
|
|
private $composer; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* Constructor. |
40
|
|
|
* |
41
|
|
|
* @param FilesystemInterface $ideConfigFilesystem |
42
|
|
|
* @param FilesystemInterface $defaultsFilesystem |
43
|
|
|
* @param FilesystemInterface $projectFilesystem |
44
|
|
|
* @param IOInterface $inputOutput |
45
|
|
|
* @param Composer $composer |
46
|
|
|
*/ |
47
|
|
|
public function __construct( |
48
|
|
|
FilesystemInterface $ideConfigFilesystem, |
49
|
|
|
FilesystemInterface $defaultsFilesystem, |
50
|
|
|
FilesystemInterface $projectFilesystem, |
51
|
|
|
IOInterface $inputOutput, |
52
|
|
|
Composer $composer |
53
|
|
|
) { |
54
|
|
|
$this->ideConfigFilesystem = $ideConfigFilesystem; |
55
|
|
|
$this->defaultsFilesystem = $defaultsFilesystem; |
56
|
|
|
$this->projectFilesystem = $projectFilesystem; |
57
|
|
|
$this->inputOutput = $inputOutput; |
58
|
|
|
$this->composer = $composer; |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* Get a filesystem for the IDE configuration. |
63
|
|
|
* |
64
|
|
|
* @return FilesystemInterface |
65
|
|
|
*/ |
66
|
|
|
public function getIdeConfigFilesystem(): FilesystemInterface |
67
|
|
|
{ |
68
|
|
|
return $this->ideConfigFilesystem; |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* Get a filesystem for the default configuration. |
73
|
|
|
* |
74
|
|
|
* @return FilesystemInterface |
75
|
|
|
*/ |
76
|
|
|
public function getDefaultsFilesystem(): FilesystemInterface |
77
|
|
|
{ |
78
|
|
|
return $this->defaultsFilesystem; |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* Get a filesystem for the project. |
83
|
|
|
* |
84
|
|
|
* @return FilesystemInterface |
85
|
|
|
*/ |
86
|
|
|
public function getProjectFilesystem(): FilesystemInterface |
87
|
|
|
{ |
88
|
|
|
return $this->projectFilesystem; |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* Get the input and output helper. |
93
|
|
|
* |
94
|
|
|
* @return IOInterface |
95
|
|
|
*/ |
96
|
|
|
public function getInputOutput(): IOInterface |
97
|
|
|
{ |
98
|
|
|
return $this->inputOutput; |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
/** |
102
|
|
|
* Get the composer instance. |
103
|
|
|
* |
104
|
|
|
* @return Composer |
105
|
|
|
*/ |
106
|
|
|
public function getComposer(): Composer |
107
|
|
|
{ |
108
|
|
|
return $this->composer; |
109
|
|
|
} |
110
|
|
|
} |
111
|
|
|
|