Skip to content

Commit f853970

Browse files
authored
Merge pull request #27 from wollanup/develop
Add some methods in RouteMapAbstract.php
2 parents 3f98be7 + 05cd665 commit f853970

File tree

2 files changed

+38
-16
lines changed

2 files changed

+38
-16
lines changed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
},
2222
"require": {
2323
"propel/propel": "~2.0@dev",
24-
"wollanup/php-api-rest-interfaces": "1.1.7",
24+
"wollanup/php-api-rest-interfaces": "^1.1.9",
2525
"wollanup/php-api-rest-propel-behavior": "^1.1",
26-
"wollanup/php-api-rest-service-request": "^1.0",
26+
"wollanup/php-api-rest-service-request": "^1.0.1",
2727
"wollanup/php-api-rest-utils": "^1.1",
2828
"crell/api-problem": "^2.0",
2929
"akrabat/rka-content-type-renderer": "^0.7.3"

src/RouteMap/RouteMapAbstract.php

Lines changed: 36 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ abstract class RouteMapAbstract extends DataIterator implements RouteMapInterfac
3434
* @var ContainerInterface
3535
*/
3636
protected $container;
37+
/**
38+
* @var bool
39+
*/
40+
protected $deprecated = false;
3741
/**
3842
* @var string
3943
*/
@@ -62,6 +66,16 @@ final public function __construct(ContainerInterface $container)
6266
$this->initialize();
6367
}
6468

69+
/**
70+
* @inheritdoc
71+
*/
72+
public function deprecated()
73+
{
74+
$this->deprecated = true;
75+
76+
return $this;
77+
}
78+
6579
/**
6680
* @inheritdoc
6781
*/
@@ -86,6 +100,28 @@ public function getPackage()
86100
return ($this->isSubResourceOfPackage()) ? $this->packageName : $this->resourceName;
87101
}
88102

103+
/**
104+
* @return string
105+
*/
106+
public function getResource()
107+
{
108+
return $this->resourceName;
109+
}
110+
111+
public function hasPackage()
112+
{
113+
return null !== $this->packageName;
114+
}
115+
116+
public function isSubResourceOfPackage()
117+
{
118+
if (!$this->hasPackage()) {
119+
return false;
120+
}
121+
122+
return $this->resourceName !== $this->packageName;
123+
}
124+
89125
final public function registerRoutes(RouterInterface $router)
90126
{
91127
foreach ($this->data as $Route) {
@@ -199,20 +235,6 @@ final protected function put($pattern)
199235
return $this->add(Route::PUT, $pattern);
200236
}
201237

202-
private function hasPackage()
203-
{
204-
return null !== $this->packageName;
205-
}
206-
207-
private function isSubResourceOfPackage()
208-
{
209-
if (!$this->hasPackage()) {
210-
return false;
211-
}
212-
213-
return $this->resourceName !== $this->packageName;
214-
}
215-
216238
/**
217239
* @param $routeName
218240
*

0 commit comments

Comments
 (0)