Code Duplication    Length = 8-8 lines in 5 locations

src/Entity/Proxy/EventProxy.php 1 location

@@ 21-28 (lines=8) @@
18
  /**
19
   * {@inheritdoc}
20
   */
21
  public function load() {
22
    $eventData = $this->sportsDbClient->doRequest('lookupevent.php', array('id' => $this->properties->id));
23
    if (isset($eventData->events)) {
24
      $this->update($this->entityManager->mapProperties(reset($eventData->events), $this->getEntityType()));
25
      return;
26
    }
27
    throw new \Exception('Could not fully load event with id ' . $this->properties->id . '.');
28
  }
29
30
  /**
31
   * {@inheritdoc}

src/Entity/Proxy/LeagueProxy.php 1 location

@@ 21-28 (lines=8) @@
18
  /**
19
   * {@inheritdoc}
20
   */
21
  public function load() {
22
    $leagueData = $this->sportsDbClient->doRequest('lookupleague.php', array('id' => $this->properties->id));
23
    if (isset($leagueData->leagues)) {
24
      $this->update($this->entityManager->mapProperties(reset($leagueData->leagues), $this->getEntityType()));
25
      return;
26
    }
27
    throw new \Exception('Could not fully load league with id ' . $this->properties->id . '.');
28
  }
29
30
  /**
31
   * Lazy loads the seasons for this league.

src/Entity/Proxy/PlayerProxy.php 1 location

@@ 21-28 (lines=8) @@
18
  /**
19
   * {@inheritdoc}
20
   */
21
  public function load() {
22
    $playerData = $this->sportsDbClient->doRequest('lookupplayer.php', array('id' => $this->properties->id));
23
    if (isset($playerData->players)) {
24
      $this->update($this->entityManager->mapProperties(reset($playerData->players), $this->getEntityType()));
25
      return;
26
    }
27
    throw new \Exception('Could not fully load player with id ' . $this->properties->id . '.');
28
  }
29
30
  /**
31
   * {@inheritdoc}

src/Entity/Proxy/SportProxy.php 1 location

@@ 34-41 (lines=8) @@
31
   *
32
   * @return void
33
   */
34
  protected function loadLeagues() {
35
    $leagueData = $this->sportsDbClient->doRequest('search_all_leagues.php', array('s' => $this->properties->id));
36
    if (isset($leagueData->countrys)) {
37
      $this->update($this->entityManager->mapProperties((object) array('leagues' => $leagueData->countrys), $this->getEntityType()));
38
      return;
39
    }
40
    throw new \Exception('Could not fully load sport with id ' . $this->properties->id . '.');
41
  }
42
43
  /**
44
   * {@inheritdoc}

src/Entity/Proxy/TeamProxy.php 1 location

@@ 21-28 (lines=8) @@
18
  /**
19
   * {@inheritdoc}
20
   */
21
  public function load() {
22
    $teamData = $this->sportsDbClient->doRequest('lookupteam.php', array('id' => $this->properties->id));
23
    if (isset($teamData->teams)) {
24
      $this->update($this->entityManager->mapProperties(reset($teamData->teams), $this->getEntityType()));
25
      return;
26
    }
27
    throw new \Exception('Could not fully load team with id ' . $this->properties->id . '.');
28
  }
29
30
  /**
31
   * {@inheritdoc}