/
Flash.php
43 lines (36 loc) · 1013 Bytes
/
Flash.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
declare(strict_types=1);
/*
* This file is part of the QuidPHP package <https://quidphp.com>
* Author: Pierre-Philippe Emond <emondpph@gmail.com>
* License: https://github.com/quidphp/routing/blob/master/LICENSE
*/
namespace Quid\Routing;
use Quid\Base;
use Quid\Main;
// flash
// class for a collection containing flash-like data, manages route key
class Flash extends Main\Flash
{
// config
protected static array $config = [];
// onPrepareKey
// préparation d'une clé pour flash
// gestion de l'objet route
final protected function onPrepareKey($return)
{
if($return instanceof Route)
{
$route = $return;
$return = [];
$return[] = $route::classFqcn();
if($route::isSegmentClass())
{
$segments = array_values($route->segments());
$return = Base\Arr::merge($return,$segments);
}
}
return parent::onPrepareKey($return);
}
}
?>