for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace rtens\domin\delivery\web\resources;
class Template {
/** @var string */
private $file;
/**
* @param string $file
*/
public function __construct($file) {
$this->file = $file;
}
public function render($viewModel) {
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 = $viewModel;
ob_start();
include $this->file;
return ob_get_clean();
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