1 | <?php |
||
2 | /** |
||
3 | * @package content |
||
4 | */ |
||
5 | /** |
||
6 | * The AjaxLog page accepts $_POST requests to write information to the |
||
7 | * Symphony Log. |
||
8 | */ |
||
9 | |||
10 | class contentAjaxLog extends TextPage |
||
0 ignored issues
–
show
|
|||
11 | { |
||
12 | public function view() |
||
13 | { |
||
14 | if ($_REQUEST['error'] && Symphony::Log()) { |
||
15 | Symphony::Log()->pushToLog(sprintf( |
||
16 | '%s - %s%s%s', |
||
17 | 'Javascript', |
||
18 | $_REQUEST['error'], |
||
19 | ($_REQUEST['url'] ? " in file " . $_REQUEST['url'] : null), |
||
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
in file 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 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 ( 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: 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. ![]() |
|||
20 | ($_REQUEST['line'] ? " on line " . $_REQUEST['line'] : null) |
||
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
on line 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 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 ( 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: 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. ![]() |
|||
21 | ), |
||
22 | E_ERROR, true |
||
23 | ); |
||
24 | } |
||
25 | } |
||
26 | } |
||
27 |
Classes in PHP are usually named in CamelCase.
In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. The whole name starts with a capital letter as well.
Thus the name database provider becomes
DatabaseProvider
.