chippyash/Zend-Acl-Xml-Builder

View on GitHub

Showing 11 of 13 total issues

Function addRules has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    protected function addRules(\DOMNodeList $rules)
    {
        foreach ($rules as $rule) {
            //type is a required attribute
            $type = $this->getOpType($rule->getAttribute('type'));
Severity: Minor
Found in src/Chippyash/Zend/Acl/Xml/RuleBuilder.php - About 2 hrs to fix

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 loadDefinition has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function loadDefinition($xmlFile, $xsdFile)
    {
        $isString = false;
        if (strstr($xmlFile, '<?xml') !== false) {
            $isString = true;
Severity: Minor
Found in src/Chippyash/Zend/Acl/Xml/AclBuilder.php - About 35 mins to fix

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 closing brace for the interface must go on the next line after the body
Open

}

Function processImports has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function processImports($basePath)
    {
        $xpath = new \DOMXPath($this->xml);
        $xpath->registerNamespace('acl', self::NS);
        $importNodes = $xpath->query('//acl:acl/acl:imports/acl:import');
Severity: Minor
Found in src/Chippyash/Zend/Acl/Xml/AclBuilder.php - About 35 mins to fix

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

Missing class import via use statement (line '62', column '22').
Open

        $xpath = new \DOMXPath($this->xml);

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 '42', column '20').
Open

        $xsl = new \XSLTProcessor();

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 '43', column '20').
Open

        $dom = new \DOMDocument();

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 '107', column '23').
Open

        $defDom = new \DOMDocument();

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

Function addResources has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function addResources(\DOMNodeList $resources)
    {
        foreach ($resources as $resource) {
            $parent = null;
            $resourceType = 'GenericResource';
Severity: Minor
Found in src/Chippyash/Zend/Acl/Xml/ResourceBuilder.php - About 25 mins to fix

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

Expected 1 newline at end of file; 0 found
Open

}

Expected 1 newline at end of file; 0 found
Open

}
Severity
Category
Status
Source
Language