buildMessage accesses the super-global variable $_SERVER. Open
protected function buildMessage()
{
$this->to = explode(',', $this->emailSettings->getExceptionEmail());
$this->subject = 'Uncaught Exception';
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
buildMessage accesses the super-global variable $_SERVER. Open
protected function buildMessage()
{
$this->to = explode(',', $this->emailSettings->getExceptionEmail());
$this->subject = 'Uncaught Exception';
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
buildMessage accesses the super-global variable $_SERVER. Open
protected function buildMessage()
{
$this->to = explode(',', $this->emailSettings->getExceptionEmail());
$this->subject = 'Uncaught Exception';
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
buildMessage accesses the super-global variable $_REQUEST. Open
protected function buildMessage()
{
$this->to = explode(',', $this->emailSettings->getExceptionEmail());
$this->subject = 'Uncaught Exception';
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
buildMessage accesses the super-global variable $_SERVER. Open
protected function buildMessage()
{
$this->to = explode(',', $this->emailSettings->getExceptionEmail());
$this->subject = 'Uncaught Exception';
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
buildMessage accesses the super-global variable $_SERVER. Open
protected function buildMessage()
{
$this->to = explode(',', $this->emailSettings->getExceptionEmail());
$this->subject = 'Uncaught Exception';
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
buildMessage accesses the super-global variable $_SERVER. Open
protected function buildMessage()
{
$this->to = explode(',', $this->emailSettings->getExceptionEmail());
$this->subject = 'Uncaught Exception';
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
Method buildMessage
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function buildMessage()
{
$this->to = explode(',', $this->emailSettings->getExceptionEmail());
$this->subject = 'Uncaught Exception';
- Create a ticketCreate a ticket
Avoid using static access to class '\Current_User' in method 'buildMessage'. Open
$user = \Current_User::getUserObj();
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Current_User' in method 'buildMessage'. Open
print_r(\Current_User::getUserObj());
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
The method buildMessage uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
}else{
echo "User name: (none)\n\n";
}
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method buildMessage uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
}else{
echo "Referrer: (none)\n";
}
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Doc-block of $e
in __construct
contains phpdoc param type \Intern\Email\Exception
which is incompatible with the param type \Exception
declared in the signature Open
* @param Exception $e
- Create a ticketCreate a ticket
- Exclude checks
Call to method getUserObj
from undeclared class \Current_User
Open
print_r(\Current_User::getUserObj());
- Create a ticketCreate a ticket
- Exclude checks
Call to method getUserObj
from undeclared class \Current_User
Open
$user = \Current_User::getUserObj();
- Create a ticketCreate a ticket
- Exclude checks
Avoid variables with short names like $e. Configured minimum length is 3. Open
public function __construct(InternSettings $emailSettings, \Exception $e)
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}