From 26681eb1c8ba35a0129ad47d4f0f03af9c2baa45 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Mon, 15 May 2017 12:27:51 -0500 Subject: [PATCH] rename method --- src/Illuminate/Http/Request.php | 7 +++---- tests/Http/HttpRequestTest.php | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/Illuminate/Http/Request.php b/src/Illuminate/Http/Request.php index b7c72cb5970d..ce17897aba9c 100644 --- a/src/Illuminate/Http/Request.php +++ b/src/Illuminate/Http/Request.php @@ -193,15 +193,14 @@ public function is() } /** - * Check if route name matches string. + * Check if the route name matches the given string. * * @param string $name - * * @return bool */ - public function isRouteName($name) + public function routeIs($name) { - return $this->route()->getName() === $name; + return $this->route() && $this->route()->getName() === $name; } /** diff --git a/tests/Http/HttpRequestTest.php b/tests/Http/HttpRequestTest.php index 673e0450c5b8..201b3f7f59f4 100644 --- a/tests/Http/HttpRequestTest.php +++ b/tests/Http/HttpRequestTest.php @@ -168,8 +168,8 @@ public function testIsRouteNameMethod() return $route; }); - $this->assertTrue($request->isRouteName('foo.bar')); - $this->assertFalse($request->isRouteName('foo.foo')); + $this->assertTrue($request->routeIs('foo.bar')); + $this->assertFalse($request->routeIs('foo.foo')); } public function testAjaxMethod()