@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | $this->memcache = new Memcache(); |
36 | 36 | } |
37 | 37 | |
38 | - public function connect ($host, $port) { |
|
38 | + public function connect($host, $port) { |
|
39 | 39 | $this->memcache->connect($host, $port); |
40 | 40 | } |
41 | 41 | |
@@ -88,11 +88,11 @@ discard block |
||
88 | 88 | } |
89 | 89 | } |
90 | 90 | |
91 | - protected function getKey ($area, $key) { |
|
91 | + protected function getKey($area, $key) { |
|
92 | 92 | return md5($area) . md5($key); |
93 | 93 | } |
94 | 94 | |
95 | - private function listAllKeys ($limit = 10000) { |
|
95 | + private function listAllKeys($limit = 10000) { |
|
96 | 96 | //list with keys |
97 | 97 | $keys = array(); |
98 | 98 |
@@ -30,13 +30,13 @@ discard block |
||
30 | 30 | } |
31 | 31 | |
32 | 32 | public function get($area, $key) { |
33 | - if ($this->contains($area, $key)) { |
|
34 | - $file_path = $this->getFilePath($area, $key); |
|
35 | - //echo "area: " . $area . ", key: " . $key . ", File path: " . $file_path . "<br />\n"; |
|
33 | + if ($this->contains($area, $key)) { |
|
34 | + $file_path = $this->getFilePath($area, $key); |
|
35 | + //echo "area: " . $area . ", key: " . $key . ", File path: " . $file_path . "<br />\n"; |
|
36 | 36 | |
37 | - $content = file_get_contents($file_path); |
|
37 | + $content = file_get_contents($file_path); |
|
38 | 38 | |
39 | - //echo $content; |
|
39 | + //echo $content; |
|
40 | 40 | |
41 | 41 | return unserialize($content); |
42 | 42 | } else { |
@@ -45,12 +45,12 @@ discard block |
||
45 | 45 | } |
46 | 46 | |
47 | 47 | public function contains ($area, $key) : bool { |
48 | - return CACHING && file_exists($this->getFilePath($area, $key)); |
|
48 | + return CACHING && file_exists($this->getFilePath($area, $key)); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | protected function getFilePath (string $area, string $key) : string { |
52 | - return CACHE_PATH . md5($area) . "/" . md5($key) . ".php"; |
|
53 | - } |
|
52 | + return CACHE_PATH . md5($area) . "/" . md5($key) . ".php"; |
|
53 | + } |
|
54 | 54 | |
55 | 55 | private function check_directory ($name) { |
56 | 56 | if (!file_exists(CACHE_PATH . $name . "/")) { |
@@ -74,23 +74,23 @@ discard block |
||
74 | 74 | if (empty($area)) { |
75 | 75 | $this->rrmdir(CACHE_PATH, CACHE_PATH); |
76 | 76 | } else { |
77 | - //area is not null |
|
78 | - |
|
79 | - $area_path = CACHE_PATH . md5($area) . "/"; |
|
80 | - |
|
81 | - if (!empty($key)) { |
|
82 | - $file_path = CACHE_PATH . md5($area) . "/" + md5($key) + ".php"; |
|
83 | - |
|
84 | - //check, if file exists |
|
85 | - if (file_exists($file_path)) { |
|
86 | - //remove file |
|
87 | - unlink($file_path); |
|
88 | - } |
|
89 | - } else { |
|
90 | - //clear full area |
|
91 | - $this->rrmdir($area_path, CACHE_PATH); |
|
92 | - } |
|
93 | - } |
|
77 | + //area is not null |
|
78 | + |
|
79 | + $area_path = CACHE_PATH . md5($area) . "/"; |
|
80 | + |
|
81 | + if (!empty($key)) { |
|
82 | + $file_path = CACHE_PATH . md5($area) . "/" + md5($key) + ".php"; |
|
83 | + |
|
84 | + //check, if file exists |
|
85 | + if (file_exists($file_path)) { |
|
86 | + //remove file |
|
87 | + unlink($file_path); |
|
88 | + } |
|
89 | + } else { |
|
90 | + //clear full area |
|
91 | + $this->rrmdir($area_path, CACHE_PATH); |
|
92 | + } |
|
93 | + } |
|
94 | 94 | // TODO: Implement clear() method. |
95 | 95 | } |
96 | 96 |
@@ -44,15 +44,15 @@ discard block |
||
44 | 44 | } |
45 | 45 | } |
46 | 46 | |
47 | - public function contains ($area, $key) : bool { |
|
47 | + public function contains($area, $key) : bool { |
|
48 | 48 | return CACHING && file_exists($this->getFilePath($area, $key)); |
49 | 49 | } |
50 | 50 | |
51 | - protected function getFilePath (string $area, string $key) : string { |
|
51 | + protected function getFilePath(string $area, string $key) : string { |
|
52 | 52 | return CACHE_PATH . md5($area) . "/" . md5($key) . ".php"; |
53 | 53 | } |
54 | 54 | |
55 | - private function check_directory ($name) { |
|
55 | + private function check_directory($name) { |
|
56 | 56 | if (!file_exists(CACHE_PATH . $name . "/")) { |
57 | 57 | mkdir(CACHE_PATH . $name . "/"); |
58 | 58 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $area_path = CACHE_PATH . md5($area) . "/"; |
80 | 80 | |
81 | 81 | if (!empty($key)) { |
82 | - $file_path = CACHE_PATH . md5($area) . "/" + md5($key) + ".php"; |
|
82 | + $file_path = CACHE_PATH . md5($area) . "/" +md5($key) + ".php"; |
|
83 | 83 | |
84 | 84 | //check, if file exists |
85 | 85 | if (file_exists($file_path)) { |
@@ -94,15 +94,15 @@ discard block |
||
94 | 94 | // TODO: Implement clear() method. |
95 | 95 | } |
96 | 96 | |
97 | - protected function rrmdir ($dir, $cache_dir) { |
|
97 | + protected function rrmdir($dir, $cache_dir) { |
|
98 | 98 | if (is_dir($dir)) { |
99 | 99 | $objects = scandir($dir); |
100 | 100 | foreach ($objects as $object) { |
101 | 101 | if ($object != "." && $object != "..") { |
102 | - if (is_dir($dir."/".$object)) |
|
103 | - $this->rrmdir($dir."/".$object, $cache_dir); |
|
102 | + if (is_dir($dir . "/" . $object)) |
|
103 | + $this->rrmdir($dir . "/" . $object, $cache_dir); |
|
104 | 104 | else |
105 | - unlink($dir."/".$object); |
|
105 | + unlink($dir . "/" . $object); |
|
106 | 106 | } |
107 | 107 | } |
108 | 108 |
@@ -99,10 +99,11 @@ |
||
99 | 99 | $objects = scandir($dir); |
100 | 100 | foreach ($objects as $object) { |
101 | 101 | if ($object != "." && $object != "..") { |
102 | - if (is_dir($dir."/".$object)) |
|
103 | - $this->rrmdir($dir."/".$object, $cache_dir); |
|
104 | - else |
|
105 | - unlink($dir."/".$object); |
|
102 | + if (is_dir($dir."/".$object)) { |
|
103 | + $this->rrmdir($dir."/".$object, $cache_dir); |
|
104 | + } else { |
|
105 | + unlink($dir."/".$object); |
|
106 | + } |
|
106 | 107 | } |
107 | 108 | } |
108 | 109 |
@@ -17,7 +17,7 @@ |
||
17 | 17 | |
18 | 18 | class PostGreSQLDriver extends MySQLDriver { |
19 | 19 | |
20 | - public function connect ($config_path) { |
|
20 | + public function connect($config_path) { |
|
21 | 21 | if (file_exists($config_path)) { |
22 | 22 | require($config_path); |
23 | 23 | } else if (file_exists(CONFIG_PATH . $config_path)) { |
@@ -163,7 +163,7 @@ |
||
163 | 163 | } |
164 | 164 | } |
165 | 165 | |
166 | - protected function getKey ($area, $key) { |
|
166 | + protected function getKey($area, $key) { |
|
167 | 167 | return md5($area) . md5($key); |
168 | 168 | } |
169 | 169 |
@@ -18,7 +18,7 @@ |
||
18 | 18 | |
19 | 19 | class Packages { |
20 | 20 | |
21 | - public static function listPackages (bool $installed_required = true) : array { |
|
21 | + public static function listPackages(bool $installed_required = true) : array { |
|
22 | 22 | |
23 | 23 | if (!file_exists(ROOT_PATH . "store/package_list.php")) { |
24 | 24 | return array(); |
@@ -115,8 +115,8 @@ discard block |
||
115 | 115 | } |
116 | 116 | |
117 | 117 | if (!(self::$second_level_cache instanceof ICache)) { |
118 | - throw new Exception("second level cache is not instance of ICache."); |
|
119 | - } |
|
118 | + throw new Exception("second level cache is not instance of ICache."); |
|
119 | + } |
|
120 | 120 | |
121 | 121 | return self::$second_level_cache; |
122 | 122 | } |
@@ -148,27 +148,27 @@ discard block |
||
148 | 148 | unset(self::$cache_instances[$name]); |
149 | 149 | } |
150 | 150 | |
151 | - /** |
|
152 | - * put session |
|
153 | - * |
|
154 | - * @param $area cache area |
|
155 | - * @param $key cache key |
|
156 | - * @param $value cache entry value, can also be an object |
|
157 | - * @param $ttl time to live of cache entry in seconds (optional) |
|
158 | - */ |
|
159 | - public static function put(string $area, string $key, $value, $ttl = 180 * 60) { |
|
160 | - self::getCache()->put($area, $key, $value, $ttl); |
|
161 | - } |
|
162 | - |
|
163 | - public static function get(string $area, string $key) { |
|
164 | - return self::getCache()->get($area, $key); |
|
165 | - } |
|
166 | - |
|
167 | - public static function contains(string $area, string $key) : bool { |
|
168 | - return self::getCache()->contains($area, $key); |
|
169 | - } |
|
170 | - |
|
171 | - public static function clear(string $area = "", string $key = "") { |
|
172 | - self::getCache()->clear($area, $key); |
|
173 | - } |
|
151 | + /** |
|
152 | + * put session |
|
153 | + * |
|
154 | + * @param $area cache area |
|
155 | + * @param $key cache key |
|
156 | + * @param $value cache entry value, can also be an object |
|
157 | + * @param $ttl time to live of cache entry in seconds (optional) |
|
158 | + */ |
|
159 | + public static function put(string $area, string $key, $value, $ttl = 180 * 60) { |
|
160 | + self::getCache()->put($area, $key, $value, $ttl); |
|
161 | + } |
|
162 | + |
|
163 | + public static function get(string $area, string $key) { |
|
164 | + return self::getCache()->get($area, $key); |
|
165 | + } |
|
166 | + |
|
167 | + public static function contains(string $area, string $key) : bool { |
|
168 | + return self::getCache()->contains($area, $key); |
|
169 | + } |
|
170 | + |
|
171 | + public static function clear(string $area = "", string $key = "") { |
|
172 | + self::getCache()->clear($area, $key); |
|
173 | + } |
|
174 | 174 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | */ |
33 | 33 | protected static $cache_instances = array(); |
34 | 34 | |
35 | - public static function init () { |
|
35 | + public static function init() { |
|
36 | 36 | require(CONFIG_PATH . "cache.php"); |
37 | 37 | |
38 | 38 | if (!isset($config['first_lvl_cache']) || !isset($config['first_lvl_cache']['class_name'])) { |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | //TODO: load other caches |
97 | 97 | } |
98 | 98 | |
99 | - public static function &getCache ($name = "") : ICache { |
|
99 | + public static function &getCache($name = "") : ICache { |
|
100 | 100 | if (empty($name)) { |
101 | 101 | return self::$instance; |
102 | 102 | } else { |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | } |
110 | 110 | } |
111 | 111 | |
112 | - public static function &get2ndLvlCache () : ICache { |
|
112 | + public static function &get2ndLvlCache() : ICache { |
|
113 | 113 | if (self::$second_level_cache == null) { |
114 | 114 | throw new Exception("second level cache is null."); |
115 | 115 | } |
@@ -121,11 +121,11 @@ discard block |
||
121 | 121 | return self::$second_level_cache; |
122 | 122 | } |
123 | 123 | |
124 | - public static function containsCache ($name) { |
|
124 | + public static function containsCache($name) { |
|
125 | 125 | return isset(self::$cache_instances[$name]); |
126 | 126 | } |
127 | 127 | |
128 | - public static function putCache ($name, &$cache_instance) { |
|
128 | + public static function putCache($name, &$cache_instance) { |
|
129 | 129 | if ($name == null || $name == "") { |
130 | 130 | throw new NullPointerException("cache name cannot be null."); |
131 | 131 | } |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | } |
145 | 145 | } |
146 | 146 | |
147 | - public static function removeCache ($name) { |
|
147 | + public static function removeCache($name) { |
|
148 | 148 | unset(self::$cache_instances[$name]); |
149 | 149 | } |
150 | 150 |
@@ -18,61 +18,61 @@ |
||
18 | 18 | |
19 | 19 | class AutoLoaderCache { |
20 | 20 | |
21 | - public static function init () { |
|
22 | - //check, if directory autoloader in cache exists |
|
23 | - if (!file_exists(CACHE_PATH . "autoloader")) { |
|
24 | - mkdir(CACHE_PATH . "autoloader"); |
|
25 | - } |
|
26 | - //check, if autoloader configuration exists |
|
27 | - if (!file_exists(STORE_PATH . "autoloader/autoloader.php")) { |
|
28 | - //TODO: generate file automatically (self repair) |
|
21 | + public static function init () { |
|
22 | + //check, if directory autoloader in cache exists |
|
23 | + if (!file_exists(CACHE_PATH . "autoloader")) { |
|
24 | + mkdir(CACHE_PATH . "autoloader"); |
|
25 | + } |
|
26 | + //check, if autoloader configuration exists |
|
27 | + if (!file_exists(STORE_PATH . "autoloader/autoloader.php")) { |
|
28 | + //TODO: generate file automatically (self repair) |
|
29 | 29 | |
30 | - throw new ConfigurationException("autoloader configuration not found in store."); |
|
31 | - } |
|
32 | - if (!file_exists(CACHE_PATH . "autoloader/preloaded_classes.php")) { |
|
33 | - //create cache |
|
34 | - self::createCache(); |
|
35 | - } |
|
36 | - } |
|
37 | - public static function load () { |
|
38 | - if (!file_exists(STORE_PATH . "autoloader/autoloader.php")) { |
|
39 | - throw new ConfigurationException("autoloader configuration not found in store."); |
|
40 | - } |
|
41 | - if (!file_exists(CACHE_PATH . "autoloader/preloaded_classes.php")) { |
|
42 | - //cache file doesnt exists |
|
43 | - self::createCache(); |
|
44 | - } |
|
45 | - //load classes from cache to save I/O |
|
46 | - require(CACHE_PATH . "autoloader/preloaded_classes.php"); |
|
47 | - } |
|
48 | - private static function createCache () { |
|
49 | - require(STORE_PATH . "autoloader/autoloader.php"); |
|
50 | - //create new cache file |
|
51 | - $data = ""; |
|
30 | + throw new ConfigurationException("autoloader configuration not found in store."); |
|
31 | + } |
|
32 | + if (!file_exists(CACHE_PATH . "autoloader/preloaded_classes.php")) { |
|
33 | + //create cache |
|
34 | + self::createCache(); |
|
35 | + } |
|
36 | + } |
|
37 | + public static function load () { |
|
38 | + if (!file_exists(STORE_PATH . "autoloader/autoloader.php")) { |
|
39 | + throw new ConfigurationException("autoloader configuration not found in store."); |
|
40 | + } |
|
41 | + if (!file_exists(CACHE_PATH . "autoloader/preloaded_classes.php")) { |
|
42 | + //cache file doesnt exists |
|
43 | + self::createCache(); |
|
44 | + } |
|
45 | + //load classes from cache to save I/O |
|
46 | + require(CACHE_PATH . "autoloader/preloaded_classes.php"); |
|
47 | + } |
|
48 | + private static function createCache () { |
|
49 | + require(STORE_PATH . "autoloader/autoloader.php"); |
|
50 | + //create new cache file |
|
51 | + $data = ""; |
|
52 | 52 | |
53 | - foreach ($autoloader_classes as $class_path) { |
|
54 | - if (file_exists($class_path)) { |
|
55 | - //get php code directly |
|
56 | - $data .= file_get_contents($class_path); |
|
57 | - } else if (file_exists(ROOT_PATH . $class_path)) { |
|
58 | - //use ROOT_PATH prefix |
|
59 | - $data .= file_get_contents(ROOT_PATH . $class_path); |
|
60 | - } else { |
|
61 | - echo "<!-- class " . $class_path . " couldnt be cached, file path doesnt exists. -->"; |
|
62 | - } |
|
63 | - } |
|
53 | + foreach ($autoloader_classes as $class_path) { |
|
54 | + if (file_exists($class_path)) { |
|
55 | + //get php code directly |
|
56 | + $data .= file_get_contents($class_path); |
|
57 | + } else if (file_exists(ROOT_PATH . $class_path)) { |
|
58 | + //use ROOT_PATH prefix |
|
59 | + $data .= file_get_contents(ROOT_PATH . $class_path); |
|
60 | + } else { |
|
61 | + echo "<!-- class " . $class_path . " couldnt be cached, file path doesnt exists. -->"; |
|
62 | + } |
|
63 | + } |
|
64 | 64 | |
65 | - //remove unneccessary php tags |
|
66 | - $data = str_replace("<?php", "", $data); |
|
67 | - $data = str_replace("?>", "", $data); |
|
68 | - $text = "<" . "?" . "php " . $data . " ?" . ">"; |
|
65 | + //remove unneccessary php tags |
|
66 | + $data = str_replace("<?php", "", $data); |
|
67 | + $data = str_replace("?>", "", $data); |
|
68 | + $text = "<" . "?" . "php " . $data . " ?" . ">"; |
|
69 | 69 | |
70 | - //write data to file in uncrommpressed way |
|
71 | - file_put_contents(CACHE_PATH . "autoloader/preloaded_classes_uncompressed.php", $text); |
|
70 | + //write data to file in uncrommpressed way |
|
71 | + file_put_contents(CACHE_PATH . "autoloader/preloaded_classes_uncompressed.php", $text); |
|
72 | 72 | |
73 | - //compress code, remove comments and unneccessary whitespaces with php_strip_whitespace() |
|
74 | - file_put_contents(CACHE_PATH . "autoloader/preloaded_classes.php", php_strip_whitespace(CACHE_PATH . "autoloader/preloaded_classes_uncompressed.php")); |
|
75 | - } |
|
73 | + //compress code, remove comments and unneccessary whitespaces with php_strip_whitespace() |
|
74 | + file_put_contents(CACHE_PATH . "autoloader/preloaded_classes.php", php_strip_whitespace(CACHE_PATH . "autoloader/preloaded_classes_uncompressed.php")); |
|
75 | + } |
|
76 | 76 | |
77 | 77 | } |
78 | 78 |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | |
19 | 19 | class AutoLoaderCache { |
20 | 20 | |
21 | - public static function init () { |
|
21 | + public static function init() { |
|
22 | 22 | //check, if directory autoloader in cache exists |
23 | 23 | if (!file_exists(CACHE_PATH . "autoloader")) { |
24 | 24 | mkdir(CACHE_PATH . "autoloader"); |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | self::createCache(); |
35 | 35 | } |
36 | 36 | } |
37 | - public static function load () { |
|
37 | + public static function load() { |
|
38 | 38 | if (!file_exists(STORE_PATH . "autoloader/autoloader.php")) { |
39 | 39 | throw new ConfigurationException("autoloader configuration not found in store."); |
40 | 40 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | //load classes from cache to save I/O |
46 | 46 | require(CACHE_PATH . "autoloader/preloaded_classes.php"); |
47 | 47 | } |
48 | - private static function createCache () { |
|
48 | + private static function createCache() { |
|
49 | 49 | require(STORE_PATH . "autoloader/autoloader.php"); |
50 | 50 | //create new cache file |
51 | 51 | $data = ""; |
@@ -28,59 +28,59 @@ |
||
28 | 28 | */ |
29 | 29 | class Registry { |
30 | 30 | |
31 | - protected static $objects = array(); |
|
32 | - protected static $settings = array(); |
|
33 | - protected static $instance = null; |
|
31 | + protected static $objects = array(); |
|
32 | + protected static $settings = array(); |
|
33 | + protected static $instance = null; |
|
34 | 34 | |
35 | - public function __construct () { |
|
36 | - // |
|
37 | - } |
|
35 | + public function __construct () { |
|
36 | + // |
|
37 | + } |
|
38 | 38 | |
39 | - public static function &singleton () { |
|
39 | + public static function &singleton () { |
|
40 | 40 | |
41 | - if (self::$instance == null) { |
|
42 | - self::$instance = new Registry(); |
|
43 | - } |
|
41 | + if (self::$instance == null) { |
|
42 | + self::$instance = new Registry(); |
|
43 | + } |
|
44 | 44 | |
45 | - return self::$instance; |
|
45 | + return self::$instance; |
|
46 | 46 | |
47 | - } |
|
47 | + } |
|
48 | 48 | |
49 | - public function storeObject ($key, &$object) { |
|
50 | - if (is_string($object)) { |
|
51 | - $object = new $object(); |
|
52 | - } |
|
49 | + public function storeObject ($key, &$object) { |
|
50 | + if (is_string($object)) { |
|
51 | + $object = new $object(); |
|
52 | + } |
|
53 | 53 | |
54 | - self::$objects[$key] = $object; |
|
55 | - } |
|
54 | + self::$objects[$key] = $object; |
|
55 | + } |
|
56 | 56 | |
57 | - public function getObject ($key) { |
|
58 | - if (!isset(self::$objects[$key])) { |
|
59 | - throw new IllegalStateException("registry key '" . $key . "' doesnt exists."); |
|
60 | - } |
|
57 | + public function getObject ($key) { |
|
58 | + if (!isset(self::$objects[$key])) { |
|
59 | + throw new IllegalStateException("registry key '" . $key . "' doesnt exists."); |
|
60 | + } |
|
61 | 61 | |
62 | - if (is_object(self::$objects[$key])) { |
|
63 | - return self::$objects[$key]; |
|
64 | - } else { |
|
65 | - throw new IllegalStateException("key '" . $key. "' isnt an object."); |
|
66 | - } |
|
67 | - } |
|
62 | + if (is_object(self::$objects[$key])) { |
|
63 | + return self::$objects[$key]; |
|
64 | + } else { |
|
65 | + throw new IllegalStateException("key '" . $key. "' isnt an object."); |
|
66 | + } |
|
67 | + } |
|
68 | 68 | |
69 | - public function setSetting ($key, $value) { |
|
70 | - self::$settings[$key] = $value; |
|
71 | - } |
|
69 | + public function setSetting ($key, $value) { |
|
70 | + self::$settings[$key] = $value; |
|
71 | + } |
|
72 | 72 | |
73 | - public function getSetting ($key) { |
|
74 | - if (!isset(self::$settings[$key])) { |
|
75 | - throw new IllegalStateException("Registry-Settings key '" . htmlentities($key) . "' doesnt exists."); |
|
76 | - } |
|
73 | + public function getSetting ($key) { |
|
74 | + if (!isset(self::$settings[$key])) { |
|
75 | + throw new IllegalStateException("Registry-Settings key '" . htmlentities($key) . "' doesnt exists."); |
|
76 | + } |
|
77 | 77 | |
78 | - return self::$settings[$key]; |
|
79 | - } |
|
78 | + return self::$settings[$key]; |
|
79 | + } |
|
80 | 80 | |
81 | - public function listSettings () { |
|
82 | - return self::$settings; |
|
83 | - } |
|
81 | + public function listSettings () { |
|
82 | + return self::$settings; |
|
83 | + } |
|
84 | 84 | |
85 | 85 | } |
86 | 86 |
@@ -32,11 +32,11 @@ discard block |
||
32 | 32 | protected static $settings = array(); |
33 | 33 | protected static $instance = null; |
34 | 34 | |
35 | - public function __construct () { |
|
35 | + public function __construct() { |
|
36 | 36 | // |
37 | 37 | } |
38 | 38 | |
39 | - public static function &singleton () { |
|
39 | + public static function &singleton() { |
|
40 | 40 | |
41 | 41 | if (self::$instance == null) { |
42 | 42 | self::$instance = new Registry(); |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | |
47 | 47 | } |
48 | 48 | |
49 | - public function storeObject ($key, &$object) { |
|
49 | + public function storeObject($key, &$object) { |
|
50 | 50 | if (is_string($object)) { |
51 | 51 | $object = new $object(); |
52 | 52 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | self::$objects[$key] = $object; |
55 | 55 | } |
56 | 56 | |
57 | - public function getObject ($key) { |
|
57 | + public function getObject($key) { |
|
58 | 58 | if (!isset(self::$objects[$key])) { |
59 | 59 | throw new IllegalStateException("registry key '" . $key . "' doesnt exists."); |
60 | 60 | } |
@@ -62,15 +62,15 @@ discard block |
||
62 | 62 | if (is_object(self::$objects[$key])) { |
63 | 63 | return self::$objects[$key]; |
64 | 64 | } else { |
65 | - throw new IllegalStateException("key '" . $key. "' isnt an object."); |
|
65 | + throw new IllegalStateException("key '" . $key . "' isnt an object."); |
|
66 | 66 | } |
67 | 67 | } |
68 | 68 | |
69 | - public function setSetting ($key, $value) { |
|
69 | + public function setSetting($key, $value) { |
|
70 | 70 | self::$settings[$key] = $value; |
71 | 71 | } |
72 | 72 | |
73 | - public function getSetting ($key) { |
|
73 | + public function getSetting($key) { |
|
74 | 74 | if (!isset(self::$settings[$key])) { |
75 | 75 | throw new IllegalStateException("Registry-Settings key '" . htmlentities($key) . "' doesnt exists."); |
76 | 76 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | return self::$settings[$key]; |
79 | 79 | } |
80 | 80 | |
81 | - public function listSettings () { |
|
81 | + public function listSettings() { |
|
82 | 82 | return self::$settings; |
83 | 83 | } |
84 | 84 |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | |
18 | 18 | interface ICache { |
19 | 19 | |
20 | - public function init ($config); |
|
20 | + public function init($config); |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * put session |
@@ -27,13 +27,13 @@ discard block |
||
27 | 27 | * @param $value cache entry value, can also be an object |
28 | 28 | * @param $ttl time to live of cache entry in seconds (optional) |
29 | 29 | */ |
30 | - public function put ($area, $key, $value, $ttl = 180 * 60); |
|
30 | + public function put($area, $key, $value, $ttl = 180 * 60); |
|
31 | 31 | |
32 | - public function get ($area, $key); |
|
32 | + public function get($area, $key); |
|
33 | 33 | |
34 | - public function contains ($area, $key) : bool; |
|
34 | + public function contains($area, $key) : bool; |
|
35 | 35 | |
36 | - public function clear ($area = "", $key = ""); |
|
36 | + public function clear($area = "", $key = ""); |
|
37 | 37 | |
38 | 38 | } |
39 | 39 |