Skip to content

Commit 4887551

Browse files
committed
Let getRoutable only fetch public methods
1 parent 41dea01 commit 4887551

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

src/Illuminate/Routing/ControllerInspector.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ public function getRoutable($controller, $prefix)
3030
// To get the routable methods, we will simply spin through all methods on the
3131
// controller instance checking to see if it belongs to the given class and
3232
// is a publicly routable method. If so, we will add it to this listings.
33-
foreach ($reflection->getMethods() as $method)
33+
foreach ($reflection->getMethods(ReflectionMethod::IS_PUBLIC) as $method)
3434
{
35-
if ($this->isRoutable($method, $reflection->name))
35+
if ($this->isRoutable($method))
3636
{
3737
$data = $this->getMethodData($method, $prefix);
3838

@@ -69,7 +69,7 @@ public function isRoutable(ReflectionMethod $method)
6969
{
7070
if ($method->class == 'Illuminate\Routing\Controller') return false;
7171

72-
return $method->isPublic() && starts_with($method->name, $this->verbs);
72+
return starts_with($method->name, $this->verbs);
7373
}
7474

7575
/**

tests/Routing/RoutingControllerInspectorTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,13 @@ public function testMethodsAreCorrectWhenControllerIsNamespaced()
3232

3333
class RoutingControllerInspectorBaseStub {
3434
public function getBreeze() {}
35+
private function patchTest() {}
3536
}
3637

3738
class RoutingControllerInspectorStub extends RoutingControllerInspectorBaseStub {
3839
public function getIndex() {}
3940
public function getFooBar() {}
4041
public function postBaz() {}
4142
protected function getBoom() {}
43+
private function putTest() {}
4244
}

0 commit comments

Comments
 (0)