@@ -18,7 +18,7 @@ |
||
18 | 18 | |
19 | 19 | namespace PasswordLib; |
20 | 20 | |
21 | -require_once __DIR__ . '/Core/AutoLoader.php'; |
|
21 | +require_once __DIR__.'/Core/AutoLoader.php'; |
|
22 | 22 | |
23 | 23 | $autoloader = new Core\AutoLoader(__NAMESPACE__, dirname(__DIR__)); |
24 | 24 |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | if (function_exists('posix_times')) { |
53 | 53 | $state .= serialize(posix_times()); |
54 | 54 | } |
55 | - $state .= getmypid() . memory_get_usage(); |
|
55 | + $state .= getmypid().memory_get_usage(); |
|
56 | 56 | $state .= serialize($_ENV); |
57 | 57 | $this->state = hash('sha512', $state, true); |
58 | 58 | } |
@@ -66,8 +66,8 @@ discard block |
||
66 | 66 | */ |
67 | 67 | public function generate($size) { |
68 | 68 | $result = ''; |
69 | - $seed = microtime() . memory_get_usage(); |
|
70 | - $this->state = hash('sha512', $this->state . $seed, true); |
|
69 | + $seed = microtime().memory_get_usage(); |
|
70 | + $this->state = hash('sha512', $this->state.$seed, true); |
|
71 | 71 | /** |
72 | 72 | * Make the generated randomness a bit better by forcing a GC run which |
73 | 73 | * should complete in a indeterminate amount of time, hence improving |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | */ |
77 | 77 | gc_collect_cycles(); |
78 | 78 | for ($i = 0; $i < $size; $i += 8) { |
79 | - $seed = $this->state . microtime() . pack('N', $i); |
|
79 | + $seed = $this->state.microtime().pack('N', $i); |
|
80 | 80 | $this->state = hash('sha512', $seed, true); |
81 | 81 | /** |
82 | 82 | * We only use the first 8 bytes here to prevent exposing the state |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | public function registerMixer($name, $class) { |
140 | 140 | $this->registerType( |
141 | 141 | 'mixers', |
142 | - __NAMESPACE__ . '\\Mixer', |
|
142 | + __NAMESPACE__.'\\Mixer', |
|
143 | 143 | $name, |
144 | 144 | $class |
145 | 145 | ); |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | public function registerSource($name, $class) { |
160 | 160 | $this->registerType( |
161 | 161 | 'sources', |
162 | - __NAMESPACE__ . '\\Source', |
|
162 | + __NAMESPACE__.'\\Source', |
|
163 | 163 | $name, |
164 | 164 | $class |
165 | 165 | ); |
@@ -200,8 +200,8 @@ discard block |
||
200 | 200 | */ |
201 | 201 | protected function loadMixers() { |
202 | 202 | $this->loadFiles( |
203 | - __DIR__ . '/Mixer', |
|
204 | - __NAMESPACE__ . '\\Mixer\\', |
|
203 | + __DIR__.'/Mixer', |
|
204 | + __NAMESPACE__.'\\Mixer\\', |
|
205 | 205 | array($this, 'registerMixer') |
206 | 206 | ); |
207 | 207 | } |
@@ -213,8 +213,8 @@ discard block |
||
213 | 213 | */ |
214 | 214 | protected function loadSources() { |
215 | 215 | $this->loadFiles( |
216 | - __DIR__ . '/Source', |
|
217 | - __NAMESPACE__ . '\\Source\\', |
|
216 | + __DIR__.'/Source', |
|
217 | + __NAMESPACE__.'\\Source\\', |
|
218 | 218 | array($this, 'registerSource') |
219 | 219 | ); |
220 | 220 | } |
@@ -151,7 +151,7 @@ |
||
151 | 151 | } elseif (empty($characters)) { |
152 | 152 | // Default to base 64 |
153 | 153 | $characters = '0123456789abcdefghijklmnopqrstuvwxyz' . |
154 | - 'ABCDEFGHIJKLMNOPQRSTUVWXYZ./'; |
|
154 | + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ./'; |
|
155 | 155 | } |
156 | 156 | // determine how many bytes to generate |
157 | 157 | // This is basically doing floor(log(strlen($characters))) |
@@ -150,7 +150,7 @@ |
||
150 | 150 | return ''; |
151 | 151 | } elseif (empty($characters)) { |
152 | 152 | // Default to base 64 |
153 | - $characters = '0123456789abcdefghijklmnopqrstuvwxyz' . |
|
153 | + $characters = '0123456789abcdefghijklmnopqrstuvwxyz'. |
|
154 | 154 | 'ABCDEFGHIJKLMNOPQRSTUVWXYZ./'; |
155 | 155 | } |
156 | 156 | // determine how many bytes to generate |
@@ -20,7 +20,7 @@ |
||
20 | 20 | * is in use. So if it does not exist at this point, we know we must bootstrap |
21 | 21 | * the libraries. |
22 | 22 | */ |
23 | - /* |
|
23 | + /* |
|
24 | 24 | if (!class_exists('\\PasswordLib\Core\AutoLoader', true)) { |
25 | 25 | require_once 'bootstrap.php'; |
26 | 26 | } |
@@ -73,7 +73,7 @@ |
||
73 | 73 | $filename = $file->getBasename(); |
74 | 74 | if ($file->isFile() && substr($filename, -4) == '.php') { |
75 | 75 | $name = substr($filename, 0, -4); |
76 | - $class = $namespace . $name; |
|
76 | + $class = $namespace.$name; |
|
77 | 77 | call_user_func($callback, $name, $class); |
78 | 78 | } |
79 | 79 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | */ |
46 | 46 | public function __construct($namespace, $path) { |
47 | 47 | $this->namespace = ltrim($namespace, '\\'); |
48 | - $this->path = rtrim($path, '/\\') . DIRECTORY_SEPARATOR; |
|
48 | + $this->path = rtrim($path, '/\\').DIRECTORY_SEPARATOR; |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
@@ -61,8 +61,8 @@ discard block |
||
61 | 61 | $nsparts = explode('\\', $class); |
62 | 62 | $class = array_pop($nsparts); |
63 | 63 | $nsparts[] = ''; |
64 | - $path = $this->path . implode(DIRECTORY_SEPARATOR, $nsparts); |
|
65 | - $path .= str_replace('_', DIRECTORY_SEPARATOR, $class) . '.php'; |
|
64 | + $path = $this->path.implode(DIRECTORY_SEPARATOR, $nsparts); |
|
65 | + $path .= str_replace('_', DIRECTORY_SEPARATOR, $class).'.php'; |
|
66 | 66 | if (file_exists($path)) { |
67 | 67 | require $path; |
68 | 68 | return true; |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | }; |
45 | 45 | $string = array_map($callback, $string); |
46 | 46 | $converted = static::baseConvert($string, 256, strlen($characters)); |
47 | - $callback = function ($num) use ($characters) { |
|
47 | + $callback = function($num) use ($characters) { |
|
48 | 48 | return $characters[$num]; |
49 | 49 | }; |
50 | 50 | $ret = implode('', array_map($callback, $converted)); |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | }; |
70 | 70 | $string = array_map($callback, $string); |
71 | 71 | $converted = static::baseConvert($string, strlen($characters), 256); |
72 | - $callback = function ($num) { |
|
72 | + $callback = function($num) { |
|
73 | 73 | return chr($num); |
74 | 74 | }; |
75 | 75 | return implode('', array_map($callback, $converted)); |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | while ($count) { |
99 | 99 | $itMax = $count; |
100 | 100 | $remainder = $count = $loop = 0; |
101 | - while($loop < $itMax) { |
|
101 | + while ($loop < $itMax) { |
|
102 | 102 | $dividend = $source[$loop++] + $remainder * $srcBase; |
103 | 103 | $remainder = $dividend % $dstBase; |
104 | 104 | $res = ($dividend - $remainder) / $dstBase; |
@@ -63,7 +63,7 @@ |
||
63 | 63 | }, $line); |
64 | 64 | |
65 | 65 | $sql = 'INSERT INTO ' . $this->table . '(' . join(', ', $this->columns) . ')' . |
66 | - ' VALUES(' . join(',', $prepare) . ')'; |
|
66 | + ' VALUES(' . join(',', $prepare) . ')'; |
|
67 | 67 | |
68 | 68 | $stmt = $this->pdo->prepare($sql); |
69 | 69 | $stmt->execute($line); |
@@ -55,15 +55,15 @@ |
||
55 | 55 | return $value; |
56 | 56 | } |
57 | 57 | |
58 | - throw new \InvalidArgumentException('value is invalid: ' . var_export($value, 1)); |
|
58 | + throw new \InvalidArgumentException('value is invalid: '.var_export($value, 1)); |
|
59 | 59 | }, $line); |
60 | 60 | |
61 | 61 | $prepare = array_map(function() { |
62 | 62 | return '?'; |
63 | 63 | }, $line); |
64 | 64 | |
65 | - $sql = 'INSERT INTO ' . $this->table . '(' . join(', ', $this->columns) . ')' . |
|
66 | - ' VALUES(' . join(',', $prepare) . ')'; |
|
65 | + $sql = 'INSERT INTO '.$this->table.'('.join(', ', $this->columns).')'. |
|
66 | + ' VALUES('.join(',', $prepare).')'; |
|
67 | 67 | |
68 | 68 | $stmt = $this->pdo->prepare($sql); |
69 | 69 | $stmt->execute($line); |