Example #1
0
 private function fillGameMlsEntityForTeam($row, $round)
 {
     $gameEntity = new GameMlsEntity();
     $gameEntity->setRound($round);
     $teamHome = $row->find('td.team-h a', 0);
     if ($teamHome) {
         $gameEntity->setTeamHome($teamHome->innertext);
     }
     $teamHomeIcon = $row->find('td.team-ico-h div.team-embl img', 0);
     if ($teamHomeIcon) {
         $gameEntity->setTeamHomeIcon($teamHomeIcon->src);
     }
     $teamVisit = $row->find('td.team-a a', 0);
     if ($teamVisit) {
         $gameEntity->setTeamVisit($teamVisit->innertext);
     }
     $teamVisitIcon = $row->find('td.team-ico-a div.team-embl img', 0);
     if ($teamVisitIcon) {
         $gameEntity->setTeamVisitIcon($teamVisitIcon->src);
     }
     $gameDate = $row->find('td.match-day-date', 0);
     if ($gameDate) {
         $gameEntity->setMatchDate(Carbon::parse(trim($gameDate->innertext)));
     }
     $gameLinkNotPlayed = $row->find('span.score a.so_not_played', 0);
     $gameLinkPlayed = $row->find('span.score a.bdtooltip', 0);
     if ($gameLinkNotPlayed) {
         $gameEntity->setLink($gameLinkNotPlayed->href);
     } elseif ($gameLinkPlayed) {
         $gameEntity->setLink($gameLinkPlayed->href);
     }
     $placeTd = $row->find('td', -2);
     if ($placeTd) {
         $place = $placeTd->find('a', 0);
         if ($place) {
             $gameEntity->setPlace($place->innertext);
         }
     }
     return $gameEntity;
 }
 private function fillGameMlsEntityForTeam($row, $round)
 {
     $gameEntity = new GameMlsEntity();
     $roundRow = $row->find('td.m_name', 0);
     if ($roundRow) {
         $round = $roundRow->innertext;
         $round = substr($round, 0, strpos($round, '(Группа'));
         $round = trim($round);
         $gameEntity->setRound($round);
         preg_match('/>([^<]+)</', $roundRow->innertext, $matches);
         if (isset($matches[1]) && $matches[1]) {
             $gameEntity->setMatchDate(Carbon::parse($matches[1]));
         }
     }
     $teamHome = $row->find('td.team-h span', 0);
     if ($teamHome) {
         $gameEntity->setTeamHome($teamHome->innertext);
     }
     $teamHomeIcon = $row->find('td.team-ico-h-l div.team-embl img', 0);
     if ($teamHomeIcon) {
         $gameEntity->setTeamHomeIcon($teamHomeIcon->src);
     }
     $teamVisit = $row->find('td.team-a', 0);
     if ($teamVisit) {
         $gameEntity->setTeamVisit($teamVisit->innertext);
     }
     $teamVisitIcon = $row->find('td.team-ico-a div.team-embl img', 0);
     if ($teamVisitIcon) {
         $gameEntity->setTeamVisitIcon($teamVisitIcon->src);
     }
     $gameLinkPlayed = $row->find('a.button-details', 0);
     if ($gameLinkPlayed) {
         $gameEntity->setLink($gameLinkPlayed->href);
     }
     $placeTd = $row->find('td', -3);
     if ($placeTd) {
         $place = $placeTd->find('a', 0);
         if ($place) {
             $gameEntity->setPlace($place->innertext);
         }
     }
     return $gameEntity;
 }