1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the puli/cli package. |
5
|
|
|
* |
6
|
|
|
* (c) Bernhard Schussek <[email protected]> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace Puli\Cli\Proxy; |
13
|
|
|
|
14
|
|
|
use Puli\Manager\Api\Container; |
15
|
|
|
use Puli\Manager\Api\Repository\PathMapping; |
16
|
|
|
use Puli\Manager\Api\Repository\RepositoryManager; |
17
|
|
|
use Webmozart\Expression\Expression; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* Proxies a lazily fetched repository manager. |
21
|
|
|
* |
22
|
|
|
* @since 1.0 |
23
|
|
|
* |
24
|
|
|
* @author Bernhard Schussek <[email protected]> |
25
|
|
|
*/ |
26
|
|
|
class RepositoryManagerProxy implements RepositoryManager |
27
|
|
|
{ |
28
|
|
|
/** |
29
|
|
|
* @var Container |
30
|
|
|
*/ |
31
|
|
|
private $puli; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* Creates the proxy. |
35
|
|
|
* |
36
|
|
|
* @param Container $puli The service locator to fetch the actual repository |
37
|
|
|
* manager from |
38
|
|
|
*/ |
39
|
|
|
public function __construct(Container $puli) |
40
|
|
|
{ |
41
|
|
|
$this->puli = $puli; |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* {@inheritdoc} |
46
|
|
|
*/ |
47
|
|
|
public function getContext() |
48
|
|
|
{ |
49
|
|
|
return $this->puli->getRepositoryManager()->getContext(); |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* {@inheritdoc} |
54
|
|
|
*/ |
55
|
|
|
public function getRepository() |
56
|
|
|
{ |
57
|
|
|
return $this->puli->getRepositoryManager()->getRepository(); |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* {@inheritdoc} |
62
|
|
|
*/ |
63
|
|
|
public function addRootPathMapping(PathMapping $mapping, $flags = 0) |
64
|
|
|
{ |
65
|
|
|
$this->puli->getRepositoryManager()->addRootPathMapping($mapping, $flags); |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* {@inheritdoc} |
70
|
|
|
*/ |
71
|
|
|
public function removeRootPathMapping($repositoryPath) |
72
|
|
|
{ |
73
|
|
|
$this->puli->getRepositoryManager()->removeRootPathMapping($repositoryPath); |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* {@inheritdoc} |
78
|
|
|
*/ |
79
|
|
|
public function removeRootPathMappings(Expression $expr) |
80
|
|
|
{ |
81
|
|
|
$this->puli->getRepositoryManager()->removeRootPathMappings($expr); |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* {@inheritdoc} |
86
|
|
|
*/ |
87
|
|
|
public function clearRootPathMappings() |
88
|
|
|
{ |
89
|
|
|
$this->puli->getRepositoryManager()->clearRootPathMappings(); |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* {@inheritdoc} |
94
|
|
|
*/ |
95
|
|
|
public function getRootPathMapping($repositoryPath) |
96
|
|
|
{ |
97
|
|
|
return $this->puli->getRepositoryManager()->getRootPathMapping($repositoryPath); |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* {@inheritdoc} |
102
|
|
|
*/ |
103
|
|
|
public function findRootPathMappings(Expression $expr) |
104
|
|
|
{ |
105
|
|
|
return $this->puli->getRepositoryManager()->findRootPathMappings($expr); |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* {@inheritdoc} |
110
|
|
|
*/ |
111
|
|
|
public function getRootPathMappings() |
112
|
|
|
{ |
113
|
|
|
return $this->puli->getRepositoryManager()->getRootPathMappings(); |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
/** |
117
|
|
|
* {@inheritdoc} |
118
|
|
|
*/ |
119
|
|
|
public function hasRootPathMapping($repositoryPath) |
120
|
|
|
{ |
121
|
|
|
return $this->puli->getRepositoryManager()->hasRootPathMapping($repositoryPath); |
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
/** |
125
|
|
|
* {@inheritdoc} |
126
|
|
|
*/ |
127
|
|
|
public function hasRootPathMappings(Expression $expr = null) |
128
|
|
|
{ |
129
|
|
|
return $this->puli->getRepositoryManager()->hasRootPathMappings($expr); |
130
|
|
|
} |
131
|
|
|
|
132
|
|
|
/** |
133
|
|
|
* {@inheritdoc} |
134
|
|
|
*/ |
135
|
|
|
public function getPathMapping($repositoryPath, $moduleName) |
136
|
|
|
{ |
137
|
|
|
return $this->puli->getRepositoryManager()->getPathMapping($repositoryPath, $moduleName); |
138
|
|
|
} |
139
|
|
|
|
140
|
|
|
/** |
141
|
|
|
* {@inheritdoc} |
142
|
|
|
*/ |
143
|
|
|
public function getPathMappings() |
144
|
|
|
{ |
145
|
|
|
return $this->puli->getRepositoryManager()->getPathMappings(); |
146
|
|
|
} |
147
|
|
|
|
148
|
|
|
/** |
149
|
|
|
* {@inheritdoc} |
150
|
|
|
*/ |
151
|
|
|
public function findPathMappings(Expression $expr) |
152
|
|
|
{ |
153
|
|
|
return $this->puli->getRepositoryManager()->findPathMappings($expr); |
154
|
|
|
} |
155
|
|
|
|
156
|
|
|
/** |
157
|
|
|
* {@inheritdoc} |
158
|
|
|
*/ |
159
|
|
|
public function hasPathMapping($repositoryPath, $moduleName) |
160
|
|
|
{ |
161
|
|
|
return $this->puli->getRepositoryManager()->hasPathMapping($repositoryPath, $moduleName); |
162
|
|
|
} |
163
|
|
|
|
164
|
|
|
/** |
165
|
|
|
* {@inheritdoc} |
166
|
|
|
*/ |
167
|
|
|
public function hasPathMappings(Expression $expr = null) |
168
|
|
|
{ |
169
|
|
|
return $this->puli->getRepositoryManager()->hasPathMappings($expr); |
170
|
|
|
} |
171
|
|
|
|
172
|
|
|
/** |
173
|
|
|
* {@inheritdoc} |
174
|
|
|
*/ |
175
|
|
|
public function getPathConflicts() |
176
|
|
|
{ |
177
|
|
|
return $this->puli->getRepositoryManager()->getPathConflicts(); |
178
|
|
|
} |
179
|
|
|
|
180
|
|
|
/** |
181
|
|
|
* {@inheritdoc} |
182
|
|
|
*/ |
183
|
|
|
public function buildRepository() |
184
|
|
|
{ |
185
|
|
|
$this->puli->getRepositoryManager()->buildRepository(); |
186
|
|
|
} |
187
|
|
|
|
188
|
|
|
/** |
189
|
|
|
* {@inheritdoc} |
190
|
|
|
*/ |
191
|
|
|
public function clearRepository() |
192
|
|
|
{ |
193
|
|
|
$this->puli->getRepositoryManager()->clearRepository(); |
194
|
|
|
} |
195
|
|
|
} |
196
|
|
|
|