@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | * |
| 43 | 43 | * @throws Exception |
| 44 | 44 | */ |
| 45 | - public static function getStorage($type="file", $options=array(), $secretoptions=array()) |
|
| 45 | + public static function getStorage($type = "file", $options = array(), $secretoptions = array()) |
|
| 46 | 46 | { |
| 47 | 47 | switch ($type) { |
| 48 | 48 | case "file": |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | if (!isset($type)) { |
| 62 | 62 | throw new Exception('Class name not set'); |
| 63 | 63 | } elseif (!class_exists($type)) { |
| 64 | - throw new Exception('Class not found: ' . var_export($type, TRUE)); |
|
| 64 | + throw new Exception('Class not found: '.var_export($type, TRUE)); |
|
| 65 | 65 | } |
| 66 | 66 | $instance = new $type($options, $secretoptions); |
| 67 | 67 | } |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | public function setBaseURL($apiBaseURL) |
| 27 | 27 | { |
| 28 | - $this->_apiBaseURL = rtrim($apiBaseURL, '/') . '/'; |
|
| 28 | + $this->_apiBaseURL = rtrim($apiBaseURL, '/').'/'; |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | /** |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | protected function callAPI($resource, $method = "GET", $data = array(), $headers = array()) |
| 79 | 79 | { |
| 80 | 80 | $ch = curl_init(); |
| 81 | - curl_setopt($ch, CURLOPT_URL, $this->_apiBaseURL . ltrim($resource, '/')); |
|
| 81 | + curl_setopt($ch, CURLOPT_URL, $this->_apiBaseURL.ltrim($resource, '/')); |
|
| 82 | 82 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
| 83 | 83 | |
| 84 | 84 | // Explicitly empty null values, because http_build_query will throw away |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | |
| 108 | 108 | $headerArray = array(); |
| 109 | 109 | foreach ($headers as $key => $value) { |
| 110 | - $headerArray[] = $key . ': ' . $value; |
|
| 110 | + $headerArray[] = $key.': '.$value; |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | curl_setopt($ch, CURLOPT_HTTPHEADER, $headerArray); |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | * @param mixed $value The data to store in state storage |
| 42 | 42 | * @param int $expire The expiration (in seconds) of the data |
| 43 | 43 | */ |
| 44 | - public abstract function setValue($key, $value, $expire=0); |
|
| 44 | + public abstract function setValue($key, $value, $expire = 0); |
|
| 45 | 45 | |
| 46 | 46 | /** |
| 47 | 47 | * Remove a value from the state storage |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | * a state storage instance of a certain type. |
| 76 | 76 | * @param array $options An array of options for the state storage |
| 77 | 77 | */ |
| 78 | - public function __construct($options=array()) |
|
| 78 | + public function __construct($options = array()) |
|
| 79 | 79 | { |
| 80 | 80 | $this->_options = $options; |
| 81 | 81 | } |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | * The default configuration |
| 52 | 52 | */ |
| 53 | 53 | const DEFAULT_HOST = '127.0.0.1'; |
| 54 | - const DEFAULT_PORT = 11211; |
|
| 54 | + const DEFAULT_PORT = 11211; |
|
| 55 | 55 | |
| 56 | 56 | /** |
| 57 | 57 | * Get the prefix to use for all keys in memcache. |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | * (non-PHPdoc) |
| 100 | 100 | * @see library/tiqr/Tiqr/StateStorage/Tiqr_StateStorage_Abstract::setValue() |
| 101 | 101 | */ |
| 102 | - public function setValue($key, $value, $expire=0) |
|
| 102 | + public function setValue($key, $value, $expire = 0) |
|
| 103 | 103 | { |
| 104 | 104 | $key = $this->_getKeyPrefix().$key; |
| 105 | 105 | |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | $key = $this->_getKeyPrefix().$key; |
| 131 | 131 | |
| 132 | 132 | $result = $this->_memcache->get($key); |
| 133 | - if( $result === false ) |
|
| 133 | + if ($result === false) |
|
| 134 | 134 | return null; |
| 135 | 135 | return $result; |
| 136 | 136 | } |
@@ -130,8 +130,9 @@ |
||
| 130 | 130 | $key = $this->_getKeyPrefix().$key; |
| 131 | 131 | |
| 132 | 132 | $result = $this->_memcache->get($key); |
| 133 | - if( $result === false ) |
|
| 134 | - return null; |
|
| 133 | + if( $result === false ) { |
|
| 134 | + return null; |
|
| 135 | + } |
|
| 135 | 136 | return $result; |
| 136 | 137 | } |
| 137 | 138 | |
@@ -39,8 +39,8 @@ discard block |
||
| 39 | 39 | public function setValue($key, $value, $expire=0) |
| 40 | 40 | { |
| 41 | 41 | $envelope = array("expire"=>$expire, |
| 42 | - "createdAt"=>time(), |
|
| 43 | - "value"=>$value); |
|
| 42 | + "createdAt"=>time(), |
|
| 43 | + "value"=>$value); |
|
| 44 | 44 | $filename = $this->_stateFilename($key); |
| 45 | 45 | |
| 46 | 46 | file_put_contents($filename, serialize($envelope)); |
@@ -70,11 +70,11 @@ discard block |
||
| 70 | 70 | if (file_exists($filename)) { |
| 71 | 71 | $envelope = unserialize(file_get_contents($filename)); |
| 72 | 72 | if ($envelope["expire"]!=0) { |
| 73 | - // This data is time-limited. If it's too old we discard it. |
|
| 74 | - if (time()-$envelope["createdAt"] > $envelope["expire"]) { |
|
| 75 | - $this->unsetValue($key); |
|
| 76 | - return NULL; |
|
| 77 | - } |
|
| 73 | + // This data is time-limited. If it's too old we discard it. |
|
| 74 | + if (time()-$envelope["createdAt"] > $envelope["expire"]) { |
|
| 75 | + $this->unsetValue($key); |
|
| 76 | + return NULL; |
|
| 77 | + } |
|
| 78 | 78 | } |
| 79 | 79 | return $envelope["value"]; |
| 80 | 80 | } |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | * (non-PHPdoc) |
| 37 | 37 | * @see library/tiqr/Tiqr/StateStorage/Tiqr_StateStorage_Abstract::setValue() |
| 38 | 38 | */ |
| 39 | - public function setValue($key, $value, $expire=0) |
|
| 39 | + public function setValue($key, $value, $expire = 0) |
|
| 40 | 40 | { |
| 41 | 41 | $envelope = array("expire"=>$expire, |
| 42 | 42 | "createdAt"=>time(), |
@@ -69,9 +69,9 @@ discard block |
||
| 69 | 69 | $filename = $this->_stateFilename($key); |
| 70 | 70 | if (file_exists($filename)) { |
| 71 | 71 | $envelope = unserialize(file_get_contents($filename)); |
| 72 | - if ($envelope["expire"]!=0) { |
|
| 72 | + if ($envelope["expire"] != 0) { |
|
| 73 | 73 | // This data is time-limited. If it's too old we discard it. |
| 74 | - if (time()-$envelope["createdAt"] > $envelope["expire"]) { |
|
| 74 | + if (time() - $envelope["createdAt"] > $envelope["expire"]) { |
|
| 75 | 75 | $this->unsetValue($key); |
| 76 | 76 | return NULL; |
| 77 | 77 | } |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | public function encrypt($data); |
| 42 | 42 | |
| 43 | 43 | /** |
| 44 | - * Decrypts the given data. |
|
| 44 | + * Decrypts the given data. |
|
| 45 | 45 | * |
| 46 | 46 | * @param String $data Data to decrypt. |
| 47 | 47 | * |
@@ -57,7 +57,7 @@ |
||
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | /** |
| 60 | - * Decrypts the given data. |
|
| 60 | + * Decrypts the given data. |
|
| 61 | 61 | * |
| 62 | 62 | * @param String $data Data to decrypt. |
| 63 | 63 | * |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | protected $_userSecretStorage; |
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | - * Constructor. |
|
| 38 | + * Constructor. |
|
| 39 | 39 | */ |
| 40 | 40 | public function __construct($config, $secretconfig = array()) |
| 41 | 41 | { |
@@ -127,7 +127,7 @@ |
||
| 127 | 127 | */ |
| 128 | 128 | public function __construct($config, $secretconfig = array()) |
| 129 | 129 | { |
| 130 | - parent::__construct($config, $secretconfig); |
|
| 130 | + parent::__construct($config, $secretconfig); |
|
| 131 | 131 | |
| 132 | 132 | $this->_userClass = isset($config['userClass']) ? $config['userClass'] : "tiqrPerson"; |
| 133 | 133 | $this->_dnPattern = isset($config['dnPattern']) ? $config['dnPattern'] : "%s"; |
@@ -162,7 +162,7 @@ |
||
| 162 | 162 | * |
| 163 | 163 | * @return mixed LDAP attribute value |
| 164 | 164 | */ |
| 165 | - protected function _getLDAPAttribute($entry, $attribName, $index=0) |
|
| 165 | + protected function _getLDAPAttribute($entry, $attribName, $index = 0) |
|
| 166 | 166 | { |
| 167 | 167 | $attribName = strtolower($attribName); |
| 168 | 168 | |