1: <?php
2:
3: namespace PHPixie\Route\Resolvers\Resolver;
4:
5: class Mount implements \PHPixie\Route\Resolvers\Resolver
6: {
7: protected $resolverRegistry;
8: protected $configData;
9:
10: protected $resolver;
11:
12: public function __construct($resolverRegistry, $configData)
13: {
14: $this->resolverRegistry = $resolverRegistry;
15: $this->configData = $configData;
16: }
17:
18: public function resolver()
19: {
20: if($this->resolver === null) {
21: $name = $this->configData->getRequired('name');
22: $this->resolver = $this->resolverRegistry->get($name);
23: }
24:
25: return $this->resolver;
26: }
27:
28: public function match($segment)
29: {
30: return $this->resolver()->match($segment);
31: }
32:
33: public function generate($match, $withHost = false)
34: {
35: return $this->resolver()->generate($match, $withHost);
36: }
37: }