From: TimWolla Date: Fri, 15 Jul 2011 15:35:00 +0000 (+0200) Subject: - enforced WCF-API conventions X-Git-Tag: 2.0.0_Beta_1~2027^2~1 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=537b3aa653bc6044f08c05da29b45a911805b6ee;p=GitHub%2FWoltLab%2FWCF.git - enforced WCF-API conventions --- diff --git a/wcfsetup/install/files/lib/system/cache/source/ApcCacheSource.class.php b/wcfsetup/install/files/lib/system/cache/source/ApcCacheSource.class.php index 75b7ea0bcd..1b02ec4f89 100644 --- a/wcfsetup/install/files/lib/system/cache/source/ApcCacheSource.class.php +++ b/wcfsetup/install/files/lib/system/cache/source/ApcCacheSource.class.php @@ -26,7 +26,7 @@ class ApcCacheSource implements CacheSource { /** * @see wcf\system\cache\source\CacheSource::get() */ - public function get($cacheResource) { + public function get(array $cacheResource) { if (($data = apc_fetch($cacheResource['file'])) === false) { return null; } @@ -37,14 +37,14 @@ class ApcCacheSource implements CacheSource { /** * @see wcf\system\cache\source\CacheSource::set() */ - public function set($cacheResource, $value) { + public function set(array $cacheResource, $value) { apc_store($cacheResource['file'], $value, $cacheResource['maxLifetime']); } /** * @see wcf\system\cache\source\CacheSource::delete() */ - public function delete($cacheResource, $ignoreLifetime = false) { + public function delete(array $cacheResource, $ignoreLifetime = false) { if ($ignoreLifetime || ($cacheResource['minLifetime'] == 0 || $this->checkMinLifetime($cacheResource))) { apc_delete($cacheResource['file']); } diff --git a/wcfsetup/install/files/lib/system/cache/source/CacheSource.class.php b/wcfsetup/install/files/lib/system/cache/source/CacheSource.class.php index 4c85270e4e..ed1b0e0813 100644 --- a/wcfsetup/install/files/lib/system/cache/source/CacheSource.class.php +++ b/wcfsetup/install/files/lib/system/cache/source/CacheSource.class.php @@ -18,7 +18,7 @@ interface CacheSource { * @param array $cacheResource * @return mixed */ - public function get($cacheResource); + public function get(array $cacheResource); /** * Stores a variable in the cache. @@ -26,7 +26,7 @@ interface CacheSource { * @param array $cacheResource * @param mixed $value */ - public function set($cacheResource, $value); + public function set(array $cacheResource, $value); /** * Deletes a variable in the cache. @@ -34,7 +34,7 @@ interface CacheSource { * @param array $cacheResource * @param boolean $ignoreLifetime */ - public function delete($cacheResource, $ignoreLifetime = false); + public function delete(array $cacheResource, $ignoreLifetime = false); /** * Marks cached files as obsolete. diff --git a/wcfsetup/install/files/lib/system/cache/source/DiskCacheSource.class.php b/wcfsetup/install/files/lib/system/cache/source/DiskCacheSource.class.php index e8013f3c5d..7a6997e5f3 100644 --- a/wcfsetup/install/files/lib/system/cache/source/DiskCacheSource.class.php +++ b/wcfsetup/install/files/lib/system/cache/source/DiskCacheSource.class.php @@ -31,9 +31,9 @@ class DiskCacheSource implements CacheSource { protected $loaded = array(); /** - * @see CacheSource::get() + * @see wcf\system\cache\source\CacheSource::get() */ - public function get($cacheResource) { + public function get(array $cacheResource) { if (!isset($this->cache[$cacheResource['cache']])) { // check for rebuilt if ($this->needRebuild($cacheResource)) { @@ -52,9 +52,9 @@ class DiskCacheSource implements CacheSource { } /** - * @see CacheSource::set() + * @see wcf\system\cache\source\CacheSource::set() */ - public function set($cacheResource, $value) { + public function set(array $cacheResource, $value) { // write cache $targetFile = new File($cacheResource['file']); $targetFile->write("\n"); @@ -67,9 +67,9 @@ class DiskCacheSource implements CacheSource { } /** - * @see CacheSource::delete() + * @see wcf\system\cache\source\CacheSource::delete() */ - public function delete($cacheResource, $ignoreLifetime = false) { + public function delete(array$cacheResource, $ignoreLifetime = false) { if (file_exists($cacheResource['file'])) { if ($ignoreLifetime || ($cacheResource['minLifetime'] == 0 || (TIME_NOW - filemtime($cacheResource['file'])) >= $cacheResource['minLifetime'])) { // delete cache file @@ -110,7 +110,7 @@ class DiskCacheSource implements CacheSource { * @param array $cacheResource * @return boolean $needRebuilt */ - protected function needRebuild($cacheResource) { + protected function needRebuild(array $cacheResource) { // cache does not exist if (!file_exists($cacheResource['file'])) { return true; @@ -145,7 +145,7 @@ class DiskCacheSource implements CacheSource { * * @param array $cacheResource */ - public function load($cacheResource) { + public function load(array $cacheResource) { if (!isset($this->loaded[$cacheResource['file']])) { try { // load cache file @@ -166,7 +166,7 @@ class DiskCacheSource implements CacheSource { * * @param array $cacheResource */ - protected function loadCacheFile($cacheResource) { + protected function loadCacheFile(array $cacheResource) { // get file contents $contents = file_get_contents($cacheResource['file']); diff --git a/wcfsetup/install/files/lib/system/cache/source/MemcacheCacheSource.class.php b/wcfsetup/install/files/lib/system/cache/source/MemcacheCacheSource.class.php index 816fa99beb..61686ac90d 100644 --- a/wcfsetup/install/files/lib/system/cache/source/MemcacheCacheSource.class.php +++ b/wcfsetup/install/files/lib/system/cache/source/MemcacheCacheSource.class.php @@ -126,26 +126,26 @@ class MemcacheCacheSource implements CacheSource { // CacheSource implementations /** - * @see CacheSource::get() + * @see wcf\system\cache\source\CacheSource::get() */ - public function get($cacheResource) { + public function get(array $cacheResource) { $value = $this->getAdapter()->getMemcache()->get($cacheResource['file']); if ($value === false) return null; return $value; } /** - * @see CacheSource::set() + * @see wcf\system\cache\source\CacheSource::set() */ - public function set($cacheResource, $value) { + public function set(array $cacheResource, $value) { $this->getAdapter()->getMemcache()->set($cacheResource['file'], $value, MEMCACHE_COMPRESSED, $cacheResource['maxLifetime']); $this->addToLog($cacheResource['file']); } /** - * @see CacheSource::delete() + * @see wcf\system\cache\source\CacheSource::delete() */ - public function delete($cacheResource, $ignoreLifetime = false) { + public function delete(arra $cacheResource, $ignoreLifetime = false) { $this->getAdapter()->getMemcache()->delete($cacheResource['file']); $this->removeFromLog($cacheResource['file']); }