-
-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migration from Rule structure to PSR-14 Event Listener
- Loading branch information
1 parent
f5ab7e4
commit 117848c
Showing
27 changed files
with
234 additions
and
341 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
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,33 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace SFC\Staticfilecache\Cache\Listener; | ||
|
||
use SFC\Staticfilecache\Event\CacheRuleEvent; | ||
|
||
/** | ||
* Check if there is no path segment that is to long. | ||
*/ | ||
class NoLongPathSegmentListener | ||
{ | ||
/** | ||
* Check if there is no path segment that is to long. | ||
*/ | ||
public function __invoke(CacheRuleEvent $event): void | ||
{ | ||
$uri = (string) $event->getRequest()->getUri(); | ||
$path = (string) parse_url($uri, PHP_URL_PATH); | ||
$segments = explode('/', $path); | ||
|
||
foreach ($segments as $segment) { | ||
if (\strlen($segment) > 255) { | ||
$event->addExplanation(__CLASS__, 'The URI seegment of the URI is to long to create a folder based on tthis segment: ' . $segment); | ||
$event->setSkipProcessing(true); | ||
|
||
return; | ||
} | ||
} | ||
|
||
} | ||
} |
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
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
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.