Skip to content

Commit

Permalink
Use variadic in is() and fullUrlIs() methods (#19334)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lloople authored and taylorotwell committed May 24, 2017
1 parent d383fdb commit 0b3faab
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/Illuminate/Http/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,12 @@ public function segments()
/**
* Determine if the current request URI matches a pattern.
*
* @param dynamic $patterns
* @return bool
*/
public function is()
public function is(...$patterns)
{
foreach (func_get_args() as $pattern) {
foreach ($patterns as $pattern) {
if (Str::is($pattern, $this->decodedPath())) {
return true;
}
Expand All @@ -206,13 +207,14 @@ public function routeIs(...$patterns)
/**
* Determine if the current request URL and query string matches a pattern.
*
* @param dynamic $patterns
* @return bool
*/
public function fullUrlIs()
public function fullUrlIs(...$patterns)
{
$url = $this->fullUrl();

foreach (func_get_args() as $pattern) {
foreach ($patterns as $pattern) {
if (Str::is($pattern, $url)) {
return true;
}
Expand Down

0 comments on commit 0b3faab

Please sign in to comment.