1: <?php
2:
3: namespace PHPixie\Route\Translator;
4:
5: class Match
6: {
7: protected $resolverPath;
8: protected $attributes;
9:
10: public function __construct($attributes = array(), $resolverPath = null)
11: {
12: $this->attributes = $attributes;
13: $this->resolverPath = $resolverPath;
14: }
15:
16: public function resolverPath()
17: {
18: return $this->resolverPath;
19: }
20:
21: public function attributes()
22: {
23: return $this->attributes;
24: }
25:
26: public function popResolverPath()
27: {
28: if($this->resolverPath === null) {
29: throw new \PHPixie\Route\Exception("Route path is empty");
30: }
31:
32: $parts = explode('.', $this->resolverPath, 2);
33: if(count($parts) === 1) {
34: $this->resolverPath = null;
35: return $parts[0];
36: }
37:
38: $this->resolverPath = $parts[1];
39: return $parts[0];
40: }
41:
42: public function prependResolverPath($resolverPath)
43: {
44: if($this->resolverPath !== null) {
45: $this->resolverPath = $resolverPath.'.'.$this->resolverPath;
46: }else{
47: $this->resolverPath = $resolverPath;
48: }
49: }
50:
51: public function prependAttributes($attributes)
52: {
53: $this->attributes = array_merge(
54: $attributes,
55: $this->attributes
56: );
57: }
58: }