Passed
Push — master ( a471f6...507714 )
by Mikael
01:51
created

App   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 30
ccs 0
cts 10
cp 0
rs 10
wmc 2
lcom 1
cbo 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A redirect() 0 5 1
A renderPage() 0 16 1
1
<?php
2
3
namespace Anax\App;
4
5
/**
6
 * An App class to wrap the resources of the framework.
7
 *
8
 * @SuppressWarnings(PHPMD.ExitExpression)
9
 */
10
class App
11
{
12
    public function redirect($url)
13
    {
14
        $this->response->redirect($this->url->create($url));
0 ignored issues
show
Bug introduced by
The property response does not exist. Did you maybe forget to declare it?

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;
Loading history...
Bug introduced by
The property url does not exist. Did you maybe forget to declare it?

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;
Loading history...
15
        exit;
16
    }
17
18
19
20
    /**
21
     * Render a standard web page using a specific layout.
22
     */
23
    public function renderPage($data, $status = 200)
24
    {
25
        $data["stylesheets"] = ["css/style.css"];
26
27
        // Add common header, navbar and footer
28
        //$this->view->add("default1/header", [], "header");
29
        //$this->view->add("default1/navbar", [], "navbar");
30
        //$this->view->add("default1/footer", [], "footer");
31
32
        // Add layout, render it, add to response and send.
33
        $this->view->add("default1/layout", $data, "layout");
0 ignored issues
show
Bug introduced by
The property view does not exist. Did you maybe forget to declare it?

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;
Loading history...
34
        $body = $this->view->renderBuffered("layout");
35
        $this->response->setBody($body)
36
                       ->send($status);
37
        exit;
38
    }
39
}
40