Showing 29 of 37 total issues
Method __construct
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct(ContainerInterface $di)
{
parent::__construct($di);
$license = "You must accept the <a href=http://opensource.org/licenses/GPL-3.0>license agreement</a>.";
Method create
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function create($form = [], $elements = [])
{
$defaults = [
// Always have an id
"id" => "anax/htmlform",
Method __construct
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct(ContainerInterface $di)
{
parent::__construct($di);
$this->form->create(
[
Method getHTML
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getHTML()
{
$details = $this->getHTMLDetails();
extract($details);
Function isValidCCNumber
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function isValidCCNumber( $ccNum ) {
$digitsOnly = "";
// Filter out non-digit characters
for( $i = 0; $i < strlen( $ccNum ); $i++ ) {
if( is_numeric( substr( $ccNum, $i, 1 ) ) ) {
- 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
Method callbackSubmit
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function callbackSubmit()
{
// These return a single value
// Type checkbox returns true if checked
$elements = [
Method __construct
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct(ContainerInterface $di)
{
parent::__construct($di);
$this->form->create(
[
Function getHTMLForElements
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function getHTMLForElements($options = [])
{
$defaults = [
"use_buttonbar" => true,
];
- 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
Function validate
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function validate($rules, $form = null)
{
$regExpEmailAddress = '/\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b/i';
$tests = [
'fail' => [
- 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"