GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Issues (3647)

symphony/lib/toolkit/class.textpage.php (8 issues)

1
<?php
2
/**
3
 * @package toolkit
4
 */
5
/**
6
 * TextPage extends the Page class to provide an object representation
7
 * of a Symphony backend text page.
8
 */
9
10
abstract class TextPage extends Page
11
{
12
    /**
13
     * The body string response of the TextPage
14
     * @var string
15
     */
16
    protected $_Result;
17
18
    /**
19
     * The constructor for `TextPage`. This sets the page status to `Page::HTTP_STATUS_OK`,
20
     * the default content type to `text/plain` and initialises `$this->_Result`
21
     * with an empty `string`. The constructor also starts the Profiler for this
22
     * page template.
23
     *
24
     * @see toolkit.Profiler
25
     */
26
    public function __construct()
27
    {
28
        $this->_Result = "";
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
29
30
        $this->setHttpStatus(self::HTTP_STATUS_OK);
31
        $this->addHeaderToPage('Content-Type', 'text/plain');
32
33
        Symphony::Profiler()->sample('Page template created', PROFILE_LAP);
0 ignored issues
show
The constant PROFILE_LAP was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
34
    }
35
36
    /**
37
     * This function is called by Administration class when a user is not authenticated
38
     * to the Symphony backend. It sets the status of this page to
39
     * `Page::HTTP_STATUS_UNAUTHORIZED` and appends a message for generation
40
     */
41
    public function handleFailedAuthorisation()
42
    {
43
        $this->setHttpStatus(self::HTTP_STATUS_UNAUTHORIZED);
44
        $this->_Result = __('You are not authorised to access this page.');
45
    }
46
47
    /**
48
     * Calls the view function of this page. If a context is passed, it is
49
     * also set.
50
     *
51
     * @see view()
52
     * @param array $context
53
     *  The context of the page as an array. Defaults to null
54
     */
55
    public function build($context = null)
0 ignored issues
show
Incorrect spacing between argument "$context" and equals sign; expected 0 but found 1
Loading history...
Incorrect spacing between default value and equals sign for argument "$context"; expected 0 but found 1
Loading history...
56
    {
57
        if ($context) {
58
            $this->_context = $context;
0 ignored issues
show
Bug Best Practice introduced by
The property _context does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
59
        }
60
61
        $this->view();
62
    }
63
64
    /**
65
     * The generate functions outputs the correct headers for
66
     * this `TextPage`, before calling the parent generate function and
67
     * returning the `$this->_Result` string
68
     *
69
     * @param null $page
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $page is correct as it would always require null to be passed?
Loading history...
70
     * @return string
71
     */
72
    public function generate($page = null)
0 ignored issues
show
Incorrect spacing between argument "$page" and equals sign; expected 0 but found 1
Loading history...
Incorrect spacing between default value and equals sign for argument "$page"; expected 0 but found 1
Loading history...
73
    {
74
        parent::generate($page);
75
        return $this->_Result;
76
    }
77
78
    /**
79
     * All classes that extend the `TextPage` class must define a view method
80
     * which contains the logic for the content of this page. The resulting values
81
     * must be appended to `$this->_Result` where it is generated as json on build
82
     *
83
     * @see build()
84
     */
85
    abstract public function view();
86
}
87