Skip to content
Snippets Groups Projects

Hotline 6.53

Merged Laurent requested to merge hotline_6.53 into WIP
Compare and
+ 294
248
Preferences
Compare changes
Files
+ 54
0
<?php
/**
* Copyright (c) 2012, Agence Française Informatique (AFI). All rights reserved.
*
* AFI-OPAC 2.0 is free software; you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
* the Free Software Foundation.
*
* There are special exceptions to the terms and conditions of the AGPL as it
* is applied to this software (see README file).
*
* AFI-OPAC 2.0 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with AFI-OPAC 2.0; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
abstract class CodifCacheAbstract {
static $_instance;
protected $_cache = [];
public static function getInstance() {
if (!isset(static::$_instance))
static::$_instance = new static();
return static::$_instance;
}
public function find($code) {
if (!isset($this->_cache[$code]))
$this->_cache[$code] = $this->load($code);
return $this->_cache[$code];
}
abstract public function load($code);
}
class CodifAnnexeCache extends CodifCacheAbstract {
public function load($code) {
return Class_CodifAnnexe::findFirstBy(['code' => $code]);
}
}
?>
\ No newline at end of file