Function plugStudentValues
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
protected function plugStudentValues(&$student, \stdClass $data){
/**********************
* Basic Demographics *
**********************/
$student->setStudentId($data->bannerID);
- 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 class WebServiceDataProvider has an overall complexity of 52 which is very high. The configured complexity threshold is 50. Open
class WebServiceDataProvider extends StudentDataProvider {
protected $currentUserName;
private $apiKey;
- Create a ticketCreate a ticket
- Exclude checks
Method plugStudentValues
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function plugStudentValues(&$student, \stdClass $data){
/**********************
* Basic Demographics *
**********************/
$student->setStudentId($data->bannerID);
- Create a ticketCreate a ticket
Method getStudent
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getStudent($studentId){
if($studentId === null || $studentId == ''){
throw new \InvalidArgumentException('Missing student ID.');
}
- Create a ticketCreate a ticket
Function getStudent
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function getStudent($studentId){
if($studentId === null || $studentId == ''){
throw new \InvalidArgumentException('Missing student ID.');
}
- 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
Function getCreditHours
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getCreditHours(string $studentId, string $term){
if($studentId === null || $studentId == ''){
throw new \InvalidArgumentException('Missing student ID.');
}
- 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
Function getFacultyMember
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getFacultyMember($facultyId){
if($facultyId === null || $facultyId == ''){
throw new \InvalidArgumentException('Missing student ID.');
}
- 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 plugStudentValues() has an NPath complexity of 77760. The configured NPath complexity threshold is 200. Open
protected function plugStudentValues(&$student, \stdClass $data){
/**********************
* Basic Demographics *
**********************/
$student->setStudentId($data->bannerID);
- 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 plugStudentValues() has a Cyclomatic Complexity of 24. The configured cyclomatic complexity threshold is 10. Open
protected function plugStudentValues(&$student, \stdClass $data){
/**********************
* Basic Demographics *
**********************/
$student->setStudentId($data->bannerID);
- 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
Missing class import via use statement (line '81', column '23'). Open
throw new \Intern\Exception\StudentNotFoundException("Could not locate student: $studentId");
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '120', column '23'). Open
throw new \BannerPermissionException('You do not have permission to access student data.');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '115', column '23'). Open
throw new \InvalidArgumentException('Missing student term.');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '100', column '23'). Open
throw new \Intern\Exception\StudentNotFoundException("Missing student data: $studentId");
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '144', column '23'). Open
throw new \InvalidArgumentException('Missing student ID.');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '149', column '23'). Open
throw new \BannerPermissionException('You do not have permission to access student data.');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '62', column '23'). Open
throw new \InvalidArgumentException('Missing student ID.');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '67', column '23'). Open
throw new \BannerPermissionException('You do not have permission to access student data.');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '111', column '23'). Open
throw new \InvalidArgumentException('Missing student ID.');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '163', column '23'). Open
throw new \Intern\Exception\StudentNotFoundException("Could not locate faculty member with id: $facultyId");
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Avoid using static access to class '\Current_User' in method 'getStudent'. Open
if(!\Current_User::isLogged()){
- 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 plugStudentValues uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$student->setStudentFlag(false);
}
- 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
Avoid using static access to class '\Current_User' in method 'getFacultyMember'. Open
if(!\Current_User::isLogged()){
- 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_Settings' in method '__construct'. Open
$this->apiKey = \PHPWS_Settings::get('intern', 'wsdlUri');
- 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 plugStudentValues uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$student->setStaffFlag(false);
}
- 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
Avoid using static access to class '\PHPWS_Core' in method 'logRequest'. Open
\PHPWS_Core::log($msg, 'curlapi.log', 'CURLAPI');
- 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 '\Intern\LevelFactory' in method 'plugStudentValues'. Open
if(isset($data->studentLevel) && LevelFactory::checkLevelExist($data->studentLevel)){
- 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 'getCreditHours'. Open
if(!\Current_User::isLogged()){
- 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 plugStudentValues uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$student->setConfidentialFlag(true);
}
- 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 plugStudentValues uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
// If the campus isn't set, then defalt to main campus
$student->setCampus(Student::MAIN_CAMPUS);
//\NQ::simple('intern', \Intern\UI\NotifyUI::WARNING, "Campus not found for this student in banner so Main Campus was initially selected.");
//\NQ::close();
- 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 getCreditHours uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
}else{
return null;
}
- 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
Avoid using static access to class '\Intern\LevelFactory' in method 'plugStudentValues'. Open
$newLevel = LevelFactory::saveNewCode($data->studentLevel);
- 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 unused local variables such as '$params'. Open
$params = array('BannerID' => $facultyId, 'UserName' => $this->currentUserName);
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
UnusedLocalVariable
Since: 0.2
Detects when a local variable is declared and/or assigned, but not used.
Example
class Foo {
public function doSomething()
{
$i = 5; // Unused
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable
TODO found Open
// TODO: Maybe be smarter about which result we use?
- Create a ticketCreate a ticket
- Exclude checks
Call to method __construct
from undeclared class \BannerPermissionException
(Did you mean class \Intern\Exception\BannerPermissionException) Open
throw new \BannerPermissionException('You do not have permission to access student data.');
- Create a ticketCreate a ticket
- Exclude checks
Call to method get
from undeclared class \PHPWS_Settings
Open
$this->apiKey = \PHPWS_Settings::get('intern', 'wsdlUri');
- Create a ticketCreate a ticket
- Exclude checks
Call to method isLogged
from undeclared class \Current_User
Open
if(!\Current_User::isLogged()){
- Create a ticketCreate a ticket
- Exclude checks
Doc-block of $data
in plugFacultyValues
contains phpdoc param type \Intern\DataProvider\Student\stdClass
which is incompatible with the param type \stdClass
declared in the signature Open
* @param stdClass $data
- Create a ticketCreate a ticket
- Exclude checks
Call to method __construct
from undeclared class \BannerPermissionException
(Did you mean class \Intern\Exception\BannerPermissionException) Open
throw new \BannerPermissionException('You do not have permission to access student data.');
- Create a ticketCreate a ticket
- Exclude checks
Call to method log
from undeclared class \PHPWS_Core
Open
\PHPWS_Core::log($msg, 'curlapi.log', 'CURLAPI');
- Create a ticketCreate a ticket
- Exclude checks
Call to method isLogged
from undeclared class \Current_User
Open
if(!\Current_User::isLogged()){
- Create a ticketCreate a ticket
- Exclude checks
Call to method __construct
from undeclared class \BannerPermissionException
(Did you mean class \Intern\Exception\BannerPermissionException) Open
throw new \BannerPermissionException('You do not have permission to access student data.');
- Create a ticketCreate a ticket
- Exclude checks
Declaration of function getStudent(string $studentId) : \Intern\Student
should be compatible with function getStudent(string $studentId) : \Intern\DataProvider\Student\Intern\Student
defined in /code/class/DataProvider/Student/StudentDataProvider.php:39
Open
public function getStudent($studentId){
- Create a ticketCreate a ticket
- Exclude checks
Return type of getFacultyMember()
is undeclared type \Intern\DataProvider\Student\stdClass
(Did you mean class \stdClass) Open
public function getFacultyMember($facultyId){
- Create a ticketCreate a ticket
- Exclude checks
Doc-block of $data
in plugStudentValues
contains phpdoc param type \Intern\DataProvider\Student\stdClass
which is incompatible with the param type \stdClass
declared in the signature Open
* @param stdClass $data
- Create a ticketCreate a ticket
- Exclude checks
Reference to undeclared property \Intern\DataProvider\Student\WebServiceDataProvider->client
Open
return $this->client->GetInternInfo($params);
- Create a ticketCreate a ticket
- Exclude checks
Call to method isLogged
from undeclared class \Current_User
Open
if(!\Current_User::isLogged()){
- Create a ticketCreate a ticket
- Exclude checks
Returning type null
but getCreditHours()
is declared to return int
Open
return null;
- Create a ticketCreate a ticket
- Exclude checks