1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Anax\Page; |
4
|
|
|
|
5
|
|
|
use \Anax\DI\InjectionAwareInterface; |
6
|
|
|
use \Anax\DI\InjectionAwareTrait; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* A default page rendering class. |
10
|
|
|
*/ |
11
|
|
|
class PageRender implements PageRenderInterface, InjectionAwareInterface |
12
|
|
|
{ |
13
|
|
|
use InjectionAwareTrait; |
14
|
|
|
|
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* Render a standard web page using a specific layout. |
18
|
|
|
* |
19
|
|
|
* @param array $data variables to expose to layout view. |
20
|
|
|
* @param integer $status code to use when delivering the result. |
21
|
|
|
* |
22
|
|
|
* @SuppressWarnings(PHPMD.ExitExpression) |
23
|
|
|
* @param string $title |
|
|
|
|
24
|
|
|
* @return void |
25
|
|
|
*/ |
26
|
|
|
public function renderPage($data = null, $status = 200) |
27
|
|
|
{ |
28
|
|
|
$data["stylesheets"] = ["css/style.min.css"]; |
29
|
|
|
$view = $this->di->get("view"); |
30
|
|
|
// Add common header, navbar and footer |
31
|
|
|
$view->add("default/header", [], "header"); |
32
|
|
|
$view->add("navbar/navbar", [], "navbar"); |
33
|
|
|
$view->add("default/footer", [], "footer"); |
34
|
|
|
|
35
|
|
|
// Add layout, render it, add to response and send. |
36
|
|
|
$view->add("default1/layout", $data, "layout"); |
37
|
|
|
$body = $view->renderBuffered("layout"); |
38
|
|
|
$this->di->get("response")->setBody($body) |
39
|
|
|
->send($status); |
40
|
|
|
exit; |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* Render a standard web page using a specific layout. |
45
|
|
|
* |
46
|
|
|
* @param array $data variables to expose to layout view. |
47
|
|
|
* @param integer $status code to use when delivering the result. |
48
|
|
|
* |
49
|
|
|
* @SuppressWarnings(PHPMD.ExitExpression) |
50
|
|
|
* @param string $title |
|
|
|
|
51
|
|
|
* @return void |
52
|
|
|
*/ |
53
|
|
|
public function renderLogin($data = null, $status = 200) |
54
|
|
|
{ |
55
|
|
|
$data["stylesheets"] = ["css/style.min.css"]; |
56
|
|
|
$view = $this->di->get("view"); |
57
|
|
|
// Add common header, navbar and footer |
58
|
|
|
// $view->add("default/header", [], "header"); |
|
|
|
|
59
|
|
|
// $view->add("navbar/navbar", [], "navbar"); |
|
|
|
|
60
|
|
|
// $view->add("default/footer", [], "footer"); |
|
|
|
|
61
|
|
|
|
62
|
|
|
// Add layout, render it, add to response and send. |
63
|
|
|
$view->add("default1/layout", $data, "layout"); |
64
|
|
|
$body = $view->renderBuffered("layout"); |
65
|
|
|
$this->di->get("response")->setBody($body) |
66
|
|
|
->send($status); |
67
|
|
|
exit; |
68
|
|
|
} |
69
|
|
|
} |
70
|
|
|
|
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.