55// http://goqr.me/api/doc/create-qr-code/
66class QRServerProvider extends BaseHTTPQRCodeProvider
77{
8+ /** @var string */
89 public $ errorcorrectionlevel ;
10+
11+ /** @var int */
912 public $ margin ;
13+
14+ /** @var int */
1015 public $ qzone ;
16+
17+ /** @var string */
1118 public $ bgcolor ;
19+
20+ /** @var string */
1221 public $ color ;
22+
23+ /** @var string */
1324 public $ format ;
1425
26+ /**
27+ * @param bool $verifyssl
28+ * @param string $errorcorrectionlevel
29+ * @param int $margin
30+ * @param int $qzone
31+ * @param string $bgcolor
32+ * @param string $color
33+ * @param string $format
34+ */
1535 public function __construct ($ verifyssl = false , $ errorcorrectionlevel = 'L ' , $ margin = 4 , $ qzone = 1 , $ bgcolor = 'ffffff ' , $ color = '000000 ' , $ format = 'png ' )
1636 {
1737 if (!is_bool ($ verifyssl )) {
@@ -28,6 +48,9 @@ public function __construct($verifyssl = false, $errorcorrectionlevel = 'L', $ma
2848 $ this ->format = $ format ;
2949 }
3050
51+ /**
52+ * {@inheritdoc}
53+ */
3154 public function getMimeType ()
3255 {
3356 switch (strtolower ($ this ->format )) {
@@ -46,16 +69,30 @@ public function getMimeType()
4669 throw new QRException (sprintf ('Unknown MIME-type: %s ' , $ this ->format ));
4770 }
4871
72+ /**
73+ * {@inheritdoc}
74+ */
4975 public function getQRCodeImage ($ qrtext , $ size )
5076 {
5177 return $ this ->getContent ($ this ->getUrl ($ qrtext , $ size ));
5278 }
5379
80+ /**
81+ * @param string $value
82+ *
83+ * @return string
84+ */
5485 private function decodeColor ($ value )
5586 {
5687 return vsprintf ('%d-%d-%d ' , sscanf ($ value , "%02x%02x%02x " ));
5788 }
5889
90+ /**
91+ * @param string $qrtext the value to encode in the QR code
92+ * @param int|string $size the desired size of the QR code
93+ *
94+ * @return string file contents of the QR code
95+ */
5996 public function getUrl ($ qrtext , $ size )
6097 {
6198 return 'https://api.qrserver.com/v1/create-qr-code/ '
0 commit comments