1: <?php
2:
3: namespace PHPixie\Route\Resolvers;
4:
5: class Builder
6: {
7: protected $resolvers;
8: protected $resolverRegistry;
9:
10: public function __construct($resolvers, $resolverRegistry = null)
11: {
12: $this->resolvers = $resolvers;
13: $this->resolverRegistry = $resolverRegistry;
14: }
15:
16: protected function group($configData)
17: {
18: return $this->resolvers->group($this, $configData);
19: }
20:
21: protected function pattern($configData)
22: {
23: return $this->resolvers->pattern($configData);
24: }
25:
26: protected function prefix($configData)
27: {
28: return $this->resolvers->prefix($this, $configData);
29: }
30:
31: protected function mount($configData)
32: {
33: if($this->resolverRegistry === null) {
34: throw new \PHPixie\Route\Exception("Route registry was not specified");
35: }
36:
37: return $this->resolvers->mount($this->resolverRegistry, $configData);
38: }
39:
40: public function buildFromConfig($configData) {
41: $type = $configData->get('type', 'pattern');
42: return $this->$type($configData);
43: }
44: }