DigitalState/Platform-User-Bundle

View on GitHub

Showing 5 of 5 total issues

Function get has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

    public function get($variable)
    {
        if (!preg_match(static::PATTERN, $variable, $matches)) {
            throw new DomainException('Variable pattern is not valid.');
        }
Severity: Minor
Found in Data/Resolver/SessionResolver.php - About 4 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 import has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

    public function import($resource, ObjectManager $objectManager)
    {
        $data = Yaml::parse(file_get_contents($resource));

        foreach ($data['users'] as $item) {
Severity: Minor
Found in Migration/Extension/UserExtension.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 import has 57 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function import($resource, ObjectManager $objectManager)
    {
        $data = Yaml::parse(file_get_contents($resource));

        foreach ($data['users'] as $item) {
Severity: Major
Found in Migration/Extension/UserExtension.php - About 2 hrs to fix

    Method get has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function get($variable)
        {
            if (!preg_match(static::PATTERN, $variable, $matches)) {
                throw new DomainException('Variable pattern is not valid.');
            }
    Severity: Minor
    Found in Data/Resolver/SessionResolver.php - About 1 hr to fix

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

          public function import($resource, ObjectManager $objectManager)
          {
              $data = Yaml::parse(file_get_contents($resource));
      
              foreach ($data['groups'] as $item) {
      Severity: Minor
      Found in Migration/Extension/GroupExtension.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

      Severity
      Category
      Status
      Source
      Language