app\WeatherApi::data PHP Method

data() public method

public data ( )
    public function data()
    {
        return Cache::get('Weather.reads') ?: $this->update();
    }

Usage Example

コード例 #1
0
 public function testCache()
 {
     $json_test = basename(dirname(__DIR__)) . '/_data/weather_test.json';
     $api = new WeatherApi();
     $api->update($json_test);
     $update_date1 = $api->data()->updated_at;
     $api2 = new WeatherApi();
     $update_date2 = $api2->data()->updated_at;
     $this->assertEquals($update_date1, $update_date2);
 }
WeatherApi