private function getTimeObjects(array $data) {
    $date = \DateTime::createFromFormat(
      self::API_DATE_FORMAT,
      $data['date'],
      new \DateTimeZone(self::API_TIMEZONE)
    );

    $sourceTimes = explode('-', $data['time']);

    $sourceTimeStart = date_parse($sourceTimes[0]);
    if (!$sourceTimeStart) {
      throw new \Exception(sprintf('Failed to parse time %s', $sourceTimes[0]));
    }

    $sourceTimeEnd = date_parse($sourceTimes[1]);
    if (!$sourceTimeEnd) {
      throw new \Exception(sprintf('Failed to parse time %s', $sourceTimes[1]));
    }

    $dateStart = clone($date);
    $dateEnd = clone($date);

    $dateStart->setTime($sourceTimeStart['hour'], $sourceTimeStart['minute']);
    $dateEnd->setTime($sourceTimeEnd['hour'], $sourceTimeEnd['minute']);

    return [
      'start' => $dateStart,
      'end' => $dateEnd,
    ];
  }
private function getTimeObjects(array $data) {
    $date = \DateTime::createFromFormat(
      self::API_DATE_FORMAT,
      $data['date'],
      new \DateTimeZone(self::API_TIMEZONE)
    );

    $sourceTimes = explode('-', $data['time']);

    $sourceTimeStart = date_parse($sourceTimes[0]);
    if (!$sourceTimeStart) {
      throw new \Exception(sprintf('Failed to parse time %s', $sourceTimes[0]));
    }

    $sourceTimeEnd = date_parse($sourceTimes[1]);
    if (!$sourceTimeEnd) {
      throw new \Exception(sprintf('Failed to parse time %s', $sourceTimes[1]));
    }

    $dateStart = clone($date);
    $dateEnd = clone($date);

    $dateStart->setTime($sourceTimeStart['hour'], $sourceTimeStart['minute']);
    $dateEnd->setTime($sourceTimeEnd['hour'], $sourceTimeEnd['minute']);

    return [
      'start' => $dateStart,
      'end' => $dateEnd,
    ];
  }
private function getTimeObjects ( array $ data ) { $ date = \ DateTime :: createFromFormat ( self :: API_DATE_FORMAT , $ data [ 'date' ] , new \ DateTimeZone ( self :: API_TIMEZONE ) ) ; $ sourceTimes = explode ( '-' , $ data [ 'time' ] ) ; $ sourceTimeStart = date_parse ( $ sourceTimes [ 0 ] ) ; if ( ! $ sourceTimeStart ) { throw new \ Exception ( sprintf ( 'Failed to parse time %s' , $ sourceTimes [ 0 ] ) ) ; } $ sourceTimeEnd = date_parse ( $ sourceTimes [ 1 ] ) ; if ( ! $ sourceTimeEnd ) { throw new \ Exception ( sprintf ( 'Failed to parse time %s' , $ sourceTimes [ 1 ] ) ) ; } $ dateStart = clone ( $ date ) ; $ dateEnd = clone ( $ date ) ; $ dateStart -> setTime ( $ sourceTimeStart [ 'hour' ] , $ sourceTimeStart [ 'minute' ] ) ; $ dateEnd -> setTime ( $ sourceTimeEnd [ 'hour' ] , $ sourceTimeEnd [ 'minute' ] ) ; return [ 'start' => $ dateStart , 'end' => $ dateEnd , ] ; }
Get time objects from class.

@param array $data
Class data.

@return array
Array with date objects.

@throws \Exception
Get time objects from class .