src/Overcast.php
public function getForecast($latitude, $longitude, \DateTime $time = null, array $parameters = null)
    {
        try {
            $response = $this->adapter->getForecast($latitude, $longitude, $time, $parameters);
            $responseHeaders = $this->adapter->getHeaders();

            if (NULL !== $responseHeaders['apiCalls']) {
                $this->apiCalls = $responseHeaders['apiCalls'];
            }

            $cacheAge = 0;
            if (NULL !== $responseHeaders['cache']['maxAge']) {
                $cacheAge = $responseHeaders['cache']['maxAge'];
            } elseif (NULL !== $responseHeaders['cache']['expires']) {
                $cacheAge = (new \DateTime())->getTimestamp() - (new \DateTime($responseHeaders['cache']['expires']))->getTimestamp();
            }

            return new Forecast($response, $cacheAge, $responseHeaders['responseTime']);
        } catch (\Exception $e) {
            return null;
        }
    }
public function getForecast($latitude, $longitude, \DateTime $time = null, array $parameters = null)
    {
        try {
            $response = $this->adapter->getForecast($latitude, $longitude, $time, $parameters);
            $responseHeaders = $this->adapter->getHeaders();

            if (NULL !== $responseHeaders['apiCalls']) {
                $this->apiCalls = $responseHeaders['apiCalls'];
            }

            $cacheAge = 0;
            if (NULL !== $responseHeaders['cache']['maxAge']) {
                $cacheAge = $responseHeaders['cache']['maxAge'];
            } elseif (NULL !== $responseHeaders['cache']['expires']) {
                $cacheAge = (new \DateTime())->getTimestamp() - (new \DateTime($responseHeaders['cache']['expires']))->getTimestamp();
            }

            return new Forecast($response, $cacheAge, $responseHeaders['responseTime']);
        } catch (\Exception $e) {
            return null;
        }
    }
public function getForecast ( $ latitude , $ longitude , \ DateTime $ time = null , array $ parameters = null ) { try { $ response = $ this -> adapter -> getForecast ( $ latitude , $ longitude , $ time , $ parameters ) ; $ responseHeaders = $ this -> adapter -> getHeaders ( ) ; if ( NULL !== $ responseHeaders [ 'apiCalls' ] ) { $ this -> apiCalls = $ responseHeaders [ 'apiCalls' ] ; } $ cacheAge = 0 ; if ( NULL !== $ responseHeaders [ 'cache' ] [ 'maxAge' ] ) { $ cacheAge = $ responseHeaders [ 'cache' ] [ 'maxAge' ] ; } elseif ( NULL !== $ responseHeaders [ 'cache' ] [ 'expires' ] ) { $ cacheAge = ( new \ DateTime ( ) ) -> getTimestamp ( ) - ( new \ DateTime ( $ responseHeaders [ 'cache' ] [ 'expires' ] ) ) -> getTimestamp ( ) ; } return new Forecast ( $ response , $ cacheAge , $ responseHeaders [ 'responseTime' ] ) ; } catch ( \ Exception $ e ) { return null ; } }
Retrieve the forecast for the specified latitude and longitude and
optionally the specified date and time.

@param $latitude
@param $longitude
@param \DateTime $time
@param array $parameters

@return Forecast
Retrieve the forecast for the specified latitude and longitude and optionally the specified date and time .