@@ -15,20 +15,20 @@ discard block |
||
| 15 | 15 | /** |
| 16 | 16 | * |
| 17 | 17 | */ |
| 18 | -class Util{ |
|
| 18 | +class Util { |
|
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | 21 | * @param string $s |
| 22 | 22 | * |
| 23 | 23 | * @return bool |
| 24 | 24 | */ |
| 25 | - public static function isNumber($s){ |
|
| 25 | + public static function isNumber($s) { |
|
| 26 | 26 | |
| 27 | 27 | $len = strlen($s); |
| 28 | - for($i = 0; $i < $len; $i++){ |
|
| 28 | + for ($i = 0; $i < $len; $i++) { |
|
| 29 | 29 | $c = ord($s[$i]); |
| 30 | 30 | |
| 31 | - if(!(ord('0') <= $c && $c <= ord('9'))){ |
|
| 31 | + if (!(ord('0') <= $c && $c <= ord('9'))) { |
|
| 32 | 32 | return false; |
| 33 | 33 | } |
| 34 | 34 | } |
@@ -41,13 +41,13 @@ discard block |
||
| 41 | 41 | * |
| 42 | 42 | * @return bool |
| 43 | 43 | */ |
| 44 | - public static function isAlphaNum($s){ |
|
| 44 | + public static function isAlphaNum($s) { |
|
| 45 | 45 | |
| 46 | 46 | $len = strlen($s); |
| 47 | - for($i = 0; $i < $len; $i++){ |
|
| 47 | + for ($i = 0; $i < $len; $i++) { |
|
| 48 | 48 | $c = ord($s[$i]); |
| 49 | 49 | |
| 50 | - if(!(ord('0') <= $c && $c <= ord('9')) && !(ord('A') <= $c && $c <= ord('Z')) && strpos(' $%*+-./:', $s[$i]) === false){ |
|
| 50 | + if (!(ord('0') <= $c && $c <= ord('9')) && !(ord('A') <= $c && $c <= ord('Z')) && strpos(' $%*+-./:', $s[$i]) === false) { |
|
| 51 | 51 | return false; |
| 52 | 52 | } |
| 53 | 53 | } |
@@ -60,25 +60,25 @@ discard block |
||
| 60 | 60 | * |
| 61 | 61 | * @return bool |
| 62 | 62 | */ |
| 63 | - public static function isKanji($s){ |
|
| 63 | + public static function isKanji($s) { |
|
| 64 | 64 | |
| 65 | - if(empty($s)){ |
|
| 65 | + if (empty($s)) { |
|
| 66 | 66 | return false; |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | $i = 0; |
| 70 | 70 | $len = strlen($s); |
| 71 | - while($i + 1 < $len){ |
|
| 71 | + while ($i + 1 < $len) { |
|
| 72 | 72 | $c = ((0xff&ord($s[$i])) << 8)|(0xff&ord($s[$i + 1])); |
| 73 | 73 | |
| 74 | - if(!($c >= 0x8140 && $c <= 0x9FFC) && !($c >= 0xE040 && $c <= 0xEBBF)){ |
|
| 74 | + if (!($c >= 0x8140 && $c <= 0x9FFC) && !($c >= 0xE040 && $c <= 0xEBBF)) { |
|
| 75 | 75 | return false; |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | $i += 2; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - if($i < $len){ |
|
| 81 | + if ($i < $len) { |
|
| 82 | 82 | return false; |
| 83 | 83 | } |
| 84 | 84 | |
@@ -90,10 +90,10 @@ discard block |
||
| 90 | 90 | * |
| 91 | 91 | * @return int |
| 92 | 92 | */ |
| 93 | - public static function getBCHTypeInfo($data){ |
|
| 93 | + public static function getBCHTypeInfo($data) { |
|
| 94 | 94 | $d = $data << 10; |
| 95 | 95 | |
| 96 | - while(self::getBCHDigit($d) - self::getBCHDigit(QRConst::G15) >= 0){ |
|
| 96 | + while (self::getBCHDigit($d) - self::getBCHDigit(QRConst::G15) >= 0) { |
|
| 97 | 97 | $d ^= (QRConst::G15 << (self::getBCHDigit($d) - self::getBCHDigit(QRConst::G15))); |
| 98 | 98 | } |
| 99 | 99 | |
@@ -105,10 +105,10 @@ discard block |
||
| 105 | 105 | * |
| 106 | 106 | * @return int |
| 107 | 107 | */ |
| 108 | - public static function getBCHTypeNumber($data){ |
|
| 108 | + public static function getBCHTypeNumber($data) { |
|
| 109 | 109 | $d = $data << 12; |
| 110 | 110 | |
| 111 | - while(self::getBCHDigit($d) - self::getBCHDigit(QRConst::G18) >= 0){ |
|
| 111 | + while (self::getBCHDigit($d) - self::getBCHDigit(QRConst::G18) >= 0) { |
|
| 112 | 112 | $d ^= (QRConst::G18 << (self::getBCHDigit($d) - self::getBCHDigit(QRConst::G18))); |
| 113 | 113 | } |
| 114 | 114 | |
@@ -120,10 +120,10 @@ discard block |
||
| 120 | 120 | * |
| 121 | 121 | * @return int |
| 122 | 122 | */ |
| 123 | - public static function getBCHDigit($data){ |
|
| 123 | + public static function getBCHDigit($data) { |
|
| 124 | 124 | $digit = 0; |
| 125 | 125 | |
| 126 | - while($data !== 0){ |
|
| 126 | + while ($data !== 0) { |
|
| 127 | 127 | $digit++; |
| 128 | 128 | $data >>= 1; |
| 129 | 129 | } |
@@ -138,12 +138,12 @@ discard block |
||
| 138 | 138 | * @return array |
| 139 | 139 | * @throws \chillerlan\QRCode\QRCodeException |
| 140 | 140 | */ |
| 141 | - public static function getRSBlocks($typeNumber, $errorCorrectLevel){ |
|
| 141 | + public static function getRSBlocks($typeNumber, $errorCorrectLevel) { |
|
| 142 | 142 | // PHP5 compat |
| 143 | 143 | $RSBLOCK = QRConst::RSBLOCK; |
| 144 | 144 | $BLOCK_TABLE = QRConst::BLOCK_TABLE; |
| 145 | 145 | |
| 146 | - if(!isset($RSBLOCK[$errorCorrectLevel])){ |
|
| 146 | + if (!isset($RSBLOCK[$errorCorrectLevel])) { |
|
| 147 | 147 | throw new QRCodeException('$typeNumber: '.$typeNumber.' / $errorCorrectLevel: '.$errorCorrectLevel); |
| 148 | 148 | } |
| 149 | 149 | |
@@ -151,8 +151,8 @@ discard block |
||
| 151 | 151 | |
| 152 | 152 | $list = []; |
| 153 | 153 | $length = count($rsBlock) / 3; |
| 154 | - for($i = 0; $i < $length; $i++){ |
|
| 155 | - for($j = 0; $j < $rsBlock[$i * 3 + 0]; $j++){ |
|
| 154 | + for ($i = 0; $i < $length; $i++) { |
|
| 155 | + for ($j = 0; $j < $rsBlock[$i * 3 + 0]; $j++) { |
|
| 156 | 156 | $list[] = [$rsBlock[$i * 3 + 1], $rsBlock[$i * 3 + 2]]; |
| 157 | 157 | } |
| 158 | 158 | } |
@@ -168,16 +168,16 @@ discard block |
||
| 168 | 168 | * @return int |
| 169 | 169 | * @throws \chillerlan\QRCode\QRCodeException |
| 170 | 170 | */ |
| 171 | - public static function getMaxLength($typeNumber, $mode, $ecLevel){ |
|
| 171 | + public static function getMaxLength($typeNumber, $mode, $ecLevel) { |
|
| 172 | 172 | $RSBLOCK = QRConst::RSBLOCK; |
| 173 | 173 | $MAX_LENGTH = QRConst::MAX_LENGTH; |
| 174 | 174 | $MODE = QRConst::MODE; |
| 175 | 175 | |
| 176 | - if(!isset($RSBLOCK[$ecLevel])){ |
|
| 176 | + if (!isset($RSBLOCK[$ecLevel])) { |
|
| 177 | 177 | throw new QRCodeException('Invalid error correct level: '.$ecLevel); |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | - if(!isset($MODE[$mode])){ |
|
| 180 | + if (!isset($MODE[$mode])) { |
|
| 181 | 181 | throw new QRCodeException('Invalid mode: '.$mode); |
| 182 | 182 | } |
| 183 | 183 | |
@@ -12,36 +12,36 @@ |
||
| 12 | 12 | use chillerlan\QRCode\BitBuffer; |
| 13 | 13 | use chillerlan\QRCode\QRConst; |
| 14 | 14 | |
| 15 | -class BitBufferTest extends \PHPUnit_Framework_TestCase{ |
|
| 15 | +class BitBufferTest extends \PHPUnit_Framework_TestCase { |
|
| 16 | 16 | |
| 17 | 17 | /** |
| 18 | 18 | * @var \chillerlan\QRCode\BitBuffer |
| 19 | 19 | */ |
| 20 | 20 | protected $bitBuffer; |
| 21 | 21 | |
| 22 | - protected function setUp(){ |
|
| 22 | + protected function setUp() { |
|
| 23 | 23 | $this->bitBuffer = new BitBuffer; |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - public function bitProvider(){ |
|
| 26 | + public function bitProvider() { |
|
| 27 | 27 | return [ |
| 28 | - [QRConst::MODE_NUMBER, 16], |
|
| 29 | - [QRConst::MODE_ALPHANUM, 32], |
|
| 30 | - [QRConst::MODE_BYTE, 64], |
|
| 31 | - [QRConst::MODE_KANJI, 128], |
|
| 28 | + [QRConst::MODE_NUMBER, 16], |
|
| 29 | + [QRConst::MODE_ALPHANUM, 32], |
|
| 30 | + [QRConst::MODE_BYTE, 64], |
|
| 31 | + [QRConst::MODE_KANJI, 128], |
|
| 32 | 32 | ]; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | /** |
| 36 | 36 | * @dataProvider bitProvider |
| 37 | 37 | */ |
| 38 | - public function testPut($data, $value){ |
|
| 38 | + public function testPut($data, $value) { |
|
| 39 | 39 | $this->bitBuffer->put($data, 4); |
| 40 | 40 | $this->assertEquals($value, $this->bitBuffer->buffer[0]); |
| 41 | 41 | $this->assertEquals(4, $this->bitBuffer->length); |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - public function testClear(){ |
|
| 44 | + public function testClear() { |
|
| 45 | 45 | $this->bitBuffer->clear(); |
| 46 | 46 | $this->assertEquals([], $this->bitBuffer->buffer); |
| 47 | 47 | $this->assertEquals(0, $this->bitBuffer->length); |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | use chillerlan\QRCode\Data\Kanji; |
| 18 | 18 | use chillerlan\QRCode\Data\Number; |
| 19 | 19 | |
| 20 | -class DataTest extends \PHPUnit_Framework_TestCase{ |
|
| 20 | +class DataTest extends \PHPUnit_Framework_TestCase { |
|
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | 23 | * @var \chillerlan\QRCode\BitBuffer |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | */ |
| 30 | 30 | protected $module; |
| 31 | 31 | |
| 32 | - public function bitProvider(){ |
|
| 32 | + public function bitProvider() { |
|
| 33 | 33 | return [ |
| 34 | 34 | [QRConst::MODE_NUMBER, Number::class, '123456789'], |
| 35 | 35 | [QRConst::MODE_NUMBER, Number::class, '1234567890'], |
@@ -40,14 +40,14 @@ discard block |
||
| 40 | 40 | ]; |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - protected function setUp(){ |
|
| 43 | + protected function setUp() { |
|
| 44 | 44 | $this->bitBuffer = new BitBuffer; |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | 48 | * @dataProvider bitProvider |
| 49 | 49 | */ |
| 50 | - public function testMode($mode, $class, $data){ |
|
| 50 | + public function testMode($mode, $class, $data) { |
|
| 51 | 51 | $this->module = new $class($data); |
| 52 | 52 | $this->assertEquals($mode, $this->module->mode); |
| 53 | 53 | } |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | /** |
| 56 | 56 | * @dataProvider bitProvider |
| 57 | 57 | */ |
| 58 | - public function testWrite($mode, $class, $data){ |
|
| 58 | + public function testWrite($mode, $class, $data) { |
|
| 59 | 59 | $this->bitBuffer->clear(); |
| 60 | 60 | $this->module = new $class($data); |
| 61 | 61 | $this->module->write($this->bitBuffer); |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | * @expectedException \chillerlan\QRCode\Data\QRCodeDataException |
| 66 | 66 | * @expectedExceptionMessage illegal char: 92 |
| 67 | 67 | */ |
| 68 | - public function testAlphaNumCharException(){ |
|
| 68 | + public function testAlphaNumCharException() { |
|
| 69 | 69 | $this->bitBuffer->clear(); |
| 70 | 70 | $this->module = new AlphaNum('\\'); |
| 71 | 71 | $this->module->write($this->bitBuffer); |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | * @expectedException \chillerlan\QRCode\Data\QRCodeDataException |
| 76 | 76 | * @expectedExceptionMessage illegal char at 7 (50051) |
| 77 | 77 | */ |
| 78 | - public function testKanjiCharExceptionA(){ |
|
| 78 | + public function testKanjiCharExceptionA() { |
|
| 79 | 79 | $this->bitBuffer->clear(); |
| 80 | 80 | $this->module = new Kanji('茗荷Ã'); |
| 81 | 81 | $this->module->write($this->bitBuffer); |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | * @expectedException \chillerlan\QRCode\Data\QRCodeDataException |
| 86 | 86 | * @expectedExceptionMessage illegal char at 7 |
| 87 | 87 | */ |
| 88 | - public function testKanjiCharExceptionB(){ |
|
| 88 | + public function testKanjiCharExceptionB() { |
|
| 89 | 89 | $this->bitBuffer->clear(); |
| 90 | 90 | $this->module = new Kanji('茗荷\\'); |
| 91 | 91 | $this->module->write($this->bitBuffer); |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | * @expectedException \chillerlan\QRCode\Data\QRCodeDataException |
| 96 | 96 | * @expectedExceptionMessage illegal char: 92 |
| 97 | 97 | */ |
| 98 | - public function testNumberCharException(){ |
|
| 98 | + public function testNumberCharException() { |
|
| 99 | 99 | $this->bitBuffer->clear(); |
| 100 | 100 | $this->module = new Number('\\'); |
| 101 | 101 | $this->module->write($this->bitBuffer); |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | use chillerlan\QRCode\Output\QRImageOptions; |
| 16 | 16 | use chillerlan\QRCode\QRCode; |
| 17 | 17 | |
| 18 | -class ImageTest extends \PHPUnit_Framework_TestCase{ |
|
| 18 | +class ImageTest extends \PHPUnit_Framework_TestCase { |
|
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | 21 | * @var \chillerlan\QRCode\Output\QRImageOptions |
@@ -28,28 +28,28 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | protected $QRCode; |
| 30 | 30 | |
| 31 | - protected function setUp(){ |
|
| 31 | + protected function setUp() { |
|
| 32 | 32 | $this->options = new QRImageOptions; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - public function testOptionsInstance(){ |
|
| 35 | + public function testOptionsInstance() { |
|
| 36 | 36 | $this->assertInstanceOf(QRImageOptions::class, $this->options); |
| 37 | 37 | $this->assertEquals(QRCode::OUTPUT_IMAGE_PNG, $this->options->type); |
| 38 | 38 | $this->assertEquals(true, $this->options->base64); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - public function testImageInstance(){ |
|
| 41 | + public function testImageInstance() { |
|
| 42 | 42 | $this->assertInstanceOf(QRImage::class, new QRImage); |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - public function testImageInstanceWithOptionsOverride(){ |
|
| 45 | + public function testImageInstanceWithOptionsOverride() { |
|
| 46 | 46 | $this->options->type = 'foobar'; |
| 47 | 47 | $this->options->pngCompression = 42; |
| 48 | 48 | $this->options->jpegQuality = 'OVER 9000!!!'; |
| 49 | 49 | $this->assertInstanceOf(QRImage::class, new QRImage($this->options)); |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - public function imageDataProvider(){ |
|
| 52 | + public function imageDataProvider() { |
|
| 53 | 53 | return [ |
| 54 | 54 | ['foobar', QRCode::OUTPUT_IMAGE_PNG, 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHMAAABzCAIAAAAkIaqxAAAABnRSTlMA/wD/AP83WBt9AAACGUlEQVR4nO3cwU4DMQwAUYL4/19e7j54ZTmTuNW8G6K0MIqw0mZ3Pc/zI8Dv7V/ga1mWYlmKZSl/4eu11pkXLk3O0m8VnvnWX+SapViWYlmKZSlxggUbd2j5JOnMqJJjf5FrlmJZimUplqW8TLCAmzP5xil/qtKD85/NlZ7ZNUuxLMWyFMtSahPslnzOzPwozzVLsSzFshTLUqZMsNKMCg/u7ME4rlmKZSmWpViWUptg3HDoHL8Y8rFY4JqlWJZiWYplKS8T7NhBvnwf1flu/kIc1yzFshTLUixLWUPecws+8YOvwDVLsSzFshTLUl6uB9u4F+p8WnXsLOLGF3LNUixLsSzFspS4B9v4Jltnp7TxEuZjbzl6RfMhlqVYlmJZSuskB3eR8sa5WvrZ0vTLuWYplqVYlmJZSus0fekf/K2rkm+dxHfNUixLsSzFspTaXaXy//elWdF5odJ3bx0Kcc1SLEuxLMWylClnEbm90MadYc7PwQ6xLMWyFMtSwJMcuc7o2HjKsfNC+YNdsxTLUixLsSxlyr3pO7h9VIdrlmJZimUplqVMuTf9xtOG+ese23O6ZimWpViWYlnKlDv7Drl0ujMMA9csxbIUy1IsS5kywbi90MZ9Y2lUumYplqVYlmJZytB705ccOy/vXaVGsCzFshTLUj7y3vRB55pl7i1H1yzFshTLUixLmXI92PdxzVIsS7EsxbKUf5cMC/onT8WdAAAAAElFTkSuQmCC'], |
| 55 | 55 | ['foobar', QRCode::OUTPUT_IMAGE_GIF, 'data:image/gif;base64,R0lGODlhcwBzAIAAAAQCBP///yH5BAEAAAEALAAAAABzAHMAAAL+jI+py+0Po5y02ouz3rz7D4biSJYXgKbqyrbt5L5ITNerY+c0rCf6z8IBhwBezkcECpM9yQ/JPDaizchzRrUtUZ0bVmpVdcVT8sZ7uIZTY3bZfTYb1BC0xq7AY/D0h/4klxe4F9i3VcTxl1ZYNTf4xfUWuQjnCGY5ucDXGKCIiciwWdnJ6Uk62meqyoha+kiZeaoFCar5+gkVm3orW9u7Q3soHEwLDOub67s7mmxs23rZO3zsLC1ZM/1ZvQo9e3xYndwcI3497lIeypmuTU6s3o39/uxNr+zKPP/r/l3MKtOPGj9c5vyh07dtoDWBBwPaOweQIENdCkXVW/jQYET+jPviWbwXjRvFkP+CaAQ58qJIZIDyOeTILsPKNrFizkzEy5SRmghz8trJ8iUhlxKLCiJK4WYcpB+zyfSZJWE8m1HDnaxKderVqOCqlsya0utKsVpffiTLc6JXsCjbog1qYs3GuHRDWK2Ld+ncvHyH7u0LGKjOwEfDsnUaE7E+p00XOxZaEF7ajGa/RqZcB+rkwm0PX+YMVLHkzj2ZaoYL+nNXIn7lVTYdDaKSliotj77bjjVt10bHKpRtyAk+w9dwdxzSWirx279PAl/nfGvZ3JuVR1kd1rps7G6TcH8+/Thq60y+S19OfXxFrsVLao/OHPbf3t7h2/Mt3+Ro8Bv+jftvrhZj9QXYXn74VefecPrdd9qB6nmkoIMCGrheeMHFh2B4/JH22kXm7fdYeo11yJsfANJHYUMoZnciZ0oZtaFnag1GIGEhJtXihYDRmJmKLrbIF48m+hijjTcK1iCQeQn5IYNEnnddgegN2V+ObyWpoZTdpShWkzBpuZ2WWIF5pH3icTcmhhz2WOWTkFkgoXCxmZnYbl6iiWWGm4VGplwlhgmiXg/O96Ob6YlWQZx+/mcoR8uw6OOIMNJZWm0QRmrbpDViJp6knWbqaJ6DbtkmpKWu+eWmqc0I6qOoKsqpqxNOCaimsSo4K6q1pnorSfnJ6CStn8k6LKi7CnmMVoV6vipqnYGK2KqypP6pWqUlJmvhgGyOWiSJnpYn57LdrrhgqLr5met7qmLrYbVvJvqTmPGiGy5qfMIJHb5IOQvvvvL6S2/Ad8wbbLmt3TswwAUz6e7C7HmbYJaqbgguxJcKOzGUFZPLrq6UspoFWx3ze+a/VIgcMcaHGslyyy6/DHPMMs9Mc80WFAAAOw=='], |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | /** |
| 62 | 62 | * @dataProvider imageDataProvider |
| 63 | 63 | */ |
| 64 | - public function testImageOutput($data, $type, $expected){ |
|
| 64 | + public function testImageOutput($data, $type, $expected) { |
|
| 65 | 65 | $this->options->type = $type; |
| 66 | 66 | $this->assertEquals($expected, (new QRCode($data, new QRImage($this->options)))->output()); |
| 67 | 67 | } |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | * @expectedException \chillerlan\QRCode\Output\QRCodeOutputException |
| 71 | 71 | * @expectedExceptionMessage Invalid matrix! |
| 72 | 72 | */ |
| 73 | - public function testSetMatrixException(){ |
|
| 73 | + public function testSetMatrixException() { |
|
| 74 | 74 | (new QRImage)->setMatrix([]); |
| 75 | 75 | } |
| 76 | 76 | |
@@ -15,25 +15,25 @@ discard block |
||
| 15 | 15 | use chillerlan\QRCode\Output\QRStringOptions; |
| 16 | 16 | use chillerlan\QRCode\QRCode; |
| 17 | 17 | |
| 18 | -class StringTest extends \PHPUnit_Framework_TestCase{ |
|
| 18 | +class StringTest extends \PHPUnit_Framework_TestCase { |
|
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | 21 | * @var \chillerlan\QRCode\Output\QRStringOptions |
| 22 | 22 | */ |
| 23 | 23 | protected $options; |
| 24 | 24 | |
| 25 | - protected function setUp(){ |
|
| 25 | + protected function setUp() { |
|
| 26 | 26 | $this->options = new QRStringOptions; |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - public function testOptionsInstance(){ |
|
| 29 | + public function testOptionsInstance() { |
|
| 30 | 30 | $this->assertInstanceOf(QRStringOptions::class, $this->options); |
| 31 | 31 | $this->assertEquals(QRCode::OUTPUT_STRING_HTML, $this->options->type); |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - public function stringDataProvider(){ |
|
| 34 | + public function stringDataProvider() { |
|
| 35 | 35 | return [ |
| 36 | - ['foobar', true, QRCode::OUTPUT_STRING_HTML, '<p><b></b><b></b><b></b><b></b><b></b><b></b><b></b><i></i><i></i><i></i><b></b><b></b><b></b><i></i><b></b><b></b><b></b><b></b><b></b><b></b><b></b>'.PHP_EOL.'<p><b></b><i></i><i></i><i></i><i></i><i></i><b></b><i></i><b></b><b></b><b></b><i></i><i></i><i></i><b></b><i></i><i></i><i></i><i></i><i></i><b></b>'.PHP_EOL.'<p><b></b><i></i><b></b><b></b><b></b><i></i><b></b><i></i><i></i><b></b><i></i><i></i><b></b><i></i><b></b><i></i><b></b><b></b><b></b><i></i><b></b>'.PHP_EOL.'<p><b></b><i></i><b></b><b></b><b></b><i></i><b></b><i></i><i></i><b></b><b></b><b></b><i></i><i></i><b></b><i></i><b></b><b></b><b></b><i></i><b></b>'.PHP_EOL.'<p><b></b><i></i><b></b><b></b><b></b><i></i><b></b><i></i><b></b><b></b><i></i><b></b><b></b><i></i><b></b><i></i><b></b><b></b><b></b><i></i><b></b>'.PHP_EOL.'<p><b></b><i></i><i></i><i></i><i></i><i></i><b></b><i></i><i></i><b></b><i></i><b></b><i></i><i></i><b></b><i></i><i></i><i></i><i></i><i></i><b></b>'.PHP_EOL.'<p><b></b><b></b><b></b><b></b><b></b><b></b><b></b><i></i><b></b><i></i><b></b><i></i><b></b><i></i><b></b><b></b><b></b><b></b><b></b><b></b><b></b>'.PHP_EOL.'<p><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><b></b><b></b><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i>'.PHP_EOL.'<p><b></b><i></i><b></b><i></i><b></b><i></i><b></b><i></i><i></i><b></b><i></i><i></i><b></b><i></i><i></i><i></i><b></b><i></i><i></i><b></b><i></i>'.PHP_EOL.'<p><b></b><b></b><b></b><b></b><b></b><i></i><i></i><i></i><i></i><b></b><b></b><b></b><i></i><b></b><i></i><b></b><i></i><i></i><b></b><b></b><b></b>'.PHP_EOL.'<p><b></b><b></b><i></i><b></b><b></b><b></b><b></b><b></b><i></i><i></i><b></b><b></b><i></i><b></b><b></b><b></b><i></i><b></b><i></i><b></b><b></b>'.PHP_EOL.'<p><b></b><b></b><i></i><i></i><b></b><b></b><i></i><i></i><b></b><i></i><b></b><b></b><b></b><b></b><i></i><b></b><b></b><i></i><i></i><b></b><b></b>'.PHP_EOL.'<p><b></b><i></i><b></b><i></i><i></i><b></b><b></b><b></b><i></i><b></b><i></i><b></b><i></i><b></b><b></b><b></b><i></i><i></i><i></i><b></b><b></b>'.PHP_EOL.'<p><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><b></b><i></i><i></i><i></i><i></i><i></i><b></b><b></b><i></i><i></i><b></b><b></b><b></b>'.PHP_EOL.'<p><b></b><b></b><b></b><b></b><b></b><b></b><b></b><i></i><i></i><b></b><b></b><i></i><b></b><i></i><i></i><i></i><b></b><b></b><i></i><b></b><b></b>'.PHP_EOL.'<p><b></b><i></i><i></i><i></i><i></i><i></i><b></b><i></i><i></i><b></b><b></b><i></i><i></i><i></i><b></b><b></b><b></b><i></i><i></i><b></b><b></b>'.PHP_EOL.'<p><b></b><i></i><b></b><b></b><b></b><i></i><b></b><i></i><b></b><b></b><b></b><i></i><b></b><i></i><b></b><i></i><b></b><i></i><i></i><b></b><b></b>'.PHP_EOL.'<p><b></b><i></i><b></b><b></b><b></b><i></i><b></b><i></i><i></i><b></b><i></i><b></b><i></i><b></b><i></i><i></i><b></b><b></b><i></i><b></b><i></i>'.PHP_EOL.'<p><b></b><i></i><b></b><b></b><b></b><i></i><b></b><i></i><b></b><b></b><i></i><b></b><i></i><b></b><b></b><b></b><b></b><i></i><i></i><i></i><b></b>'.PHP_EOL.'<p><b></b><i></i><i></i><i></i><i></i><i></i><b></b><i></i><i></i><i></i><i></i><b></b><b></b><b></b><i></i><i></i><i></i><i></i><i></i><b></b><i></i>'.PHP_EOL.'<p><b></b><b></b><b></b><b></b><b></b><b></b><b></b><i></i><b></b><i></i><b></b><b></b><i></i><b></b><b></b><i></i><b></b><i></i><i></i><b></b><b></b>'.PHP_EOL], |
|
| 36 | + ['foobar', true, QRCode::OUTPUT_STRING_HTML, '<p><b></b><b></b><b></b><b></b><b></b><b></b><b></b><i></i><i></i><i></i><b></b><b></b><b></b><i></i><b></b><b></b><b></b><b></b><b></b><b></b><b></b>'.PHP_EOL.'<p><b></b><i></i><i></i><i></i><i></i><i></i><b></b><i></i><b></b><b></b><b></b><i></i><i></i><i></i><b></b><i></i><i></i><i></i><i></i><i></i><b></b>'.PHP_EOL.'<p><b></b><i></i><b></b><b></b><b></b><i></i><b></b><i></i><i></i><b></b><i></i><i></i><b></b><i></i><b></b><i></i><b></b><b></b><b></b><i></i><b></b>'.PHP_EOL.'<p><b></b><i></i><b></b><b></b><b></b><i></i><b></b><i></i><i></i><b></b><b></b><b></b><i></i><i></i><b></b><i></i><b></b><b></b><b></b><i></i><b></b>'.PHP_EOL.'<p><b></b><i></i><b></b><b></b><b></b><i></i><b></b><i></i><b></b><b></b><i></i><b></b><b></b><i></i><b></b><i></i><b></b><b></b><b></b><i></i><b></b>'.PHP_EOL.'<p><b></b><i></i><i></i><i></i><i></i><i></i><b></b><i></i><i></i><b></b><i></i><b></b><i></i><i></i><b></b><i></i><i></i><i></i><i></i><i></i><b></b>'.PHP_EOL.'<p><b></b><b></b><b></b><b></b><b></b><b></b><b></b><i></i><b></b><i></i><b></b><i></i><b></b><i></i><b></b><b></b><b></b><b></b><b></b><b></b><b></b>'.PHP_EOL.'<p><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><b></b><b></b><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i>'.PHP_EOL.'<p><b></b><i></i><b></b><i></i><b></b><i></i><b></b><i></i><i></i><b></b><i></i><i></i><b></b><i></i><i></i><i></i><b></b><i></i><i></i><b></b><i></i>'.PHP_EOL.'<p><b></b><b></b><b></b><b></b><b></b><i></i><i></i><i></i><i></i><b></b><b></b><b></b><i></i><b></b><i></i><b></b><i></i><i></i><b></b><b></b><b></b>'.PHP_EOL.'<p><b></b><b></b><i></i><b></b><b></b><b></b><b></b><b></b><i></i><i></i><b></b><b></b><i></i><b></b><b></b><b></b><i></i><b></b><i></i><b></b><b></b>'.PHP_EOL.'<p><b></b><b></b><i></i><i></i><b></b><b></b><i></i><i></i><b></b><i></i><b></b><b></b><b></b><b></b><i></i><b></b><b></b><i></i><i></i><b></b><b></b>'.PHP_EOL.'<p><b></b><i></i><b></b><i></i><i></i><b></b><b></b><b></b><i></i><b></b><i></i><b></b><i></i><b></b><b></b><b></b><i></i><i></i><i></i><b></b><b></b>'.PHP_EOL.'<p><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><b></b><i></i><i></i><i></i><i></i><i></i><b></b><b></b><i></i><i></i><b></b><b></b><b></b>'.PHP_EOL.'<p><b></b><b></b><b></b><b></b><b></b><b></b><b></b><i></i><i></i><b></b><b></b><i></i><b></b><i></i><i></i><i></i><b></b><b></b><i></i><b></b><b></b>'.PHP_EOL.'<p><b></b><i></i><i></i><i></i><i></i><i></i><b></b><i></i><i></i><b></b><b></b><i></i><i></i><i></i><b></b><b></b><b></b><i></i><i></i><b></b><b></b>'.PHP_EOL.'<p><b></b><i></i><b></b><b></b><b></b><i></i><b></b><i></i><b></b><b></b><b></b><i></i><b></b><i></i><b></b><i></i><b></b><i></i><i></i><b></b><b></b>'.PHP_EOL.'<p><b></b><i></i><b></b><b></b><b></b><i></i><b></b><i></i><i></i><b></b><i></i><b></b><i></i><b></b><i></i><i></i><b></b><b></b><i></i><b></b><i></i>'.PHP_EOL.'<p><b></b><i></i><b></b><b></b><b></b><i></i><b></b><i></i><b></b><b></b><i></i><b></b><i></i><b></b><b></b><b></b><b></b><i></i><i></i><i></i><b></b>'.PHP_EOL.'<p><b></b><i></i><i></i><i></i><i></i><i></i><b></b><i></i><i></i><i></i><i></i><b></b><b></b><b></b><i></i><i></i><i></i><i></i><i></i><b></b><i></i>'.PHP_EOL.'<p><b></b><b></b><b></b><b></b><b></b><b></b><b></b><i></i><b></b><i></i><b></b><b></b><i></i><b></b><b></b><i></i><b></b><i></i><i></i><b></b><b></b>'.PHP_EOL], |
|
| 37 | 37 | ['foobar', false, QRCode::OUTPUT_STRING_HTML, '<p><b></b><b></b><b></b><b></b><b></b><b></b><b></b><i></i><i></i><i></i><b></b><b></b><b></b><i></i><b></b><b></b><b></b><b></b><b></b><b></b><b></b></p>'.PHP_EOL.'<p><b></b><i></i><i></i><i></i><i></i><i></i><b></b><i></i><b></b><b></b><b></b><i></i><i></i><i></i><b></b><i></i><i></i><i></i><i></i><i></i><b></b></p>'.PHP_EOL.'<p><b></b><i></i><b></b><b></b><b></b><i></i><b></b><i></i><i></i><b></b><i></i><i></i><b></b><i></i><b></b><i></i><b></b><b></b><b></b><i></i><b></b></p>'.PHP_EOL.'<p><b></b><i></i><b></b><b></b><b></b><i></i><b></b><i></i><i></i><b></b><b></b><b></b><i></i><i></i><b></b><i></i><b></b><b></b><b></b><i></i><b></b></p>'.PHP_EOL.'<p><b></b><i></i><b></b><b></b><b></b><i></i><b></b><i></i><b></b><b></b><i></i><b></b><b></b><i></i><b></b><i></i><b></b><b></b><b></b><i></i><b></b></p>'.PHP_EOL.'<p><b></b><i></i><i></i><i></i><i></i><i></i><b></b><i></i><i></i><b></b><i></i><b></b><i></i><i></i><b></b><i></i><i></i><i></i><i></i><i></i><b></b></p>'.PHP_EOL.'<p><b></b><b></b><b></b><b></b><b></b><b></b><b></b><i></i><b></b><i></i><b></b><i></i><b></b><i></i><b></b><b></b><b></b><b></b><b></b><b></b><b></b></p>'.PHP_EOL.'<p><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><b></b><b></b><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i></p>'.PHP_EOL.'<p><b></b><i></i><b></b><i></i><b></b><i></i><b></b><i></i><i></i><b></b><i></i><i></i><b></b><i></i><i></i><i></i><b></b><i></i><i></i><b></b><i></i></p>'.PHP_EOL.'<p><b></b><b></b><b></b><b></b><b></b><i></i><i></i><i></i><i></i><b></b><b></b><b></b><i></i><b></b><i></i><b></b><i></i><i></i><b></b><b></b><b></b></p>'.PHP_EOL.'<p><b></b><b></b><i></i><b></b><b></b><b></b><b></b><b></b><i></i><i></i><b></b><b></b><i></i><b></b><b></b><b></b><i></i><b></b><i></i><b></b><b></b></p>'.PHP_EOL.'<p><b></b><b></b><i></i><i></i><b></b><b></b><i></i><i></i><b></b><i></i><b></b><b></b><b></b><b></b><i></i><b></b><b></b><i></i><i></i><b></b><b></b></p>'.PHP_EOL.'<p><b></b><i></i><b></b><i></i><i></i><b></b><b></b><b></b><i></i><b></b><i></i><b></b><i></i><b></b><b></b><b></b><i></i><i></i><i></i><b></b><b></b></p>'.PHP_EOL.'<p><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><b></b><i></i><i></i><i></i><i></i><i></i><b></b><b></b><i></i><i></i><b></b><b></b><b></b></p>'.PHP_EOL.'<p><b></b><b></b><b></b><b></b><b></b><b></b><b></b><i></i><i></i><b></b><b></b><i></i><b></b><i></i><i></i><i></i><b></b><b></b><i></i><b></b><b></b></p>'.PHP_EOL.'<p><b></b><i></i><i></i><i></i><i></i><i></i><b></b><i></i><i></i><b></b><b></b><i></i><i></i><i></i><b></b><b></b><b></b><i></i><i></i><b></b><b></b></p>'.PHP_EOL.'<p><b></b><i></i><b></b><b></b><b></b><i></i><b></b><i></i><b></b><b></b><b></b><i></i><b></b><i></i><b></b><i></i><b></b><i></i><i></i><b></b><b></b></p>'.PHP_EOL.'<p><b></b><i></i><b></b><b></b><b></b><i></i><b></b><i></i><i></i><b></b><i></i><b></b><i></i><b></b><i></i><i></i><b></b><b></b><i></i><b></b><i></i></p>'.PHP_EOL.'<p><b></b><i></i><b></b><b></b><b></b><i></i><b></b><i></i><b></b><b></b><i></i><b></b><i></i><b></b><b></b><b></b><b></b><i></i><i></i><i></i><b></b></p>'.PHP_EOL.'<p><b></b><i></i><i></i><i></i><i></i><i></i><b></b><i></i><i></i><i></i><i></i><b></b><b></b><b></b><i></i><i></i><i></i><i></i><i></i><b></b><i></i></p>'.PHP_EOL.'<p><b></b><b></b><b></b><b></b><b></b><b></b><b></b><i></i><b></b><i></i><b></b><b></b><i></i><b></b><b></b><i></i><b></b><i></i><i></i><b></b><b></b></p>'.PHP_EOL], |
| 38 | 38 | ['foobar', false, QRCode::OUTPUT_STRING_JSON, '[[true,true,true,true,true,true,true,false,false,false,true,true,true,false,true,true,true,true,true,true,true],[true,false,false,false,false,false,true,false,true,true,true,false,false,false,true,false,false,false,false,false,true],[true,false,true,true,true,false,true,false,false,true,false,false,true,false,true,false,true,true,true,false,true],[true,false,true,true,true,false,true,false,false,true,true,true,false,false,true,false,true,true,true,false,true],[true,false,true,true,true,false,true,false,true,true,false,true,true,false,true,false,true,true,true,false,true],[true,false,false,false,false,false,true,false,false,true,false,true,false,false,true,false,false,false,false,false,true],[true,true,true,true,true,true,true,false,true,false,true,false,true,false,true,true,true,true,true,true,true],[false,false,false,false,false,false,false,false,false,true,true,false,false,false,false,false,false,false,false,false,false],[true,false,true,false,true,false,true,false,false,true,false,false,true,false,false,false,true,false,false,true,false],[true,true,true,true,true,false,false,false,false,true,true,true,false,true,false,true,false,false,true,true,true],[true,true,false,true,true,true,true,true,false,false,true,true,false,true,true,true,false,true,false,true,true],[true,true,false,false,true,true,false,false,true,false,true,true,true,true,false,true,true,false,false,true,true],[true,false,true,false,false,true,true,true,false,true,false,true,false,true,true,true,false,false,false,true,true],[false,false,false,false,false,false,false,false,true,false,false,false,false,false,true,true,false,false,true,true,true],[true,true,true,true,true,true,true,false,false,true,true,false,true,false,false,false,true,true,false,true,true],[true,false,false,false,false,false,true,false,false,true,true,false,false,false,true,true,true,false,false,true,true],[true,false,true,true,true,false,true,false,true,true,true,false,true,false,true,false,true,false,false,true,true],[true,false,true,true,true,false,true,false,false,true,false,true,false,true,false,false,true,true,false,true,false],[true,false,true,true,true,false,true,false,true,true,false,true,false,true,true,true,true,false,false,false,true],[true,false,false,false,false,false,true,false,false,false,false,true,true,true,false,false,false,false,false,true,false],[true,true,true,true,true,true,true,false,true,false,true,true,false,true,true,false,true,false,false,true,true]]'], |
| 39 | 39 | ['foobar', false, QRCode::OUTPUT_STRING_TEXT, '####### ### #######'.PHP_EOL.'# # ### # #'.PHP_EOL.'# ### # # # # ### #'.PHP_EOL.'# ### # ### # ### #'.PHP_EOL.'# ### # ## ## # ### #'.PHP_EOL.'# # # # # #'.PHP_EOL.'####### # # # #######'.PHP_EOL.' ## '.PHP_EOL.'# # # # # # # # '.PHP_EOL.'##### ### # # ###'.PHP_EOL.'## ##### ## ### # ##'.PHP_EOL.'## ## # #### ## ##'.PHP_EOL.'# # ### # # ### ##'.PHP_EOL.' # ## ###'.PHP_EOL.'####### ## # ## ##'.PHP_EOL.'# # ## ### ##'.PHP_EOL.'# ### # ### # # # ##'.PHP_EOL.'# ### # # # # ## # '.PHP_EOL.'# ### # ## # #### #'.PHP_EOL.'# # ### # '.PHP_EOL.'####### # ## ## # ##'.PHP_EOL], |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | /** |
| 44 | 44 | * @dataProvider stringDataProvider |
| 45 | 45 | */ |
| 46 | - public function testStringOutput($data, $omitEndTag, $type, $expected){ |
|
| 46 | + public function testStringOutput($data, $omitEndTag, $type, $expected) { |
|
| 47 | 47 | $this->options->type = $type; |
| 48 | 48 | $this->options->htmlOmitEndTag = $omitEndTag; |
| 49 | 49 | $this->assertEquals($expected, (new QRCode($data, new QRString($this->options)))->output()); |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | * @expectedException \chillerlan\QRCode\Output\QRCodeOutputException |
| 54 | 54 | * @expectedExceptionMessage Invalid string output type! |
| 55 | 55 | */ |
| 56 | - public function testOutputTypeException(){ |
|
| 56 | + public function testOutputTypeException() { |
|
| 57 | 57 | $this->options->type = 'foo'; |
| 58 | 58 | new QRString($this->options); |
| 59 | 59 | } |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | * @expectedException \chillerlan\QRCode\Output\QRCodeOutputException |
| 63 | 63 | * @expectedExceptionMessage Invalid matrix! |
| 64 | 64 | */ |
| 65 | - public function testSetMatrixException(){ |
|
| 65 | + public function testSetMatrixException() { |
|
| 66 | 66 | (new QRString)->setMatrix([]); |
| 67 | 67 | } |
| 68 | 68 | |
@@ -13,28 +13,28 @@ |
||
| 13 | 13 | |
| 14 | 14 | use chillerlan\QRCode\Polynomial; |
| 15 | 15 | |
| 16 | -class PolynomialTest extends \PHPUnit_Framework_TestCase{ |
|
| 16 | +class PolynomialTest extends \PHPUnit_Framework_TestCase { |
|
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * @var \chillerlan\QRCode\Polynomial |
| 20 | 20 | */ |
| 21 | 21 | protected $polynomial; |
| 22 | 22 | |
| 23 | - protected function setUp(){ |
|
| 23 | + protected function setUp() { |
|
| 24 | 24 | $this->polynomial = new Polynomial; |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - public function testGexp(){ |
|
| 27 | + public function testGexp() { |
|
| 28 | 28 | $this->assertEquals(142, $this->polynomial->gexp( -1)); |
| 29 | 29 | $this->assertEquals(133, $this->polynomial->gexp(128)); |
| 30 | - $this->assertEquals(2, $this->polynomial->gexp(256)); |
|
| 30 | + $this->assertEquals(2, $this->polynomial->gexp(256)); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | /** |
| 34 | 34 | * @expectedException \chillerlan\QRCode\QRCodeException |
| 35 | 35 | * @expectedExceptionMessage log(0) |
| 36 | 36 | */ |
| 37 | - public function testGlogException(){ |
|
| 37 | + public function testGlogException() { |
|
| 38 | 38 | $this->polynomial->glog(0); |
| 39 | 39 | } |
| 40 | 40 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | use chillerlan\QRCode\QROptions; |
| 18 | 18 | use ReflectionClass; |
| 19 | 19 | |
| 20 | -class QRCodeTest extends \PHPUnit_Framework_TestCase{ |
|
| 20 | +class QRCodeTest extends \PHPUnit_Framework_TestCase { |
|
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | 23 | * @var \chillerlan\QRCode\QROptions |
@@ -34,19 +34,19 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | protected $reflectionClass; |
| 36 | 36 | |
| 37 | - protected function setUp(){ |
|
| 37 | + protected function setUp() { |
|
| 38 | 38 | $this->options = new QROptions; |
| 39 | 39 | $this->output = new QRString; |
| 40 | 40 | $this->reflectionClass = new ReflectionClass(QRCode::class); |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - public function testInstance(){ |
|
| 43 | + public function testInstance() { |
|
| 44 | 44 | $this->assertInstanceOf(QRString::class, $this->output); |
| 45 | 45 | $this->assertInstanceOf(QROptions::class, $this->options); |
| 46 | 46 | $this->assertInstanceOf(QRCode::class, $this->reflectionClass->newInstanceArgs(['foobar', $this->output, $this->options])); |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - public function stringDataProvider(){ |
|
| 49 | + public function stringDataProvider() { |
|
| 50 | 50 | return [ |
| 51 | 51 | ['1234567890'], |
| 52 | 52 | ['ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 $%*+-./:'], |
@@ -58,16 +58,16 @@ discard block |
||
| 58 | 58 | /** |
| 59 | 59 | * @dataProvider stringDataProvider |
| 60 | 60 | */ |
| 61 | - public function testDataCoverage($data){ |
|
| 61 | + public function testDataCoverage($data) { |
|
| 62 | 62 | (new QRCode($data, $this->output))->getRawData(); |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | /** |
| 66 | 66 | * @dataProvider stringDataProvider |
| 67 | 67 | */ |
| 68 | - public function testTypeAndErrorcorrectlevelCoverage($data){ |
|
| 69 | - foreach(QRConst::MAX_BITS as $type => $x){ |
|
| 70 | - foreach(QRConst::RSBLOCK as $eclevel => $y){ |
|
| 68 | + public function testTypeAndErrorcorrectlevelCoverage($data) { |
|
| 69 | + foreach (QRConst::MAX_BITS as $type => $x) { |
|
| 70 | + foreach (QRConst::RSBLOCK as $eclevel => $y) { |
|
| 71 | 71 | $this->options->typeNumber = $type; |
| 72 | 72 | $this->options->errorCorrectLevel = $eclevel; |
| 73 | 73 | $this->assertInstanceOf(QRCode::class, new QRCode($data, $this->output, $this->options)); |
@@ -78,29 +78,29 @@ discard block |
||
| 78 | 78 | /** |
| 79 | 79 | * @dataProvider stringDataProvider |
| 80 | 80 | */ |
| 81 | - public function testTypeAutoOverride($data){ |
|
| 81 | + public function testTypeAutoOverride($data) { |
|
| 82 | 82 | $this->options->typeNumber = QRCode::TYPE_05; |
| 83 | 83 | new QRCode($data, $this->output, $this->options); |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | |
| 87 | - public function getTypeNumberDataProvider(){ |
|
| 87 | + public function getTypeNumberDataProvider() { |
|
| 88 | 88 | return [ |
| 89 | - [true, QRCode::TYPE_05, 'foobar'], |
|
| 89 | + [true, QRCode::TYPE_05, 'foobar'], |
|
| 90 | 90 | [false, QRCode::TYPE_05, 'foobar'], |
| 91 | - [true, QRCode::TYPE_10, 'foobar'], |
|
| 91 | + [true, QRCode::TYPE_10, 'foobar'], |
|
| 92 | 92 | [false, QRCode::TYPE_10, 'foobar'], |
| 93 | - [true, QRCode::TYPE_05, '1234567890'], |
|
| 93 | + [true, QRCode::TYPE_05, '1234567890'], |
|
| 94 | 94 | [false, QRCode::TYPE_05, '1234567890'], |
| 95 | - [true, QRCode::TYPE_10, '1234567890'], |
|
| 95 | + [true, QRCode::TYPE_10, '1234567890'], |
|
| 96 | 96 | [false, QRCode::TYPE_10, '1234567890'], |
| 97 | - [true, QRCode::TYPE_05, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 $%*+-./:'], |
|
| 97 | + [true, QRCode::TYPE_05, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 $%*+-./:'], |
|
| 98 | 98 | [false, QRCode::TYPE_05, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 $%*+-./:'], |
| 99 | - [true, QRCode::TYPE_10, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 $%*+-./:'], |
|
| 99 | + [true, QRCode::TYPE_10, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 $%*+-./:'], |
|
| 100 | 100 | [false, QRCode::TYPE_10, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 $%*+-./:'], |
| 101 | - [true, QRCode::TYPE_05, '茗荷'], |
|
| 101 | + [true, QRCode::TYPE_05, '茗荷'], |
|
| 102 | 102 | [false, QRCode::TYPE_05, '茗荷'], |
| 103 | - [true, QRCode::TYPE_10, '茗荷'], |
|
| 103 | + [true, QRCode::TYPE_10, '茗荷'], |
|
| 104 | 104 | [false, QRCode::TYPE_10, '茗荷'], |
| 105 | 105 | ]; |
| 106 | 106 | } |
@@ -108,12 +108,12 @@ discard block |
||
| 108 | 108 | /** |
| 109 | 109 | * @dataProvider getTypeNumberDataProvider |
| 110 | 110 | */ |
| 111 | - public function testInternalGetTypeNumber($test, $type, $data){ |
|
| 111 | + public function testInternalGetTypeNumber($test, $type, $data) { |
|
| 112 | 112 | $method = $this->reflectionClass->getMethod('getMatrix'); |
| 113 | 113 | $method->setAccessible(true); |
| 114 | 114 | $this->options->typeNumber = $type; |
| 115 | 115 | |
| 116 | - for($i = 0; $i <= 7; $i++){ |
|
| 116 | + for ($i = 0; $i <= 7; $i++) { |
|
| 117 | 117 | $method->invokeArgs($this->reflectionClass->newInstanceArgs([$data, $this->output, $this->options]), [$test, $i]); |
| 118 | 118 | } |
| 119 | 119 | } |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | * @expectedException \chillerlan\QRCode\QRCodeException |
| 123 | 123 | * @expectedExceptionMessage No data given. |
| 124 | 124 | */ |
| 125 | - public function testNoDataException(){ |
|
| 125 | + public function testNoDataException() { |
|
| 126 | 126 | $this->reflectionClass->newInstanceArgs(['', $this->output]); |
| 127 | 127 | } |
| 128 | 128 | |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | * @expectedException \chillerlan\QRCode\QRCodeException |
| 131 | 131 | * @expectedExceptionMessage Invalid error correct level: 42 |
| 132 | 132 | */ |
| 133 | - public function testErrorCorrectLevelException(){ |
|
| 133 | + public function testErrorCorrectLevelException() { |
|
| 134 | 134 | $this->options->errorCorrectLevel = 42; |
| 135 | 135 | $this->reflectionClass->newInstanceArgs(['foobar', $this->output, $this->options]); |
| 136 | 136 | } |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | * @expectedException \chillerlan\QRCode\QRCodeException |
| 140 | 140 | * @expectedExceptionMessage code length overflow. (261 > 72bit) |
| 141 | 141 | */ |
| 142 | - public function testCodeLengthOverflowException(){ |
|
| 142 | + public function testCodeLengthOverflowException() { |
|
| 143 | 143 | $this->options->typeNumber = QRCode::TYPE_01; |
| 144 | 144 | $this->options->errorCorrectLevel = QRCode::ERROR_CORRECT_LEVEL_H; |
| 145 | 145 | |
@@ -13,28 +13,28 @@ discard block |
||
| 13 | 13 | use chillerlan\QRCode\QRConst; |
| 14 | 14 | use chillerlan\QRCode\Util; |
| 15 | 15 | |
| 16 | -class UtilTest extends \PHPUnit_Framework_TestCase{ |
|
| 16 | +class UtilTest extends \PHPUnit_Framework_TestCase { |
|
| 17 | 17 | |
| 18 | - public function testIsNumber(){ |
|
| 18 | + public function testIsNumber() { |
|
| 19 | 19 | $this->assertEquals(true, Util::isNumber('1234567890')); |
| 20 | 20 | $this->assertEquals(false, Util::isNumber('abc')); |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | - public function testIsAlphaNum(){ |
|
| 23 | + public function testIsAlphaNum() { |
|
| 24 | 24 | $this->assertEquals(true, Util::isAlphaNum('ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 $%*+-./:')); |
| 25 | 25 | $this->assertEquals(false, Util::isAlphaNum('#')); |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | // http://stackoverflow.com/a/24755772 |
| 29 | - public function testIsKanji(){ |
|
| 30 | - $this->assertEquals(true, Util::isKanji('茗荷')); |
|
| 29 | + public function testIsKanji() { |
|
| 30 | + $this->assertEquals(true, Util::isKanji('茗荷')); |
|
| 31 | 31 | $this->assertEquals(false, Util::isKanji('')); |
| 32 | 32 | $this->assertEquals(false, Util::isKanji('ÃÃÃ')); // non-kanji |
| 33 | 33 | $this->assertEquals(false, Util::isKanji('荷')); // kanji forced into byte mode due to length |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | // coverage |
| 37 | - public function testGetBCHTypeNumber(){ |
|
| 37 | + public function testGetBCHTypeNumber() { |
|
| 38 | 38 | $this->assertEquals(7973, Util::getBCHTypeNumber(1)); |
| 39 | 39 | } |
| 40 | 40 | |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | * @expectedException \chillerlan\QRCode\QRCodeException |
| 43 | 43 | * @expectedExceptionMessage $typeNumber: 1 / $errorCorrectLevel: 42 |
| 44 | 44 | */ |
| 45 | - public function testGetRSBlocksException(){ |
|
| 45 | + public function testGetRSBlocksException() { |
|
| 46 | 46 | Util::getRSBlocks(1, 42); |
| 47 | 47 | } |
| 48 | 48 | |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | * @expectedException \chillerlan\QRCode\QRCodeException |
| 51 | 51 | * @expectedExceptionMessage Invalid error correct level: 42 |
| 52 | 52 | */ |
| 53 | - public static function testGetMaxLengthECLevelException(){ |
|
| 53 | + public static function testGetMaxLengthECLevelException() { |
|
| 54 | 54 | Util::getMaxLength(QRCode::TYPE_01, QRConst::MODE_BYTE, 42); |
| 55 | 55 | } |
| 56 | 56 | |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | * @expectedException \chillerlan\QRCode\QRCodeException |
| 59 | 59 | * @expectedExceptionMessage Invalid mode: 1337 |
| 60 | 60 | */ |
| 61 | - public static function testGetMaxLengthModeException(){ |
|
| 61 | + public static function testGetMaxLengthModeException() { |
|
| 62 | 62 | Util::getMaxLength(QRCode::TYPE_01, 1337, QRCode::ERROR_CORRECT_LEVEL_H); |
| 63 | 63 | } |
| 64 | 64 | |