Jelle-S/TheSportsDb

View on GitHub

Showing 31 of 92 total issues

Function raw has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  public function raw() {
    if (isset($this->_raw)) {
      return $this->_raw;
    }
    $this->_raw = new \stdClass();
Severity: Minor
Found in src/Entity/Entity.php - About 1 hr 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 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

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

      public function raw() {
        if ($this->entity) {
          $this->_raw = $this->entity->raw();
          return $this->_raw;
        }
    Severity: Minor
    Found in src/Entity/Proxy/Proxy.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

    Method transform has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      public static function transform($value, $context, EntityManagerInterface $entityManager, $entityType, $idName, array $contextPropertyMap = array()) {
    Severity: Minor
    Found in src/Entity/Entity.php - About 45 mins to fix

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

        protected function loadSeasons() {
          $leagueData = $this->sportsDbClient->doRequest('lookupleague.php', array('id' => $this->properties->id, 's' => 'all'));
          if (isset($leagueData->leagues)) {
            $leagues = $leagueData->leagues;
            foreach ($leagues as &$league) {
      Severity: Minor
      Found in src/Entity/Proxy/LeagueProxy.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

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

        public function update(\stdClass $values) {
          if ($this->entity instanceof EntityInterface) {
            $this->entity->update($values);
            return;
          }
      Severity: Minor
      Found in src/Entity/Proxy/Proxy.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

      The method initPropertyMapDefinition() has 197 lines of code. Current threshold is set to 100. Avoid really long methods.
      Open

        protected static function initPropertyMapDefinition() {
          static::$propertyMapDefinition
            ->addPropertyMap(
              new PropertyDefinition('idEvent'),
              new PropertyDefinition('id')
      Severity: Minor
      Found in src/Entity/Event.php by phpmd

      The method initPropertyMapDefinition() has 102 lines of code. Current threshold is set to 100. Avoid really long methods.
      Open

        protected static function initPropertyMapDefinition() {
          static::$propertyMapDefinition
            ->addPropertyMap(
              new PropertyDefinition('idLeague'),
              new PropertyDefinition('id')
      Severity: Minor
      Found in src/Entity/League.php by phpmd

      The method initPropertyMapDefinition() has 112 lines of code. Current threshold is set to 100. Avoid really long methods.
      Open

        protected static function initPropertyMapDefinition() {
          static::$propertyMapDefinition
            ->addPropertyMap(
              new PropertyDefinition('idPlayer'),
              new PropertyDefinition('id')
      Severity: Minor
      Found in src/Entity/Player.php by phpmd

      The method initPropertyMapDefinition() has 129 lines of code. Current threshold is set to 100. Avoid really long methods.
      Open

        protected static function initPropertyMapDefinition() {
          static::$propertyMapDefinition
            ->addPropertyMap(
              new PropertyDefinition('idTeam'),
              new PropertyDefinition('id')
      Severity: Minor
      Found in src/Entity/Team.php by phpmd
      Severity
      Category
      Status
      Source
      Language