galmi/xacmlBundle

View on GitHub

Showing 4 of 4 total issues

Function getValue has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

    public function getValue(XacmlRequest $request, $attributeId)
    {
        $attributeParts = explode('.', trim($attributeId));
        $array = [];
        foreach ($attributeParts as $key => $attributePart) {
Severity: Minor
Found in Xacml/PolicyInformationPoint.php - About 3 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

Method getValue has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function getValue(XacmlRequest $request, $attributeId)
    {
        $attributeParts = explode('.', trim($attributeId));
        $array = [];
        foreach ($attributeParts as $key => $attributePart) {
Severity: Minor
Found in Xacml/PolicyInformationPoint.php - About 1 hr to fix

    Function onKernelRequest has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        public function onKernelRequest(GetResponseEvent $request)
        {
            $controller = $request->getRequest()->get('_controller');
            $controllerParts = explode('::', $controller);
            if (is_array($controllerParts) && count($controllerParts) == 2) {
    Severity: Minor
    Found in EventListener/ResourceRequestListener.php - About 55 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 evaluate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function evaluate(XacmlRequest $request)
        {
            $action = $request->get('Action');
            //Error pages not have Action name
            /**
    Severity: Minor
    Found in Xacml/PolicyDecisionPoint.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