Jelle-S/TheSportsDb

View on GitHub
src/Entity/EntityManager.php

Summary

Maintainability
A
2 hrs
Test Coverage

Method initPropertyMap has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  protected function initPropertyMap($entityType) {
    $this->propertyMaps[$entityType] = new Map();
    $entityManager = $this;
    foreach ($this->getPropertyMapDefinition($entityType)->getPropertyMaps() as $map) {
      $args = [
Severity: Minor
Found in src/Entity/EntityManager.php - About 1 hr to fix

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

      protected function initPropertyMap($entityType) {
        $this->propertyMaps[$entityType] = new Map();
        $entityManager = $this;
        foreach ($this->getPropertyMapDefinition($entityType)->getPropertyMaps() as $map) {
          $args = [
    Severity: Minor
    Found in src/Entity/EntityManager.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

    Missing class import via use statement (line '114', column '15').
    Open

        throw new \Exception('No repository container set.');
    Severity: Minor
    Found in src/Entity/EntityManager.php by phpmd

    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 '124', column '15').
    Open

        throw new \Exception('No factory container set.');
    Severity: Minor
    Found in src/Entity/EntityManager.php by phpmd

    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 '155', column '36').
    Open

          $propertyMapDefinition = new \ReflectionMethod($this->getClass($entityType), 'getPropertyMapDefinition');
    Severity: Minor
    Found in src/Entity/EntityManager.php by phpmd

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

        $reflection = new \ReflectionClass($this->getClass($entityType));
    Severity: Minor
    Found in src/Entity/EntityManager.php by phpmd

    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 '166', column '17').
    Open

          throw new \Exception(ucfirst($type) . ' class for ' . $entityType . ' not registered.');
    Severity: Minor
    Found in src/Entity/EntityManager.php by phpmd

    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 '175', column '19').
    Open

        $mapped = new \stdClass();
    Severity: Minor
    Found in src/Entity/EntityManager.php by phpmd

    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 '135', column '17').
    Open

          throw new \Exception('Class ' . $realClass . ' not found.');
    Severity: Minor
    Found in src/Entity/EntityManager.php by phpmd

    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 '138', column '26').
    Open

          $proxyClass = (new \ReflectionClass($realClass))->getNamespaceName() . '\\Proxy\\' . ucfirst($entityType) . 'Proxy';
    Severity: Minor
    Found in src/Entity/EntityManager.php by phpmd

    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 '193', column '21').
    Open

        $reversed = new \stdClass();
    Severity: Minor
    Found in src/Entity/EntityManager.php by phpmd

    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 '91', column '17').
    Open

          throw new \Exception('Factory container already set.');
    Severity: Minor
    Found in src/Entity/EntityManager.php by phpmd

    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 '101', column '17').
    Open

          throw new \Exception('Repository container already set.');
    Severity: Minor
    Found in src/Entity/EntityManager.php by phpmd

    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 '132', column '25').
    Open

          $realClass = (new \ReflectionClass(static::class))->getNamespaceName() . '\\' . ucfirst($entityType);
    Severity: Minor
    Found in src/Entity/EntityManager.php by phpmd

    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 '141', column '17').
    Open

          throw new \Exception('Class ' . $proxyClass . 'not found.');
    Severity: Minor
    Found in src/Entity/EntityManager.php by phpmd

    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

    There are no issues that match your filters.

    Category
    Status