Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class MojeSluzba
- {
- public static function createMojeSluzba($options)
- {
- $mojeSluzba = new static(self::createCache());
- // nebo jednoduše
- // $mojeSluzba = new static(Nette\Environment::getCache('MojeSluzba'));
- $mojeSluzba->setNecoDalsiho($options['nejakaHodnota']);
- return $mojeSluzba;
- }
- private static function createCache()
- {
- // popř. vytvořit vlastní instanci storage - což je ale zbytečné a zbytečně složité
- $storage = Nette\Environment::getApplication()->getService('Nette\\Caching\\ICacheStorage');
- return new Nette\Caching\Cache($storage, 'MojeSluzba');
- }
- }
Add Comment
Please, Sign In to add comment