Completed
Pull Request — develop (#89)
by Patrick
11:08 queued 08:06
created

LoginRequiredPage::getContent()   A

Complexity

Conditions 4
Paths 3

Size

Total Lines 20
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 4
eloc 7
nc 3
nop 0
dl 0
loc 20
rs 9.2
c 1
b 0
f 0
1
<?php
2
namespace Http;
3
/**
4
 * A WebPage class that requires login to view
5
 *
6
 * This file describes an abstraction for creating a webpage with JQuery, Bootstrap,
7
 * and other framework specific abilities that requires a login
8
 *
9
 * PHP version 5 and 7
10
 *
11
 * @author Patrick Boyd / [email protected]
12
 * @copyright Copyright (c) 2017, Austin Artistic Reconstruction
13
 * @license http://www.apache.org/licenses/ Apache 2.0 License
14
 */
15
16
/**
17
 * A webpage abstraction for login required pages
18
 *
19
 * This class adds a login requirement to FlipPage
20
 */
21
class LoginRequiredPage extends WebPage
22
{
23
    protected function getContent()
24
    {
25
        if($this->user === false || $this->user === null)
0 ignored issues
show
Bug introduced by
The property user 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...
26
        {
27
          $this->content['body'] = '
0 ignored issues
show
Bug introduced by
The property content 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...
28
            <div id="content">
29
              <div class="row">
30
                <div class="col-lg-12">
31
                  <h1 class="page-header">You must <a href="'.$this->loginUrl.'?return='.$this->currentUrl().'">log in <span class="fa fa-sign-in"></span></a> to access the '.$this->content['pageTitle'].' system!</h1>
0 ignored issues
show
Bug introduced by
The property loginUrl 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...
32
                </div>
33
              </div>
34
            </div>
35
          ';
36
        }
37
        else if(!isset($this->content['body']))
38
        {
39
          $this->content['body'] = $this->body;
40
        }
41
        return $this->twig->render($this->templateName, $this->content);
0 ignored issues
show
Bug introduced by
The property twig 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...
42
    }
43
}
44
/* vim: set tabstop=4 shiftwidth=4 expandtab: */
45