-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow wildcard route exclusion
- Loading branch information
Showing
5 changed files
with
48 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace SychO\PrivateFacade; | ||
|
||
class Helper | ||
{ | ||
public static function itemsInclude(array $items, string $value): bool | ||
{ | ||
$included = false; | ||
|
||
foreach ($items as $item) { | ||
// allow for wildcards | ||
if (strpos($item, '*') !== false) { | ||
$item = str_replace('*', '.*', preg_quote($item, '/')); | ||
|
||
if (preg_match('/' . $item . '/', $value)) { | ||
$included = true; | ||
break; | ||
} | ||
} elseif ($value === $item) { | ||
$included = true; | ||
break; | ||
} | ||
} | ||
|
||
return $included; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.