Method plug
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function plug()
{
$tpl = array();
$tpl['HOME_LINK'] = \PHPWS_Text::moduleLink('Menu', 'intern');
$tpl['ADD_LINK'] = \PHPWS_Text::moduleLink('Add Student', 'intern', array('action' => 'ShowInternship'));
- Create a ticketCreate a ticket
Function plug
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function plug()
{
$tpl = array();
$tpl['HOME_LINK'] = \PHPWS_Text::moduleLink('Menu', 'intern');
$tpl['ADD_LINK'] = \PHPWS_Text::moduleLink('Add Student', 'intern', array('action' => 'ShowInternship'));
- Read upRead up
- Create a ticketCreate a ticket
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
The method plug() has an NPath complexity of 512. The configured NPath complexity threshold is 200. Open
public static function plug()
{
$tpl = array();
$tpl['HOME_LINK'] = \PHPWS_Text::moduleLink('Menu', 'intern');
$tpl['ADD_LINK'] = \PHPWS_Text::moduleLink('Add Student', 'intern', array('action' => 'ShowInternship'));
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The method plug() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10. Open
public static function plug()
{
$tpl = array();
$tpl['HOME_LINK'] = \PHPWS_Text::moduleLink('Menu', 'intern');
$tpl['ADD_LINK'] = \PHPWS_Text::moduleLink('Add Student', 'intern', array('action' => 'ShowInternship'));
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
Avoid using static access to class '\Layout' in method 'plug'. Open
\Layout::plug(\PHPWS_Template::process($tpl, 'intern', 'top.tpl'), 'NAV_LINKS');
- 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 'plug'. Open
$auth = \Current_User::getAuthorization();
- 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 'plug'. Open
if(\Current_User::allow('intern', 'edit_level')){
- 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_Text' in method 'plug'. Open
$adminOptions['CONTROL_PANEL'] = \PHPWS_Text::secureLink('Control Panel','controlpanel');
- 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_Text' in method 'plug'. Open
$adminOptions['EDIT_STUDENT_LEVEL'] = \PHPWS_Text::secureLink('Edit Student Levels','intern',array('action' => 'edit_level'));
- 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 'plug'. Open
if(\Current_User::allow('intern', 'edit_dept')){
- 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_Text' in method 'plug'. Open
$adminOptions['EDIT_ADMINS_LINK'] = \PHPWS_Text::secureLink('Edit Administrators','intern',array('action' => 'showEditAdmins'));
- 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 'plug'. Open
$tpl['USER_FULL_NAME'] = \Current_User::getDisplayName();
- 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_Text' in method 'plug'. Open
$adminOptions['EDIT_DEPARTMENTS_LINK'] = \PHPWS_Text::secureLink('Edit Departments','intern',array('action' => 'showEditDept'));
- 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_Text' in method 'plug'. Open
$adminOptions['EDIT_COURSES_LINK'] = \PHPWS_Text::secureLink('Edit Course List','intern',array('action' => 'edit_courses'));
- 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_Text' in method 'plug'. Open
$adminOptions['ADMIN_SETTINGS'] = \PHPWS_Text::secureLink('Admin Settings','intern',array('action' => 'showAdminSettings'));
- 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_Text' in method 'plug'. Open
$tpl['ADD_LINK'] = \PHPWS_Text::moduleLink('Add Student', 'intern', array('action' => 'ShowInternship'));
- 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 'plug'. 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_Text' in method 'plug'. Open
$adminOptions['EDIT_STATES_LINK'] = \PHPWS_Text::secureLink('Edit States','intern',array('action' => 'edit_states'));
- 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 'plug'. Open
if(\Current_User::allow('intern', 'special_host')){
- 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 'plug'. Open
if(\Current_User::allow('intern', 'edit_courses')){
- 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_Text' in method 'plug'. Open
$tpl['SEARCH_LINK'] = \PHPWS_Text::moduleLink('Search', 'intern', array('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 '\Current_User' in method 'plug'. Open
if(\Current_User::allow('intern', 'edit_states')){
- 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_Text' in method 'plug'. Open
$adminOptions['AFFIL_AGREE_LINK'] = \PHPWS_Text::secureLink('Affiliation Agreements','intern',array('action' => 'showAffiliateAgreement'));
- 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 'plug'. Open
if(\Current_User::allow('intern', 'affiliation_agreement')){
- 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 'plug'. Open
if(\Current_User::allow('intern', 'edit_terms')){
- 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_Template' in method 'plug'. Open
\Layout::plug(\PHPWS_Template::process($tpl, 'intern', 'top.tpl'), 'NAV_LINKS');
- 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_Text' in method 'plug'. Open
$tpl['HOME_LINK'] = \PHPWS_Text::moduleLink('Menu', 'intern');
- 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_Text' in method 'plug'. Open
$adminOptions['EDIT_TERMS_LINK'] = \PHPWS_Text::secureLink('Edit Terms','intern',array('action' => 'edit_terms'));
- 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_Text' in method 'plug'. Open
$adminOptions['APPROVE_HOST_LINK'] = \PHPWS_Text::secureLink('Approve Host','intern',array('action' => 'showApproveHost'));
- 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 secureLink
from undeclared class \PHPWS_Text
Open
$adminOptions['CONTROL_PANEL'] = \PHPWS_Text::secureLink('Control Panel','controlpanel');
- Create a ticketCreate a ticket
- Exclude checks
Call to method secureLink
from undeclared class \PHPWS_Text
Open
$adminOptions['EDIT_ADMINS_LINK'] = \PHPWS_Text::secureLink('Edit Administrators','intern',array('action' => 'showEditAdmins'));
- Create a ticketCreate a ticket
- Exclude checks
Call to method moduleLink
from undeclared class \PHPWS_Text
Open
$tpl['HOME_LINK'] = \PHPWS_Text::moduleLink('Menu', 'intern');
- Create a ticketCreate a ticket
- Exclude checks
Call to method moduleLink
from undeclared class \PHPWS_Text
Open
$tpl['SEARCH_LINK'] = \PHPWS_Text::moduleLink('Search', 'intern', array('action' => 'search'));
- Create a ticketCreate a ticket
- Exclude checks
Call to method plug
from undeclared class \Layout
Open
\Layout::plug(\PHPWS_Template::process($tpl, 'intern', 'top.tpl'), 'NAV_LINKS');
- Create a ticketCreate a ticket
- Exclude checks
Call to method secureLink
from undeclared class \PHPWS_Text
Open
$adminOptions['ADMIN_SETTINGS'] = \PHPWS_Text::secureLink('Admin Settings','intern',array('action' => 'showAdminSettings'));
- Create a ticketCreate a ticket
- Exclude checks
Call to method allow
from undeclared class \Current_User
Open
if(\Current_User::allow('intern', 'special_host')){
- Create a ticketCreate a ticket
- Exclude checks
Call to method moduleLink
from undeclared class \PHPWS_Text
Open
$tpl['ADD_LINK'] = \PHPWS_Text::moduleLink('Add Student', 'intern', array('action' => 'ShowInternship'));
- Create a ticketCreate a ticket
- Exclude checks
Call to method allow
from undeclared class \Current_User
Open
if(\Current_User::allow('intern', 'edit_level')){
- 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 secureLink
from undeclared class \PHPWS_Text
Open
$adminOptions['EDIT_STATES_LINK'] = \PHPWS_Text::secureLink('Edit States','intern',array('action' => 'edit_states'));
- Create a ticketCreate a ticket
- Exclude checks
Call to method getAuthorization
from undeclared class \Current_User
Open
$auth = \Current_User::getAuthorization();
- Create a ticketCreate a ticket
- Exclude checks
Call to method secureLink
from undeclared class \PHPWS_Text
Open
$adminOptions['APPROVE_HOST_LINK'] = \PHPWS_Text::secureLink('Approve Host','intern',array('action' => 'showApproveHost'));
- Create a ticketCreate a ticket
- Exclude checks
Call to method secureLink
from undeclared class \PHPWS_Text
Open
$adminOptions['EDIT_COURSES_LINK'] = \PHPWS_Text::secureLink('Edit Course List','intern',array('action' => 'edit_courses'));
- Create a ticketCreate a ticket
- Exclude checks
Call to method secureLink
from undeclared class \PHPWS_Text
Open
$adminOptions['EDIT_DEPARTMENTS_LINK'] = \PHPWS_Text::secureLink('Edit Departments','intern',array('action' => 'showEditDept'));
- Create a ticketCreate a ticket
- Exclude checks
Call to method allow
from undeclared class \Current_User
Open
if(\Current_User::allow('intern', 'edit_terms')){
- Create a ticketCreate a ticket
- Exclude checks
Call to method process
from undeclared class \PHPWS_Template
Open
\Layout::plug(\PHPWS_Template::process($tpl, 'intern', 'top.tpl'), 'NAV_LINKS');
- Create a ticketCreate a ticket
- Exclude checks
Call to method allow
from undeclared class \Current_User
Open
if(\Current_User::allow('intern', 'edit_dept')){
- Create a ticketCreate a ticket
- Exclude checks
Call to method secureLink
from undeclared class \PHPWS_Text
Open
$adminOptions['EDIT_TERMS_LINK'] = \PHPWS_Text::secureLink('Edit Terms','intern',array('action' => 'edit_terms'));
- Create a ticketCreate a ticket
- Exclude checks
Call to method allow
from undeclared class \Current_User
Open
if(\Current_User::allow('intern', 'edit_courses')){
- Create a ticketCreate a ticket
- Exclude checks
Call to method getDisplayName
from undeclared class \Current_User
Open
$tpl['USER_FULL_NAME'] = \Current_User::getDisplayName();
- Create a ticketCreate a ticket
- Exclude checks
Call to method allow
from undeclared class \Current_User
Open
if(\Current_User::allow('intern', 'affiliation_agreement')){
- Create a ticketCreate a ticket
- Exclude checks
Call to method secureLink
from undeclared class \PHPWS_Text
Open
$adminOptions['AFFIL_AGREE_LINK'] = \PHPWS_Text::secureLink('Affiliation Agreements','intern',array('action' => 'showAffiliateAgreement'));
- Create a ticketCreate a ticket
- Exclude checks
Call to method allow
from undeclared class \Current_User
Open
if(\Current_User::allow('intern', 'edit_states')){
- Create a ticketCreate a ticket
- Exclude checks
Call to method secureLink
from undeclared class \PHPWS_Text
Open
$adminOptions['EDIT_STUDENT_LEVEL'] = \PHPWS_Text::secureLink('Edit Student Levels','intern',array('action' => 'edit_level'));
- Create a ticketCreate a ticket
- Exclude checks