for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace rtens\domin\delivery\web\resources;
use rtens\domin\delivery\web\BreadCrumbsTrail;
use rtens\domin\delivery\web\HeadElements;
use rtens\domin\delivery\web\WebApplication;
class ActionListResource {
/** @var WebApplication */
private $app;
/** @var BreadCrumbsTrail */
private $crumbs;
public function __construct(WebApplication $app, BreadCrumbsTrail $crumbs) {
$this->app = $app;
$this->crumbs = $crumbs;
}
/**
* @return string
*/
public function handleGet() {
$this->app->prepare();
$this->crumbs->reset();
global $model;
global
Instead of relying on global state, we recommend one of these alternatives:
function myFunction($a, $b) { // Do something }
class MyClass { private $a; private $b; public function __construct($a, $b) { $this->a = $a; $this->b = $b; } public function myFunction() { // Do something } }
$model = [
'name' => $this->app->name,
'menu' => $this->app->menu->render(),
'action' => $this->assembleActions(),
'headElements' => [
(string)HeadElements::jquery(),
(string)HeadElements::bootstrap(),
(string)HeadElements::bootstrapJs(),
]
];
ob_start();
include __DIR__ . '/ActionListTemplate.html.php';
return ob_get_clean();
private function assembleActions() {
$actions = [];
foreach ($this->app->actions->getAllActions() as $id => $action) {
$actions[] = [
'caption' => $action->caption(),
'description' => $this->app->parser->shorten($action->description()),
'link' => ['href' => $id]
return $actions;
Instead of relying on
global
state, we recommend one of these alternatives:1. Pass all data via parameters
2. Create a class that maintains your state