From 0aeda95ba9cd80c4ad60f7b77fb3426b8ec30a14 Mon Sep 17 00:00:00 2001 From: Carlos Ferreira Date: Sun, 2 Apr 2017 20:02:34 +0100 Subject: [PATCH] Adding namespacing and phpdoc --- .gitignore | 9 +++------ README.md | 2 +- TempCache.php | 47 ++++++++++++++++++++++++++++++++++++++++++++++- composer.json | 2 +- composer.lock | 1 - 5 files changed, 51 insertions(+), 10 deletions(-) mode change 100644 => 100755 .gitignore mode change 100644 => 100755 README.md diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 index c422267..0bee35e --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,3 @@ -composer.phar -/vendor/ - -# Commit your application's lock file http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file -# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file -# composer.lock +.idea/ +vendor/ +*.stackdump diff --git a/README.md b/README.md old mode 100644 new mode 100755 index ed0ec32..f05bbd2 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ TempCache::remove($key); ```javascript { "require": { - "cajogos/php-temp-cache": "1.0.1" + "cajogos/php-temp-cache": "1.1" } } ``` diff --git a/TempCache.php b/TempCache.php index 283d379..6478838 100755 --- a/TempCache.php +++ b/TempCache.php @@ -1,5 +1,11 @@ $cache_key, 'expiry' => $expiry, 'value' => $serialized - ); + ); $store = json_encode($store); return self::save_cache_file($file, $store); } return false; } + /** + * @param string $key + * @return bool + */ public static function remove($key) { if (self::prepare()) @@ -68,6 +91,10 @@ public static function remove($key) return false; } + /** + * @param string $file + * @return bool|string + */ private static function load_cache_file($file) { $file = self::CACHE_FOLDER . $file; @@ -77,23 +104,41 @@ private static function load_cache_file($file) } return false; } + + /** + * @param string $file + * @param string $data + * @return bool + */ private static function save_cache_file($file, $data) { $file = self::CACHE_FOLDER . $file; return (!(file_put_contents($file, $data) === false)); } + + /** + * @param string $file + * @return bool + */ private static function delete_cache_file($file) { $file = self::CACHE_FOLDER . $file; return unlink($file); } + /** + * @param string $key + * @return string + */ private static function cache_key_convert($key) { $key = 'tmpcache_' . $key; return md5($key); } + /** + * @return bool + */ private static function prepare() { if (self::$prepared) diff --git a/composer.json b/composer.json index 1a6d446..64e9c05 100755 --- a/composer.json +++ b/composer.json @@ -9,7 +9,7 @@ { "name": "Carlos Ferreira", "email": "c@rlos.rocks", - "homepage": "http://ca.rlos.rocks", + "homepage": "https://carlos.fyi", "role": "Developer" } ], diff --git a/composer.lock b/composer.lock index fa63bf5..814d6e4 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,6 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "86c5b6e8570cc54cd72b7282de4c01c4", "content-hash": "e15928ec33207498caeab1070336828c", "packages": [], "packages-dev": [],