Refactor many request related methods into (complex) trait.

This commit is contained in:
James Cole
2018-08-09 17:46:14 +02:00
parent 4f697e77d5
commit 9865800e39
18 changed files with 480 additions and 390 deletions

View File

@@ -241,6 +241,31 @@ class DebugController extends Controller
return redirect(route('home'));
}
/**
* All packages that are installed.
*
* @return array
*/
protected function collectPackages(): array // get configuration
{
$packages = [];
$file = \dirname(__DIR__, 3) . '/vendor/composer/installed.json';
if (file_exists($file)) {
// file exists!
$content = file_get_contents($file);
$json = json_decode($content, true);
foreach ($json as $package) {
$packages[]
= [
'name' => $package['name'],
'version' => $package['version'],
];
}
}
return $packages;
}
/**
* Some common combinations.
*
@@ -266,29 +291,4 @@ class DebugController extends Controller
return $result;
}
/**
* All packages that are installed.
*
* @return array
*/
protected function collectPackages(): array // get configuration
{
$packages = [];
$file = \dirname(__DIR__, 3) . '/vendor/composer/installed.json';
if (file_exists($file)) {
// file exists!
$content = file_get_contents($file);
$json = json_decode($content, true);
foreach ($json as $package) {
$packages[]
= [
'name' => $package['name'],
'version' => $package['version'],
];
}
}
return $packages;
}
}