chippyash/Zend-Acl-Xml-Builder

View on GitHub

Showing 4 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

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

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

Severity
Category
Status
Source
Language