Passed
Push — develop ( da004a...e3abb6 )
by Pieter van der
12:16 queued 05:54
created
library/tiqr/Tiqr/UserStorage/File.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 
68 68
         if ($data === NULL) {
69 69
             if ($failIfNotFound) {
70
-                throw new Exception('Error loading data for user: ' . var_export($userId, TRUE));
70
+                throw new Exception('Error loading data for user: '.var_export($userId, TRUE));
71 71
             } else {
72 72
                 return false;
73 73
             }
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
      */
95 95
     public function getPath()
96 96
     {
97
-         if (substr($this->_path, -1)!="/") return $this->_path."/";
97
+         if (substr($this->_path, -1) != "/") return $this->_path."/";
98 98
          return $this->_path;
99 99
     }
100 100
     
Please login to merge, or discard this patch.
library/tiqr/Tiqr/OcraService.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
      *
37 37
      * @return Tiqr_OcraService_Interface
38 38
      */
39
-    public static function getOcraService($type="tiqr", $options=array())
39
+    public static function getOcraService($type = "tiqr", $options = array())
40 40
     {
41 41
         switch ($type) {
42 42
             case "tiqr":
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
                 if (!isset($type)) {
52 52
                     throw new Exception('Class name not set');
53 53
                 } elseif (!class_exists($type)) {
54
-                    throw new Exception('Class not found: ' . var_export($type, TRUE));
54
+                    throw new Exception('Class not found: '.var_export($type, TRUE));
55 55
                 }
56 56
                 $instance = new $type($options);
57 57
         }
Please login to merge, or discard this patch.
library/tiqr/Tiqr/StateStorage.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
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":
@@ -62,9 +62,9 @@  discard block
 block discarded – undo
62 62
                 if (!isset($type)) {
63 63
                     throw new Exception('Class name not set');
64 64
                 } elseif (!class_exists($type)) {
65
-                    throw new Exception('Class not found: ' . var_export($type, TRUE));
65
+                    throw new Exception('Class not found: '.var_export($type, TRUE));
66 66
                 } elseif (!is_subclass_of($type, 'Tiqr_StateStorage_Abstract')) {
67
-                    throw new Exception('Class ' . $type . ' not subclass of Tiqr_StateStorage_Abstract');
67
+                    throw new Exception('Class '.$type.' not subclass of Tiqr_StateStorage_Abstract');
68 68
                 }
69 69
                 $instance = new $type($options);
70 70
         }
Please login to merge, or discard this patch.
library/tiqr/Tiqr/DeviceStorage/Abstract.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@
 block discarded – undo
53 53
      * the Tiqr_DeviceStorage factory will call this for you.
54 54
      * @param array $options The options for the s
55 55
      */
56
-    public function __construct($options=array())
56
+    public function __construct($options = array())
57 57
     {
58 58
         $this->_options = $options;        
59 59
     }
Please login to merge, or discard this patch.
library/tiqr/Tiqr/DeviceStorage/TokenExchange.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -41,11 +41,11 @@
 block discarded – undo
41 41
     {
42 42
         $url = $this->_options["url"]."?appId=".$this->_options["appid"];
43 43
         
44
-        $url.= "&notificationToken=".$notificationToken;
44
+        $url .= "&notificationToken=".$notificationToken;
45 45
         
46 46
         $output = file_get_contents($url);
47
-        if (stripos($output, "not found")!==false) return false;
48
-        if (stripos($output, "error")!==false) return false;
47
+        if (stripos($output, "not found") !== false) return false;
48
+        if (stripos($output, "error") !== false) return false;
49 49
         return trim($output);
50 50
     }
51 51
 }
52 52
\ No newline at end of file
Please login to merge, or discard this patch.
library/tiqr/Tiqr/UserSecretStorage/Pdo.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
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,7 +73,7 @@  discard block
 block discarded – undo
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
 
79 79
     public static function log($message)
Please login to merge, or discard this patch.
library/tiqr/Tiqr/DeviceStorage.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
      *                       config options per type.
43 43
      * @throws Exception An exception if an unknown storage is requested.
44 44
      */
