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