@@ -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); |
@@ -57,6 +57,6 @@ |
||
57 | 57 | }, $line); |
58 | 58 | |
59 | 59 | return 'INSERT INTO ' . $this->table . '(' . join(', ', $this->columns) . ')' . |
60 | - ' VALUES(' . join(', ', $line) . ');'; |
|
60 | + ' VALUES(' . join(', ', $line) . ');'; |
|
61 | 61 | } |
62 | 62 | } |
@@ -50,13 +50,13 @@ |
||
50 | 50 | return 'false'; |
51 | 51 | } |
52 | 52 | |
53 | - return '"' . addslashes($value) . '"'; |
|
53 | + return '"'.addslashes($value).'"'; |
|
54 | 54 | } |
55 | 55 | |
56 | - throw new \InvalidArgumentException('value is invalid: ' . var_export($value, 1)); |
|
56 | + throw new \InvalidArgumentException('value is invalid: '.var_export($value, 1)); |
|
57 | 57 | }, $line); |
58 | 58 | |
59 | - return 'INSERT INTO ' . $this->table . '(' . join(', ', $this->columns) . ')' . |
|
60 | - ' VALUES(' . join(', ', $line) . ');'; |
|
59 | + return 'INSERT INTO '.$this->table.'('.join(', ', $this->columns).')'. |
|
60 | + ' VALUES('.join(', ', $line).');'; |
|
61 | 61 | } |
62 | 62 | } |
@@ -42,11 +42,11 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public static function register() |
44 | 44 | { |
45 | - if ( self::$hasBeenRegistered === true ) { |
|
45 | + if (self::$hasBeenRegistered === true) { |
|
46 | 46 | return; |
47 | 47 | } |
48 | 48 | |
49 | - if ( stream_filter_register(self::getFilterName(), __CLASS__) === false ) { |
|
49 | + if (stream_filter_register(self::getFilterName(), __CLASS__) === false) { |
|
50 | 50 | throw new RuntimeException('Failed to register stream filter: '.self::getFilterName()); |
51 | 51 | } |
52 | 52 | |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public static function getFilterURL($filename, $fromCharset, $toCharset = null) |
64 | 64 | { |
65 | - if ( $toCharset === null ) { |
|
65 | + if ($toCharset === null) { |
|
66 | 66 | return sprintf('php://filter/convert.mbstring.encoding.%s/resource=%s', $fromCharset, $filename); |
67 | 67 | } else { |
68 | 68 | return sprintf('php://filter/convert.mbstring.encoding.%s:%s/resource=%s', $fromCharset, $toCharset, $filename); |
@@ -74,18 +74,18 @@ discard block |
||
74 | 74 | */ |
75 | 75 | public function onCreate() |
76 | 76 | { |
77 | - if ( strpos($this->filtername, self::FILTER_NAMESPACE) !== 0 ) { |
|
77 | + if (strpos($this->filtername, self::FILTER_NAMESPACE) !== 0) { |
|
78 | 78 | return false; |
79 | 79 | } |
80 | 80 | |
81 | 81 | $parameterString = substr($this->filtername, strlen(self::FILTER_NAMESPACE)); |
82 | 82 | |
83 | - if ( ! preg_match('/^(?P<from>[-\w]+)(:(?P<to>[-\w]+))?$/', $parameterString, $matches) ) { |
|
83 | + if (!preg_match('/^(?P<from>[-\w]+)(:(?P<to>[-\w]+))?$/', $parameterString, $matches)) { |
|
84 | 84 | return false; |
85 | 85 | } |
86 | 86 | |
87 | 87 | $this->fromCharset = isset($matches['from']) ? $matches['from'] : 'auto'; |
88 | - $this->toCharset = isset($matches['to']) ? $matches['to'] : mb_internal_encoding(); |
|
88 | + $this->toCharset = isset($matches['to']) ? $matches['to'] : mb_internal_encoding(); |
|
89 | 89 | |
90 | 90 | return true; |
91 | 91 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | */ |
100 | 100 | public function filter($in, $out, &$consumed, $closing) |
101 | 101 | { |
102 | - while ( $bucket = stream_bucket_make_writeable($in) ) { |
|
102 | + while ($bucket = stream_bucket_make_writeable($in)) { |
|
103 | 103 | $bucket->data = mb_convert_encoding($bucket->data, $this->toCharset, $this->fromCharset); |
104 | 104 | $consumed += $bucket->datalen; |
105 | 105 | stream_bucket_append($out, $bucket); |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | $flags = $this->config->getFlags(); |
48 | 48 | $ignoreHeader = $this->config->getIgnoreHeaderLine(); |
49 | 49 | |
50 | - if ( $fromCharset === null ) { |
|
50 | + if ($fromCharset === null) { |
|
51 | 51 | $url = $filename; |
52 | 52 | } else { |
53 | 53 | $url = ConvertMbstringEncoding::getFilterURL($filename, $fromCharset, $toCharset); |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | $originalLocale = setlocale(LC_ALL, '0'); // Backup current locale |
62 | 62 | setlocale(LC_ALL, 'en_US.UTF-8'); |
63 | 63 | |
64 | - foreach ( $csv as $lineNumber => $line ) { |
|
64 | + foreach ($csv as $lineNumber => $line) { |
|
65 | 65 | if ($ignoreHeader && $lineNumber == 0 || (count($line) === 1 && empty($line[0]))) { |
66 | 66 | continue; |
67 | 67 | } |