Example #1
0
 function set_opponent($opponent, $team)
 {
     $data = explode(" (", $opponent);
     if (strpos($data[1], "H") !== false) {
         // home game
         $this->set_home_team($team);
         $this->set_away_team(Club::get_club_id($data[0]));
     } else {
         $this->set_home_team(Club::get_club_id($data[0]));
         $this->set_away_team($team);
     }
 }
Example #2
0
 public function parseDataToObject($data)
 {
     try {
         $this->set_transfersOut($data->transfers_out);
         $this->set_playerCode($data->code);
         $this->set_eventTotal($data->event_total);
         $this->set_lastSeasonPoints($data->last_season_points);
         $this->set_squadNumber($data->squad_number);
         $this->set_newsUpdated($data->news_updated);
         $this->set_eventCost($data->event_cost);
         $this->set_newsAdded($data->news_added);
         $this->set_webName($data->web_name);
         $this->set_inDreamTeam($data->in_dreamteam);
         $this->set_teamCode($data->team_code);
         $this->set_id($data->id);
         $this->set_shirtImageUrl($data->shirt_image_url);
         $this->set_firstName($data->first_name);
         $this->set_transfersOutEvent($data->transfers_out_event);
         $this->set_elementTypeId($data->element_type_id);
         $this->set_maxCost($data->max_cost);
         $this->set_eventExplain($data->event_explain);
         $this->set_selected($data->selected);
         $this->set_minCost($data->min_cost);
         $this->set_totalPoints($data->total_points);
         $this->set_typeName($data->type_name);
         $this->set_teamName($data->team_name);
         $this->set_status($data->status);
         $this->set_added($data->added);
         $this->set_form($data->form);
         $this->set_shirtMobileImageUrl($data->shirt_mobile_image_url);
         $this->set_currentFixture($data->current_fixture);
         $this->set_nowCost($data->now_cost);
         $this->set_pointsPerGame($data->points_per_game);
         $this->set_transfersIn($data->transfers_in);
         $this->set_news($data->news);
         $this->set_originalCost($data->original_cost);
         $this->set_eventPoints($data->event_points);
         $this->set_newsReturn($data->news_return);
         $this->set_nextFixture($data->next_fixture);
         $this->set_transfersInEvent($data->transfers_in_event);
         $this->set_selectedBy($data->selected_by);
         $this->set_teamId(Club::get_club_id($this->get_teamName()));
         $this->set_secondName($data->second_name);
         $this->set_photoMobileUrl($data->photo_mobile_url);
         $this->set_fixtures($data->fixtures->all, $this->get_teamId());
         $this->set_seasonHistory($data->season_history);
         $this->set_fixtureHistory($data->id, $data->fixture_history->all);
     } catch (Exception $e) {
         echo "Exception occured";
     }
 }
function parse_past_fixtures($allData)
{
    foreach ($allData as $data) {
        $players = array(59936, 1882, 66797, 15144, 11334, 11554, 15337, 10318, 12390, 15749, 51940, 20480, 19236, 18726, 40349, 20531, 39215, 37915, 9089, 42525);
        if (in_array((int) $data->code, $players)) {
            $history = $data->fixture_history->all;
            foreach ($history as $game) {
                $fixture = new DataHistoricalFixture($game, Club::get_club_id($data->team_name));
                $fixture->save();
            }
            echo "Parsed fixtures for {$data->team_name}\n";
        }
    }
}