for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Anax\App;
/**
* An App class to wrap the resources of the framework.
*
* @SuppressWarnings(PHPMD.ExitExpression)
*/
class App
{
public function redirect($url)
$this->response->redirect($this->url->create($url));
response
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
class MyClass { } $x = new MyClass(); $x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:
class MyClass { public $foo; } $x = new MyClass(); $x->foo = true;
url
exit;
}
* Render a standard web page using a specific layout.
public function renderPage($data, $status = 200)
$data["stylesheets"] = ["css/style.css"];
// Add common header, navbar and footer
//$this->view->add("default1/header", [], "header");
//$this->view->add("default1/navbar", [], "navbar");
//$this->view->add("default1/footer", [], "footer");
// Add layout, render it, add to response and send.
$this->view->add("default1/layout", $data, "layout");
view
$body = $this->view->renderBuffered("layout");
$this->response->setBody($body)
->send($status);
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: