execute accesses the super-global variable $_REQUEST. Open
public function execute()
{
// Check permissions
if(!\Current_User::isDeity()){
\NQ::simple('intern', \Intern\UI\NotifyUI::ERROR, 'You do not have permission to delete internships.');
- 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 execute
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function execute()
{
// Check permissions
if(!\Current_User::isDeity()){
\NQ::simple('intern', \Intern\UI\NotifyUI::ERROR, 'You do not have permission to delete internships.');
- Create a ticketCreate a ticket
Avoid using static access to class '\phpws2\Database' in method 'execute'. Open
$db = Database::newDB();
- 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 '\NQ' in method 'execute'. Open
\NQ::simple('intern', \Intern\UI\NotifyUI::ERROR, 'You do not have permission to delete internships.');
- 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 '\NQ' in method 'execute'. Open
\NQ::close();
- 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 '\PHPWS_Core' in method 'execute'. Open
\PHPWS_Core::home();
- 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 '\NQ' in method 'execute'. Open
\NQ::close();
- 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 '\PHPWS_Core' in method 'execute'. Open
return \PHPWS_Core::reroute('index.php?module=intern&action=search');
- 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 '\NQ' in method 'execute'. Open
\NQ::simple('intern', \Intern\UI\NotifyUI::SUCCESS, "Successfully deleted the internship.");
- 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 '\NQ' in method 'execute'. Open
\NQ::simple('intern', \Intern\UI\NotifyUI::ERROR, "Could not delete the internship.");
- 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 '\NQ' in method 'execute'. Open
\NQ::close();
- 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 'execute'. Open
if(!\Current_User::isDeity()){
- 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 '\PHPWS_Core' in method 'execute'. Open
return \PHPWS_Core::reroute('index.php?module=intern&action=ShowInternship&internship_id=' . $id);
- 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
Call to method home
from undeclared class \PHPWS_Core
Open
\PHPWS_Core::home();
- Create a ticketCreate a ticket
- Exclude checks
Call to method simple
from undeclared class \NQ
Open
\NQ::simple('intern', \Intern\UI\NotifyUI::ERROR, "Could not delete the internship.");
- Create a ticketCreate a ticket
- Exclude checks
Call to method isDeity
from undeclared class \Current_User
Open
if(!\Current_User::isDeity()){
- Create a ticketCreate a ticket
- Exclude checks
Call to method close
from undeclared class \NQ
Open
\NQ::close();
- Create a ticketCreate a ticket
- Exclude checks
Call to method simple
from undeclared class \NQ
Open
\NQ::simple('intern', \Intern\UI\NotifyUI::SUCCESS, "Successfully deleted the internship.");
- Create a ticketCreate a ticket
- Exclude checks
Call to method newDB
from undeclared class \phpws2\Database
Open
$db = Database::newDB();
- Create a ticketCreate a ticket
- Exclude checks
Call to method reroute
from undeclared class \PHPWS_Core
Open
return \PHPWS_Core::reroute('index.php?module=intern&action=search');
- Create a ticketCreate a ticket
- Exclude checks
Call to method simple
from undeclared class \NQ
Open
\NQ::simple('intern', \Intern\UI\NotifyUI::ERROR, 'You do not have permission to delete internships.');
- Create a ticketCreate a ticket
- Exclude checks
Call to method close
from undeclared class \NQ
Open
\NQ::close();
- Create a ticketCreate a ticket
- Exclude checks
Call to method reroute
from undeclared class \PHPWS_Core
Open
return \PHPWS_Core::reroute('index.php?module=intern&action=ShowInternship&internship_id=' . $id);
- Create a ticketCreate a ticket
- Exclude checks
Call to method close
from undeclared class \NQ
Open
\NQ::close();
- Create a ticketCreate a ticket
- Exclude checks
Avoid variables with short names like $db. Configured minimum length is 3. Open
$db = Database::newDB();
- 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;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $id. Configured minimum length is 3. Open
$id = $_REQUEST['internship_id'];
- 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;
}
}
}