45
-    public static function getStorage($type="dummy", $options=array())
45
+    public static function getStorage($type = "dummy", $options = array())
46 46
     {
47 47
         switch ($type) {
48 48
             case "dummy":
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
             default:
58 58
                 $instance = NULL;
59 59
         }
60
-        if ($instance!=NULL) {
60
+        if ($instance != NULL) {
61 61
             $instance->init();
62 62
             return $instance;
63 63
         }
Please login to merge, or discard this patch.
library/tiqr/Tiqr/UserSecretStorage.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
      *
37 37
      * @return Tiqr_UserSecretStorage_Interface
38 38
      */
39
-    public static function getSecretStorage($type="file", $options=array())
39
+    public static function getSecretStorage($type = "file", $options = array())
40 40
     {
41 41
         switch ($type) {
42 42
             case "file":
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
                 if (!isset($type)) {
60 60
                     throw new Exception('Class name not set');
61 61
                 } elseif (!class_exists($type)) {
62
-                    throw new Exception('Class not found: ' . var_export($type, TRUE));
62
+                    throw new Exception('Class not found: '.var_export($type, TRUE));
63 63
                 }
64 64
                 $instance = new $type($options);
65 65
         }
Please login to merge, or discard this patch.
library/tiqr/Tiqr/OATH/HOTP.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -46,25 +46,25 @@  discard block
 block discarded – undo
46 46
      * @param String $counter
47 47
      * @return String hash
48 48
      */
49
-    protected function _getHash ($secret, $counter)
49
+    protected function _getHash($secret, $counter)
50 50
     {
51 51
          // Counter
52 52
          //the counter value can be more than one byte long, so we need to go multiple times
53
-         $cur_counter = array(0,0,0,0,0,0,0,0);
54
-         for($i=7;$i>=0;$i--)
53
+         $cur_counter = array(0, 0, 0, 0, 0, 0, 0, 0);
54
+         for ($i = 7; $i >= 0; $i--)
55 55
          {
56
-             $cur_counter[$i] = pack ('C*', $counter);
56
+             $cur_counter[$i] = pack('C*', $counter);
57 57
              $counter = $counter >> 8;
58 58
          }
59 59
          $bin_counter = implode($cur_counter);
60 60
          // Pad to 8 chars
61
-         if (strlen ($bin_counter) < 8)
61
+         if (strlen($bin_counter) < 8)
62 62
          {
63
-             $bin_counter = str_repeat (chr(0), 8 - strlen ($bin_counter)) . $bin_counter;
63
+             $bin_counter = str_repeat(chr(0), 8 - strlen($bin_counter)).$bin_counter;
64 64
          }
65 65
      
66 66
          // HMAC
67
-         $hash = hash_hmac ('sha1', $bin_counter, $secret);
67
+         $hash = hash_hmac('sha1', $bin_counter, $secret);
68 68
          return $hash;
69 69
     }
70 70
  
@@ -77,9 +77,9 @@  discard block
 block discarded – undo
77 77
     protected function _truncate($hash, $length = 6)
78 78
     {
79 79
          // Convert to dec
80
-         foreach(str_split($hash,2) as $hex)
80
+         foreach (str_split($hash, 2) as $hex)
81 81
          {
82
-             $hmac_result[]=hexdec($hex);
82
+             $hmac_result[] = hexdec($hex);
83 83
          }
84 84
      
85 85
          // Find offset
@@ -88,10 +88,10 @@  discard block
 block discarded – undo
88 88
          // Algorithm from RFC
89 89
          return
90 90
          (
91
-             (($hmac_result[$offset+0] & 0x7f) << 24 ) |
92
-             (($hmac_result[$offset+1] & 0xff) << 16 ) |
93
-             (($hmac_result[$offset+2] & 0xff) << 8 ) |
94
-             ($hmac_result[$offset+3] & 0xff)
95
-         ) % pow(10,$length);
91
+             (($hmac_result[$offset + 0] & 0x7f) << 24) |
92
+             (($hmac_result[$offset + 1] & 0xff) << 16) |
93
+             (($hmac_result[$offset + 2] & 0xff) << 8) |
94
+             ($hmac_result[$offset + 3] & 0xff)
95
+         ) % pow(10, $length);
96 96
     }
97 97
 }
Please login to merge, or discard this patch.