Révision fbb66ca6
Ajouté par Assos Assos il y a presque 5 ans
drupal7/misc/typo3/phar-stream-wrapper/src/Manager.php | ||
---|---|---|
11 | 11 |
* The TYPO3 project - inspiring people to share! |
12 | 12 |
*/ |
13 | 13 |
|
14 |
class Manager implements Assertable |
|
14 |
use TYPO3\PharStreamWrapper\Resolver\PharInvocation; |
|
15 |
use TYPO3\PharStreamWrapper\Resolver\PharInvocationCollection; |
|
16 |
use TYPO3\PharStreamWrapper\Resolver\PharInvocationResolver; |
|
17 |
|
|
18 |
class Manager |
|
15 | 19 |
{ |
16 | 20 |
/** |
17 | 21 |
* @var self |
... | ... | |
23 | 27 |
*/ |
24 | 28 |
private $behavior; |
25 | 29 |
|
30 |
/** |
|
31 |
* @var Resolvable |
|
32 |
*/ |
|
33 |
private $resolver; |
|
34 |
|
|
35 |
/** |
|
36 |
* @var Collectable |
|
37 |
*/ |
|
38 |
private $collection; |
|
39 |
|
|
26 | 40 |
/** |
27 | 41 |
* @param Behavior $behaviour |
42 |
* @param Resolvable $resolver |
|
43 |
* @param Collectable $collection |
|
28 | 44 |
* @return self |
29 | 45 |
*/ |
30 |
public static function initialize(Behavior $behaviour) |
|
31 |
{ |
|
46 |
public static function initialize( |
|
47 |
Behavior $behaviour, |
|
48 |
Resolvable $resolver = null, |
|
49 |
Collectable $collection = null |
|
50 |
) { |
|
32 | 51 |
if (self::$instance === null) { |
33 |
self::$instance = new self($behaviour); |
|
52 |
self::$instance = new self($behaviour, $resolver, $collection);
|
|
34 | 53 |
return self::$instance; |
35 | 54 |
} |
36 | 55 |
throw new \LogicException( |
... | ... | |
67 | 86 |
|
68 | 87 |
/** |
69 | 88 |
* @param Behavior $behaviour |
89 |
* @param Resolvable $resolver |
|
90 |
* @param Collectable $collection |
|
70 | 91 |
*/ |
71 |
private function __construct(Behavior $behaviour) |
|
72 |
{ |
|
92 |
private function __construct( |
|
93 |
Behavior $behaviour, |
|
94 |
Resolvable $resolver = null, |
|
95 |
Collectable $collection = null |
|
96 |
) { |
|
97 |
if ($collection === null) { |
|
98 |
$collection = new PharInvocationCollection(); |
|
99 |
} |
|
100 |
if ($resolver === null) { |
|
101 |
$resolver = new PharInvocationResolver(); |
|
102 |
} |
|
103 |
$this->collection = $collection; |
|
104 |
$this->resolver = $resolver; |
|
73 | 105 |
$this->behavior = $behaviour; |
74 | 106 |
} |
75 | 107 |
|
... | ... | |
82 | 114 |
{ |
83 | 115 |
return $this->behavior->assert($path, $command); |
84 | 116 |
} |
117 |
|
|
118 |
/** |
|
119 |
* @param string $path |
|
120 |
* @param null|int $flags |
|
121 |
* @return null|PharInvocation |
|
122 |
*/ |
|
123 |
public function resolve($path, $flags = null) |
|
124 |
{ |
|
125 |
return $this->resolver->resolve($path, $flags); |
|
126 |
} |
|
127 |
|
|
128 |
/** |
|
129 |
* @return Collectable |
|
130 |
*/ |
|
131 |
public function getCollection() |
|
132 |
{ |
|
133 |
return $this->collection; |
|
134 |
} |
|
85 | 135 |
} |
Formats disponibles : Unified diff
Udpate to 7.67