src/fwidm/dwdHourlyCrawler/hourly/DWDHourlyCrawler.php
private function retrieveData($content, DWDStation $nearestStation, Coordinate $coordinate, AbstractHourlyService $hourlyController, DateTime $dateTime, $timeMinuteLimit)
    {
        //custom time limit
        $timeBefore = Carbon::instance($dateTime);
        $timeAfter = Carbon::instance($dateTime);

        $timeBefore->addMinute($timeMinuteLimit);
        $timeAfter->addMinute(-$timeMinuteLimit);

        $data = $hourlyController->parseHourlyData($content, $nearestStation, $coordinate, $timeAfter, $timeBefore);

        // 3 hour interval -> +- 90min if custom failed.
        if (count($data) == 0 && $timeMinuteLimit < 90) {
            DWDUtil::log(self::class, "retrieving data for a +-90min time limit...");
            $data = $this->retrieveData($content, $nearestStation, $coordinate, $hourlyController, $dateTime, 90);
        } else      // 7 hour interval -> +-210min if custom and 3h limit failed.
            if (count($data) == 0 && $timeMinuteLimit < 210) {
                DWDUtil::log(self::class, "retrieving data for a +-210min time limit...");
                $data = $this->retrieveData($content, $nearestStation, $coordinate, $hourlyController, $dateTime, 210);
            }

        return $data;
    }
private function retrieveData($content, DWDStation $nearestStation, Coordinate $coordinate, AbstractHourlyService $hourlyController, DateTime $dateTime, $timeMinuteLimit)
    {
        //custom time limit
        $timeBefore = Carbon::instance($dateTime);
        $timeAfter = Carbon::instance($dateTime);

        $timeBefore->addMinute($timeMinuteLimit);
        $timeAfter->addMinute(-$timeMinuteLimit);

        $data = $hourlyController->parseHourlyData($content, $nearestStation, $coordinate, $timeAfter, $timeBefore);

        // 3 hour interval -> +- 90min if custom failed.
        if (count($data) == 0 && $timeMinuteLimit < 90) {
            DWDUtil::log(self::class, "retrieving data for a +-90min time limit...");
            $data = $this->retrieveData($content, $nearestStation, $coordinate, $hourlyController, $dateTime, 90);
        } else      // 7 hour interval -> +-210min if custom and 3h limit failed.
            if (count($data) == 0 && $timeMinuteLimit < 210) {
                DWDUtil::log(self::class, "retrieving data for a +-210min time limit...");
                $data = $this->retrieveData($content, $nearestStation, $coordinate, $hourlyController, $dateTime, 210);
            }

        return $data;
    }
private function retrieveData ( $ content , DWDStation $ nearestStation , Coordinate $ coordinate , AbstractHourlyService $ hourlyController , DateTime $ dateTime , $ timeMinuteLimit ) { //custom time limit $ timeBefore = Carbon :: instance ( $ dateTime ) ; $ timeAfter = Carbon :: instance ( $ dateTime ) ; $ timeBefore -> addMinute ( $ timeMinuteLimit ) ; $ timeAfter -> addMinute ( - $ timeMinuteLimit ) ; $ data = $ hourlyController -> parseHourlyData ( $ content , $ nearestStation , $ coordinate , $ timeAfter , $ timeBefore ) ; // 3 hour interval -> +- 90min if custom failed. if ( count ( $ data ) == 0 && $ timeMinuteLimit < 90 ) { DWDUtil :: log ( self :: class , "retrieving data for a +-90min time limit..." ) ; $ data = $ this -> retrieveData ( $ content , $ nearestStation , $ coordinate , $ hourlyController , $ dateTime , 90 ) ; } else // 7 hour interval -> +-210min if custom and 3h limit failed. if ( count ( $ data ) == 0 && $ timeMinuteLimit < 210 ) { DWDUtil :: log ( self :: class , "retrieving data for a +-210min time limit..." ) ; $ data = $ this -> retrieveData ( $ content , $ nearestStation , $ coordinate , $ hourlyController , $ dateTime , 210 ) ; } return $ data ; }
DWD Hourly data is not really hourly, as such first try to query with the specified limit, then, if the limit is smaller than +-1.5h or +-3.5h
Query those values and return them.
@param $content - of the zip
@param AbstractHourlyService $hourlyController - the controller that should parse the data
@param DateTime $dateTime - the data for which we want to query
@param $timeMinuteLimit - limit in minutes that defines the range: currentDate+-limit = search range.
@return array of DWDAbstractParameter
DWD Hourly data is not really hourly as such first try to query with the specified limit then if the limit is smaller than + - 1 . 5h or + - 3 . 5h Query those values and return them .