/** * @param array $data * @return Schedules */ public static function create(array $data) { $schedulesCollection = new Schedules(); foreach ($data as $busLineResult) { $busLine = $busLineResult["_line"]; foreach ($busLineResult["_schedules"] as $schedule) { $schedulesCollection->append(self::createSchedule($schedule, $busLine)); } } return $schedulesCollection; }
/** * @expectedException InvalidArgumentException */ public function test_append_an_invalid_schedule_instance_should_rainse_an_exception() { $schedules = new Schedules(); $schedule = new \stdClass(); $schedules->append($schedule); }