@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | throw new BadMethodCallException("'$dest' is not a printer on this system. " . |
55 | 55 | "Printers are: [" . implode(", ", $valid) . "]"); |
56 | 56 | } |
57 | - $this->buffer = array (); |
|
57 | + $this->buffer = array(); |
|
58 | 58 | $this->printerName = $dest; |
59 | 59 | } |
60 | 60 | |
@@ -105,18 +105,18 @@ discard block |
||
105 | 105 | */ |
106 | 106 | protected function getCmdOutput($cmd) |
107 | 107 | { |
108 | - $descriptors = array ( |
|
109 | - 1 => array ( |
|
108 | + $descriptors = array( |
|
109 | + 1 => array( |
|
110 | 110 | "pipe", |
111 | 111 | "w" |
112 | 112 | ), |
113 | - 2 => array ( |
|
113 | + 2 => array( |
|
114 | 114 | "pipe", |
115 | 115 | "w" |
116 | 116 | ) |
117 | 117 | ); |
118 | 118 | $process = proc_open($cmd, $descriptors, $fd); |
119 | - if (! is_resource($process)) { |
|
119 | + if (!is_resource($process)) { |
|
120 | 120 | throw new Exception("Command '$cmd' failed to start."); |
121 | 121 | } |
122 | 122 | /* Read stdout */ |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | */ |
112 | 112 | public function getHeightBytes() |
113 | 113 | { |
114 | - return (int)(($this -> imgHeight + 7) / 8); |
|
114 | + return (int) (($this -> imgHeight + 7) / 8); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | */ |
128 | 128 | public function getWidthBytes() |
129 | 129 | { |
130 | - return (int)(($this -> imgWidth + 7) / 8); |
|
130 | + return (int) (($this -> imgWidth + 7) / 8); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | /** |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | return $data; |
284 | 284 | } |
285 | 285 | do { |
286 | - $byteVal |= (int)$this -> imgData[$y * $widthPixels + $x] << (7 - $bit); |
|
286 | + $byteVal |= (int) $this -> imgData[$y * $widthPixels + $x] << (7 - $bit); |
|
287 | 287 | $x++; |
288 | 288 | $bit++; |
289 | 289 | if ($x >= $widthPixels) { |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | do { |
361 | 361 | $yReal = $y + $yStart; |
362 | 362 | if ($yReal < $heightPixels) { |
363 | - $byteVal |= (int)$this -> imgData[$yReal * $widthPixels + $x] << (7 - $bit); |
|
363 | + $byteVal |= (int) $this -> imgData[$yReal * $widthPixels + $x] << (7 - $bit); |
|
364 | 364 | } |
365 | 365 | $y++; |
366 | 366 | $bit++; |
@@ -911,7 +911,7 @@ |
||
911 | 911 | public function setPrintWidth(int $width = 512) |
912 | 912 | { |
913 | 913 | self::validateInteger($width, 1, 65535, __FUNCTION__); |
914 | - $this -> connector -> write(Printer::GS . 'W' . self::intLowHigh($width, 2)); |
|
914 | + $this -> connector -> write(Printer::GS . 'W' . self::intLowHigh($width, 2)); |
|
915 | 915 | } |
916 | 916 | |
917 | 917 | /** |
@@ -476,8 +476,8 @@ discard block |
||
476 | 476 | */ |
477 | 477 | public function bitImageColumnFormat(EscposImage $img, int $size = Printer::IMG_DEFAULT) |
478 | 478 | { |
479 | - $highDensityVertical = ! (($size & self::IMG_DOUBLE_HEIGHT) == Printer::IMG_DOUBLE_HEIGHT); |
|
480 | - $highDensityHorizontal = ! (($size & self::IMG_DOUBLE_WIDTH) == Printer::IMG_DOUBLE_WIDTH); |
|
479 | + $highDensityVertical = !(($size & self::IMG_DOUBLE_HEIGHT) == Printer::IMG_DOUBLE_HEIGHT); |
|
480 | + $highDensityHorizontal = !(($size & self::IMG_DOUBLE_WIDTH) == Printer::IMG_DOUBLE_WIDTH); |
|
481 | 481 | // Experimental column format printing |
482 | 482 | // This feature is not yet complete and may produce unpredictable results. |
483 | 483 | $this -> setLineSpacing(16); // 16-dot line spacing. This is the correct value on both TM-T20 and TM-U220 |
@@ -671,7 +671,7 @@ discard block |
||
671 | 671 | $this -> wrapperSend2dCodeData(chr(67), $cn, chr($width)); |
672 | 672 | $this -> wrapperSend2dCodeData(chr(68), $cn, chr($heightMultiplier)); |
673 | 673 | // Set error correction ratio: 1% to 400% |
674 | - $ec_int = (int)ceil(floatval($ec) * 10); |
|
674 | + $ec_int = (int) ceil(floatval($ec) * 10); |
|
675 | 675 | $this -> wrapperSend2dCodeData(chr(69), $cn, chr($ec_int), '1'); |
676 | 676 | // Send content & print |
677 | 677 | $this -> wrapperSend2dCodeData(chr(80), $cn, $content, '0'); |
@@ -992,7 +992,7 @@ discard block |
||
992 | 992 | */ |
993 | 993 | public function text(string $str) |
994 | 994 | { |
995 | - $this -> buffer -> writeText((string)$str); |
|
995 | + $this -> buffer -> writeText((string) $str); |
|
996 | 996 | } |
997 | 997 | |
998 | 998 | /** |
@@ -1007,7 +1007,7 @@ discard block |
||
1007 | 1007 | { |
1008 | 1008 | $this -> connector -> write(self::FS . "&"); |
1009 | 1009 | $str = \UConverter::transcode($str, "GBK", "UTF-8"); |
1010 | - $this -> buffer -> writeTextRaw((string)$str); |
|
1010 | + $this -> buffer -> writeTextRaw((string) $str); |
|
1011 | 1011 | $this -> connector -> write(self::FS . "."); |
1012 | 1012 | } |
1013 | 1013 | |
@@ -1021,7 +1021,7 @@ discard block |
||
1021 | 1021 | */ |
1022 | 1022 | public function textRaw(string $str = "") |
1023 | 1023 | { |
1024 | - $this -> buffer -> writeTextRaw((string)$str); |
|
1024 | + $this -> buffer -> writeTextRaw((string) $str); |
|
1025 | 1025 | } |
1026 | 1026 | |
1027 | 1027 | /** |
@@ -1094,7 +1094,7 @@ discard block |
||
1094 | 1094 | $outp = ""; |
1095 | 1095 | for ($i = 0; $i < $length; $i++) { |
1096 | 1096 | $outp .= chr($input % 256); |
1097 | - $input = (int)($input / 256); |
|
1097 | + $input = (int) ($input / 256); |
|
1098 | 1098 | } |
1099 | 1099 | return $outp; |
1100 | 1100 | } |
@@ -73,7 +73,7 @@ |
||
73 | 73 | /* Faster to average channels, blend alpha and negate the image here than via filters (tested!) */ |
74 | 74 | $cols = imagecolorsforindex($im, imagecolorat($im, $x, $y)); |
75 | 75 | // 1 for white, 0 for black, ignoring transparency |
76 | - $greyness = (int)(($cols['red'] + $cols['green'] + $cols['blue']) / 3) >> 7; |
|
76 | + $greyness = (int) (($cols['red'] + $cols['green'] + $cols['blue']) / 3) >> 7; |
|
77 | 77 | // 1 for black, 0 for white, taking into account transparency |
78 | 78 | $black = (1 - $greyness) >> ($cols['alpha'] >> 6); |
79 | 79 | $imgData[$y * $imgWidth + $x] = $black; |
@@ -44,7 +44,7 @@ |
||
44 | 44 | /* Faster to average channels, blend alpha and negate the image here than via filters (tested!) */ |
45 | 45 | $cols = $im -> getImagePixelColor($x, $y); |
46 | 46 | $cols = $cols -> getcolor(); |
47 | - $greyness = (int)(($cols['r'] + $cols['g'] + $cols['b']) / 3) >> 7; // 1 for white, 0 for black |
|
47 | + $greyness = (int) (($cols['r'] + $cols['g'] + $cols['b']) / 3) >> 7; // 1 for white, 0 for black |
|
48 | 48 | $imgData[$y * $imgWidth + $x] = (1 - $greyness); // 1 for black, 0 for white |
49 | 49 | } |
50 | 50 | } |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | { |
161 | 161 | if (!\is_array($resp) || !isset($resp['error'])) { |
162 | 162 | $msg = "Invalid response object from API: {$rbody} " |
163 | - . "(HTTP response code was {$rcode})"; |
|
163 | + . "(HTTP response code was {$rcode})"; |
|
164 | 164 | |
165 | 165 | throw new Exception\UnexpectedValueException($msg); |
166 | 166 | } |
@@ -360,9 +360,9 @@ discard block |
||
360 | 360 | |
361 | 361 | if (!$myApiKey) { |
362 | 362 | $msg = 'No API key provided. (HINT: set your API key using ' |
363 | - . '"Stripe::setApiKey(<API-KEY>)". You can generate API keys from ' |
|
364 | - . 'the Stripe web interface. See https://stripe.com/api for ' |
|
365 | - . 'details, or email [email protected] if you have any questions.'; |
|
363 | + . '"Stripe::setApiKey(<API-KEY>)". You can generate API keys from ' |
|
364 | + . 'the Stripe web interface. See https://stripe.com/api for ' |
|
365 | + . 'details, or email [email protected] if you have any questions.'; |
|
366 | 366 | |
367 | 367 | throw new Exception\AuthenticationException($msg); |
368 | 368 | } |
@@ -384,8 +384,8 @@ discard block |
||
384 | 384 | ); |
385 | 385 | if (\count($optionKeysInParams) > 0) { |
386 | 386 | $message = \sprintf('Options found in $params: %s. Options should ' |
387 | - . 'be passed in their own array after $params. (HINT: pass an ' |
|
388 | - . 'empty array to $params if you do not have any.)', \implode(', ', $optionKeysInParams)); |
|
387 | + . 'be passed in their own array after $params. (HINT: pass an ' |
|
388 | + . 'empty array to $params if you do not have any.)', \implode(', ', $optionKeysInParams)); |
|
389 | 389 | \trigger_error($message, \E_USER_WARNING); |
390 | 390 | } |
391 | 391 | } |
@@ -553,7 +553,7 @@ discard block |
||
553 | 553 | $jsonError = \json_last_error(); |
554 | 554 | if (null === $resp && \JSON_ERROR_NONE !== $jsonError) { |
555 | 555 | $msg = "Invalid response body from API: {$rbody} " |
556 | - . "(HTTP response code was {$rcode}, json_last_error() was {$jsonError})"; |
|
556 | + . "(HTTP response code was {$rcode}, json_last_error() was {$jsonError})"; |
|
557 | 557 | |
558 | 558 | throw new Exception\UnexpectedValueException($msg, $rcode); |
559 | 559 | } |
@@ -378,7 +378,7 @@ |
||
378 | 378 | if ($params && \is_array($params)) { |
379 | 379 | $optionKeysInParams = \array_filter( |
380 | 380 | static::$OPTIONS_KEYS, |
381 | - function ($key) use ($params) { |
|
381 | + function($key) use ($params) { |
|
382 | 382 | return \array_key_exists($key, $params); |
383 | 383 | } |
384 | 384 | ); |
@@ -72,9 +72,9 @@ |
||
72 | 72 | return parent::offsetGet($k); |
73 | 73 | } |
74 | 74 | $msg = "You tried to access the {$k} index, but SearchResult " . |
75 | - 'types only support string keys. (HINT: Search calls ' . |
|
76 | - 'return an object with a `data` (which is the data ' . |
|
77 | - "array). You likely want to call ->data[{$k}])"; |
|
75 | + 'types only support string keys. (HINT: Search calls ' . |
|
76 | + 'return an object with a `data` (which is the data ' . |
|
77 | + "array). You likely want to call ->data[{$k}])"; |
|
78 | 78 | |
79 | 79 | throw new Exception\InvalidArgumentException($msg); |
80 | 80 | } |
@@ -61,7 +61,7 @@ |
||
61 | 61 | if (null === $params) { |
62 | 62 | return null; |
63 | 63 | } |
64 | - \array_walk_recursive($params, function (&$value, $key) { |
|
64 | + \array_walk_recursive($params, function(&$value, $key) { |
|
65 | 65 | if (null === $value) { |
66 | 66 | $value = ''; |
67 | 67 | } |
@@ -92,13 +92,13 @@ |
||
92 | 92 | } |
93 | 93 | if (null === $clientId) { |
94 | 94 | $msg = 'No client_id provided. (HINT: set your client_id using ' |
95 | - . '`new \Stripe\StripeClient([clientId => <CLIENT-ID> |
|
95 | + . '`new \Stripe\StripeClient([clientId => <CLIENT-ID> |
|
96 | 96 | ])`)". You can find your client_ids ' |
97 | - . 'in your Stripe dashboard at ' |
|
98 | - . 'https://dashboard.stripe.com/account/applications/settings, ' |
|
99 | - . 'after registering your account as a platform. See ' |
|
100 | - . 'https://stripe.com/docs/connect/standard-accounts for details, ' |
|
101 | - . 'or email [email protected] if you have any questions.'; |
|
97 | + . 'in your Stripe dashboard at ' |
|
98 | + . 'https://dashboard.stripe.com/account/applications/settings, ' |
|
99 | + . 'after registering your account as a platform. See ' |
|
100 | + . 'https://stripe.com/docs/connect/standard-accounts for details, ' |
|
101 | + . 'or email [email protected] if you have any questions.'; |
|
102 | 102 | |
103 | 103 | throw new \Stripe\Exception\AuthenticationException($msg); |
104 | 104 | } |
@@ -144,7 +144,6 @@ |
||
144 | 144 | private function _getBase($opts) |
145 | 145 | { |
146 | 146 | return isset($opts->apiBase) ? |
147 | - $opts->apiBase : |
|
148 | - $this->client->getConnectBase(); |
|
147 | + $opts->apiBase : $this->client->getConnectBase(); |
|
149 | 148 | } |
150 | 149 | } |