Skip to content

Commit 60d6e9d

Browse files
committed
Added *MUCH* more documentation.
1 parent 546f67c commit 60d6e9d

File tree

16 files changed

+645
-353
lines changed

16 files changed

+645
-353
lines changed

Example_Cache.php

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,67 @@
11
<?php
2+
/**
3+
* OpenWeatherMap-PHP-API — An php api to parse weather data from http://www.OpenWeatherMap.org .
4+
*
5+
* @license MIT
6+
*
7+
* Please see the LICENSE file distributed with this source code for further
8+
* information regarding copyright and licensing.
9+
*
10+
* Please visit the following links to read about the usage policies and the license of OpenWeatherMap before using this class.
11+
* @see http://www.OpenWeatherMap.org
12+
* @see http://www.OpenWeatherMap.org/about
13+
* @see http://www.OpenWeatherMap.org/copyright
14+
* @see http://openweathermap.org/appid
15+
*/
216

317
use cmfcmf\OpenWeatherMap;
18+
use cmfcmf\OpenWeatherMap\AbstractCache;
419

520
require('cmfcmf/OpenWeatherMap.php');
621

22+
/**
23+
* Example cache implementation.
24+
*
25+
* @ignore
26+
*/
27+
class ExampleCache extends AbstractCache
28+
{
29+
/**
30+
* @inheritdoc
31+
*/
32+
public function isCached($type, $query, $units, $lang, $mode)
33+
{
34+
echo "Checking cache for $type $query $units $lang $mode …<br />";
35+
return false;
36+
}
37+
38+
/**
39+
* @inheritdoc
40+
*/
41+
public function getCached($type, $query, $units, $lang, $mode)
42+
{
43+
echo "Get cache for $type $query $units $lang $mode …<br />";
44+
return false;
45+
}
46+
47+
/**
48+
* @inheritdoc
49+
*/
50+
public function setCached($type, $content, $query, $units, $lang, $mode)
51+
{
52+
echo "Set cache for $type $query $units $lang $mode … ({$this->seconds} seconds)<br />";
53+
return false;
54+
}
55+
}
56+
757
// Language of data (try your own language here!):
858
$lang = 'de';
959

1060
// Units (can be 'metric' or 'imperial' [default]):
1161
$units = 'metric';
1262

1363
// Example 1: Use your own cache implementation. See the example_cache file.
14-
$owm = new OpenWeatherMap('examplecache', 100);
64+
$owm = new OpenWeatherMap('ExampleCache', 100);
1565

1666
$weather = $owm->getWeather('Berlin', $units, $lang);
1767
echo "EXAMPLE 1<hr />\n\n\n";

Examples.php

Lines changed: 0 additions & 230 deletions
This file was deleted.

0 commit comments

Comments
 (0)