@@ -72,9 +72,9 @@ discard block |
||
72 | 72 | * (non-PHPdoc) |
73 | 73 | * @see library/tiqr/Tiqr/StateStorage/Tiqr_StateStorage_Abstract::setValue() |
74 | 74 | */ |
75 | - public function setValue($key, $value, $expire=0) |
|
75 | + public function setValue($key, $value, $expire = 0) |
|
76 | 76 | { |
77 | - if (((float) rand() /(float) getrandmax()) < $this->cleanupProbability) { |
|
77 | + if (((float) rand() / (float) getrandmax()) < $this->cleanupProbability) { |
|
78 | 78 | $this->cleanExpired(); |
79 | 79 | } |
80 | 80 | if ($this->keyExists($key)) { |
@@ -84,9 +84,9 @@ discard block |
||
84 | 84 | } |
85 | 85 | // $expire == 0 means never expire |
86 | 86 | if ($expire != 0) { |
87 | - $expire+=time(); // Store unix timestamp after which the expires |
|
87 | + $expire += time(); // Store unix timestamp after which the expires |
|
88 | 88 | } |
89 | - $sth->execute(array(serialize($value),$expire,$key)); |
|
89 | + $sth->execute(array(serialize($value), $expire, $key)); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | if (false === $sth) { |
111 | 111 | return NULL; |
112 | 112 | } |
113 | - if (false === $sth->execute(array($key, time())) ) { |
|
113 | + if (false === $sth->execute(array($key, time()))) { |
|
114 | 114 | return NULL; |
115 | 115 | } |
116 | 116 | $result = $sth->fetchColumn(); |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * options per type. |
44 | 44 | * @throws Exception If an unknown type is requested. |
45 | 45 | */ |
46 | - public static function getStorage($type="file", $options=array()) |
|
46 | + public static function getStorage($type = "file", $options = array()) |
|
47 | 47 | { |
48 | 48 | switch ($type) { |
49 | 49 | case "file": |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | } |
70 | 70 | } |
71 | 71 | |
72 | - $pdoInstance = new PDO($options['dsn'],$options['username'],$options['password']); |
|
72 | + $pdoInstance = new PDO($options['dsn'], $options['username'], $options['password']); |
|
73 | 73 | // Set a hard-coded default for the probability the expired state is removed |
74 | 74 | // 0.1 translates to a 10% chance the garbage collection is executed |
75 | 75 | $cleanupProbability = 0.1; |
@@ -84,9 +84,9 @@ discard block |
||
84 | 84 | if (!isset($type)) { |
85 | 85 | throw new Exception('Class name not set'); |
86 | 86 | } elseif (!class_exists($type)) { |
87 | - throw new Exception('Class not found: ' . var_export($type, TRUE)); |
|
87 | + throw new Exception('Class not found: '.var_export($type, TRUE)); |
|
88 | 88 | } elseif (!is_subclass_of($type, 'Tiqr_StateStorage_Abstract')) { |
89 | - throw new Exception('Class ' . $type . ' not subclass of Tiqr_StateStorage_Abstract'); |
|
89 | + throw new Exception('Class '.$type.' not subclass of Tiqr_StateStorage_Abstract'); |
|
90 | 90 | } |
91 | 91 | $instance = new $type($options); |
92 | 92 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | { |
41 | 41 | $this->tablename = isset($config['table']) ? $config['table'] : 'tiqrusersecret'; |
42 | 42 | try { |
43 | - $this->handle = new PDO($config['dsn'],$config['username'],$config['password']); |
|
43 | + $this->handle = new PDO($config['dsn'], $config['username'], $config['password']); |
|
44 | 44 | } catch (PDOException $e) { |
45 | 45 | return false; |
46 | 46 | } |
@@ -73,6 +73,6 @@ discard block |
||
73 | 73 | } else { |
74 | 74 | $sth = $this->handle->prepare("INSERT INTO ".$this->tablename." (secret,userid) VALUES (?,?)"); |
75 | 75 | } |
76 | - $sth->execute(array($secret,$userId)); |
|
76 | + $sth->execute(array($secret, $userId)); |
|
77 | 77 | } |
78 | 78 | } |