add tests

This commit is contained in:
Dennis Eichhorn 2020-10-10 21:28:38 +02:00
parent 27f7f9a1dd
commit e09ac0686e
3 changed files with 19 additions and 8 deletions

View File

@ -444,11 +444,16 @@ final class HttpRequest extends RequestAbstract
{
$this->hash = [\sha1('')];
$pathArray = $this->uri->getPathElements();
$pathLength = \count($pathArray);
for ($i = $start; $i < $pathLength; ++$i) {
if ($pathArray[$i] === '') {
continue;
}
foreach ($pathArray as $key => $path) {
$paths = [];
for ($i = $start; $i <= $key; ++$i) {
$paths[] = $pathArray[$i];
for ($j = $start; $j <= $i; ++$j) {
$paths[] = $pathArray[$j];
}
$this->hash[] = \sha1(\implode('', $paths));

View File

@ -140,12 +140,18 @@ final class ModuleManager
public function getLanguageFiles(RequestAbstract $request, string $app = null) : array
{
$files = $this->getUriLoad($request);
if (!isset($files['5'])) {
return [];
}
$lang = [];
if (isset($files['5'])) {
foreach ($files['5'] as $module) {
$lang[] = '/Modules/' . $module['module_load_from'] . '/Theme/' . ($app ?? $this->app->appName) . '/Lang/' . $module['module_load_file'];
}
foreach ($files['5'] as $module) {
$lang[] = '/Modules/'
. $module['module_load_from']
. '/Theme/'
. ($app ?? $this->app->appName)
. '/Lang/'
. $module['module_load_file'];
}
return $lang;

View File

@ -195,7 +195,7 @@ final class HttpUri implements UriInterface
$this->path = $path;
}
$this->pathElements = \explode('/', \ltrim($this->path, '/'));
$this->pathElements = \explode('/', \trim($this->path, '/'));
$this->queryString = $url['query'] ?? '';
if (!empty($this->queryString)) {