Skip to content

Commit 44163a9

Browse files
committed
Sort files
1 parent 6dcf886 commit 44163a9

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

Storage/FilesystemStorage.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,11 @@ public function find(array $filters = array(), $max = 20, $offset = 0)
7373

7474
$i = 0;
7575
$results = array();
76-
foreach ($directory->search('*.json', $this->dirname) as $path)
76+
77+
$files = $directory->search('*.json', $this->dirname);
78+
rsort($files);
79+
80+
foreach ($files as $path)
7781
{
7882
if ($i++ < $offset && empty($filters)) {
7983
$results[] = null;
@@ -150,4 +154,4 @@ protected function loadFile(ReadInterface $directory, $path)
150154
return json_decode($contents, true);
151155
}
152156
}
153-
}
157+
}

Storage/RequestIdGenerator.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
namespace Fruitcake\MagentoDebugbar\Storage;
4+
5+
use DebugBar\RequestIdGeneratorInterface;
6+
7+
class RequestIdGenerator implements RequestIdGeneratorInterface
8+
{
9+
/**
10+
* Generates a unique id for the current request. If called repeatedly, a new unique id must
11+
* always be returned on each call to generate() - even across different object instances.
12+
*
13+
* To avoid any potential confusion in ID --> value maps, the returned value must be
14+
* guaranteed to not be all-numeric.
15+
*
16+
* @return string
17+
*/
18+
function generate()
19+
{
20+
return 'X' . time(). bin2hex(random_bytes(16));
21+
}
22+
}

0 commit comments

Comments
 (0)