Skip to content
Snippets Groups Projects
Unverified Commit 21763a4f authored by Tim van Dijen's avatar Tim van Dijen Committed by GitHub
Browse files

Add missing declarations

parent 3af69e08
No related branches found
No related tags found
No related merge requests found
...@@ -22,8 +22,13 @@ ...@@ -22,8 +22,13 @@
* and Information Technology. * and Information Technology.
*/ */
class sspmod_riak_Store_Store extends SimpleSAML\Store { class sspmod_riak_Store_Store extends SimpleSAML\Store
protected function __construct() { {
public $client;
public $bucket;
protected function __construct()
{
$config = SimpleSAML_Configuration::getConfig('module_riak.php'); $config = SimpleSAML_Configuration::getConfig('module_riak.php');
$path = $config->getString('path', 'riak-php-client/riak.php'); $path = $config->getString('path', 'riak-php-client/riak.php');
...@@ -43,19 +48,20 @@ class sspmod_riak_Store_Store extends SimpleSAML\Store { ...@@ -43,19 +48,20 @@ class sspmod_riak_Store_Store extends SimpleSAML\Store {
* @param string $key The key. * @param string $key The key.
* @return mixed|NULL The value. * @return mixed|NULL The value.
*/ */
public function get($type, $key) { public function get($type, $key)
{
assert(is_string($type)); assert(is_string($type));
assert(is_string($key)); assert(is_string($key));
$v = $this->bucket->getBinary("$type.$key"); $v = $this->bucket->getBinary("$type.$key");
if (!$v->exists()) { if (!$v->exists()) {
return (NULL); return null;
} }
$expires = $v->getIndex('Expires', 'int'); $expires = $v->getIndex('Expires', 'int');
if (sizeof($expires) && (int)array_shift($expires) <= time()) { if (sizeof($expires) && (int)array_shift($expires) <= time()) {
$v->delete(); $v->delete();
return (NULL); return null;
} }
return (unserialize($v->getData())); return (unserialize($v->getData()));
...@@ -70,7 +76,8 @@ class sspmod_riak_Store_Store extends SimpleSAML\Store { ...@@ -70,7 +76,8 @@ class sspmod_riak_Store_Store extends SimpleSAML\Store {
* @param mixed $value The value. * @param mixed $value The value.
* @param int|NULL $expire The expiration time (unix timestamp), or NULL if it never expires. * @param int|NULL $expire The expiration time (unix timestamp), or NULL if it never expires.
*/ */
public function set($type, $key, $value, $expire = NULL) { public function set($type, $key, $value, $expire = null)
{
assert(is_string($type)); assert(is_string($type));
assert(is_string($key)); assert(is_string($key));
assert($expire === null || (is_int($expire) && $expire > 2592000)); assert($expire === null || (is_int($expire) && $expire > 2592000));
...@@ -89,7 +96,8 @@ class sspmod_riak_Store_Store extends SimpleSAML\Store { ...@@ -89,7 +96,8 @@ class sspmod_riak_Store_Store extends SimpleSAML\Store {
* @param string $type The datatype. * @param string $type The datatype.
* @param string $key The key. * @param string $key The key.
*/ */
public function delete($type, $key) { public function delete($type, $key)
{
assert(is_string($type)); assert(is_string($type));
assert(is_string($key)); assert(is_string($key));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment