-
Notifications
You must be signed in to change notification settings - Fork 0
/
AliasExpander.php
64 lines (49 loc) · 1.09 KB
/
AliasExpander.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
namespace Milo\Nette;
use Milo,
Nette\Caching\Cache,
Nette\Caching\IStorage;
/**
* AliasExpander with Nette (http://nette.org) cache implementation.
*
* You can choose one of four licences:
*
* @licence New BSD License
* @licence GNU General Public License version 2
* @licence GNU General Public License version 3
* @licence MIT
*
* @version $Format:%h$
* @see https://github.com/milo/alias-expander
*
* @author Miloslav Hůla (https://github.com/milo)
*/
class AliasExpander extends Milo\AliasExpander
{
/** @var Cache */
private $cache;
public function __construct(IStorage $storage)
{
$this->cache = new Cache($storage, str_replace('\\', '.', get_class($this)));
}
/**
* Loads data from cache.
* @param string
* @return mixed
*/
protected function load($file)
{
return $this->cache->load($file);
}
/**
* Store data to cache.
* @param string path to parsed PHP file
* @param mixed
* @return self
*/
protected function store($file, $data)
{
$this->cache->save($file, $data, array(Cache::FILES => $file));
return $this;
}
}