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