page_header accesses the super-global variable $_SESSION. Open
function page_header() {
// Evil code to force memembers to update their information each new semester.
// Seriously, evil. You cannot do anything until you update.
// -- Stephen Quinn
- Read upRead up
- 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
page_header accesses the super-global variable $_SERVER. Open
function page_header() {
// Evil code to force memembers to update their information each new semester.
// Seriously, evil. You cannot do anything until you update.
// -- Stephen Quinn
- Read upRead up
- 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
page_header accesses the super-global variable $_SESSION. Open
function page_header() {
// Evil code to force memembers to update their information each new semester.
// Seriously, evil. You cannot do anything until you update.
// -- Stephen Quinn
- Read upRead up
- 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
page_header accesses the super-global variable $_SERVER. Open
function page_header() {
// Evil code to force memembers to update their information each new semester.
// Seriously, evil. You cannot do anything until you update.
// -- Stephen Quinn
- Read upRead up
- 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
Function page_header
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function page_header() {
// Evil code to force memembers to update their information each new semester.
// Seriously, evil. You cannot do anything until you update.
// -- Stephen Quinn
- Read upRead up
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
A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 11 and the first side effect is on line 2. Open
<?php
- Exclude checks
Blank line found at start of control structure Open
if (($_SERVER["REQUEST_URI"] != "/updateinfo.php?forced=true") AND ($_SERVER["REQUEST_URI"] != "/updateinfo.php")) {
- Exclude checks
Function closing brace must go on the next line following the body; found 1 blank lines before brace Open
}
- Exclude checks
Blank line found at end of control structure Open
- Exclude checks
PHP keywords must be lowercase; expected "and" but found "AND" Open
if (($_SERVER["REQUEST_URI"] != "/updateinfo.php?forced=true") AND ($_SERVER["REQUEST_URI"] != "/updateinfo.php")) {
- Exclude checks
Line exceeds 120 characters; contains 122 characters Open
if (($_SERVER["REQUEST_URI"] != "/updateinfo.php?forced=true") AND ($_SERVER["REQUEST_URI"] != "/updateinfo.php")) {
- Exclude checks
Line exceeds 120 characters; contains 547 characters Open
echo "<div class='entry'><a href='quizdate.php'>Risk Management Quiz Completion date.</a><br/><a href='pledgesummary.php'>Pledge Service Summary.</a><br/><a href='summary.php'>Chapter Service Summary.</a><br/><a href='execmail.php'>Exec e-mail list</a><br/><a href='exec_file_uploader.php'>Exec website file uploader</a><br/><a href='verifyhoursspring07.php'>Check Spring 2007 Service Hours</a><br/><a href='verifyhoursspring08.php'>Check Spring 2008 Service Hours</a><br/><a href='verifyhoursfall08.php'>Check Fall 2008 Service Hours</a></div>";
- Exclude checks
Line indented incorrectly; expected 8 spaces, found 4 Open
if ($_SESSION['active_sem'] != $current_semester) {
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 2 Open
if (isset($_SESSION['active_sem'])) {
- Exclude checks
Space after opening parenthesis of function call prohibited Open
header( 'Location: ./updateinfo.php' ) ;
- Exclude checks
Opening brace should be on a new line Open
function exec_links(){
- Exclude checks
Line indented incorrectly; expected at least 16 spaces, found 10 Open
header( 'Location: ./updateinfo.php' ) ;
- Exclude checks
Line indented incorrectly; expected 12 spaces, found 6 Open
}
- Exclude checks
Line indented incorrectly; expected 12 spaces, found 6 Open
if (($_SERVER["REQUEST_URI"] != "/updateinfo.php?forced=true") AND ($_SERVER["REQUEST_URI"] != "/updateinfo.php")) {
- Exclude checks
Line indented incorrectly; expected 8 spaces, found 4 Open
}
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 1 Open
echo "<div class='entry'><a href='quizdate.php'>Risk Management Quiz Completion date.</a><br/><a href='pledgesummary.php'>Pledge Service Summary.</a><br/><a href='summary.php'>Chapter Service Summary.</a><br/><a href='execmail.php'>Exec e-mail list</a><br/><a href='exec_file_uploader.php'>Exec website file uploader</a><br/><a href='verifyhoursspring07.php'>Check Spring 2007 Service Hours</a><br/><a href='verifyhoursspring08.php'>Check Spring 2008 Service Hours</a><br/><a href='verifyhoursfall08.php'>Check Fall 2008 Service Hours</a></div>";
- Exclude checks
Line indented incorrectly; expected at least 4 spaces, found 1 Open
global $current_semester;
- Exclude checks
Opening brace should be on a new line Open
function page_header() {
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
header( 'Location: ./updateinfo.php' ) ;
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 2 Open
}
- Exclude checks
The variable $current_semester is not named in camelCase. Open
function page_header() {
// Evil code to force memembers to update their information each new semester.
// Seriously, evil. You cannot do anything until you update.
// -- Stephen Quinn
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $current_semester is not named in camelCase. Open
function page_header() {
// Evil code to force memembers to update their information each new semester.
// Seriously, evil. You cannot do anything until you update.
// -- Stephen Quinn
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}