Skip to content

Commit

Permalink
Remove the isPublic functionality.
Browse files Browse the repository at this point in the history
  • Loading branch information
tburry committed Mar 19, 2017
1 parent af87cb9 commit 99b7787
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 25 deletions.
9 changes: 1 addition & 8 deletions library/Garden/Web/ResourceRoute.php
Expand Up @@ -192,8 +192,7 @@ private function findMethod($controller, $methodName) {
$regex = '`^(get|post|patch|put|options|delete)(_|$)`i';

// Getters and setters aren't found.
if (!(preg_match($regex, $methodName) || strcasecmp($methodName, 'index') === 0)
&& !(method_exists($controller, 'isPublic') && $controller->isPublic($methodName))) {
if (!(preg_match($regex, $methodName) || strcasecmp($methodName, 'index') === 0)) {
return null;
}

Expand Down Expand Up @@ -361,16 +360,10 @@ private function getControllerMethodNames($method, $pathArgs) {
if (isset($pathArgs[0])) {
$name = lcfirst($this->filterName($pathArgs[0]));
$result[] = ["{$method}_{$name}", 0];
if (!in_array($name, self::$specialMethods)) {
$result[] = [$name, 0];
}
}
if (isset($pathArgs[1])) {
$name = lcfirst($this->filterName($pathArgs[1]));
$result[] = ["{$method}_{$name}", 1];
if (!in_array($name, self::$specialMethods)) {
$result[] = [$name, 1];
}
}

$result[] = [$method, null];
Expand Down
9 changes: 0 additions & 9 deletions tests/Library/Garden/Web/ResourceRouteTest.php
Expand Up @@ -164,15 +164,6 @@ public function testIndexProtection() {
$this->assertNull($route->match(new Request('/discussions/index_foo')));
}

/**
* Controllers can publicize methods with isPublic().
*/
public function testIsPublic() {
$route = $this->createRoute();

$this->assertNotNull($route->match(new Request('/discussions/i-am-public')));
}

/**
* A path parameter should be filled with the remaining path.
*
Expand Down
8 changes: 0 additions & 8 deletions tests/fixtures/src/DiscussionsController.php
Expand Up @@ -84,14 +84,6 @@ public function getSomething() {
public function setSomething($val) {
}

public function iAmPublic() {

}

public function isPublic($method) {
return strcasecmp($method, 'iAmPublic') === 0;
}

public function post_noMap($query, $body, $data) {

}
Expand Down

0 comments on commit 99b7787

Please sign in to comment.