/** * @param string[] $row * @return BlackoutSeries */ public static function FromRow($row) { $series = new BlackoutSeries($row[ColumnNames::OWNER_USER_ID], $row[ColumnNames::BLACKOUT_TITLE]); $series->WithId($row[ColumnNames::BLACKOUT_SERIES_ID]); $series->SetCurrentBlackout(new DateRange(Date::FromDatabase($row[ColumnNames::BLACKOUT_START]), Date::FromDatabase($row[ColumnNames::BLACKOUT_END]))); $series->WithCurrentBlackoutId($row[ColumnNames::BLACKOUT_INSTANCE_ID]); $configuration = RepeatConfiguration::Create($row[ColumnNames::REPEAT_TYPE], $row[ColumnNames::REPEAT_OPTIONS]); $factory = new RepeatOptionsFactory(); $options = $factory->Create($row[ColumnNames::REPEAT_TYPE], $configuration->Interval, $configuration->TerminationDate, $configuration->Weekdays, $configuration->MonthlyType); $series->WithRepeatOptions($options); return $series; }