|
4 | 4 | * @desc Compatible to vCard 4.0 or higher. |
5 | 5 | * |
6 | 6 | * @author Pierre-Henry Soria <ph7software@gmail.com> |
7 | | - * @copyright (c) 2012-2018, Pierre-Henry Soria. All Rights Reserved. |
| 7 | + * @copyright (c) 2012-2021, Pierre-Henry Soria. All Rights Reserved. |
8 | 8 | * @license GNU General Public License <http://www.gnu.org/licenses/gpl.html> |
9 | 9 | * @version 1.2 |
10 | 10 | */ |
11 | 11 |
|
12 | 12 | class QRCode |
13 | 13 | { |
14 | 14 | const API_URL = 'https://chart.googleapis.com/chart?chs='; |
| 15 | + const DEFAULT_QR_SIZE = 150; |
15 | 16 |
|
16 | 17 | private $sData; |
17 | 18 |
|
@@ -273,7 +274,7 @@ public function bookmark($sTitle, $sUrl) |
273 | 274 | * |
274 | 275 | * @param string $sLat Latitude |
275 | 276 | * @param string $sLon Longitude |
276 | | - * @param integer $iHeight Height |
| 277 | + * @param int $iHeight Height |
277 | 278 | * |
278 | 279 | * @return self |
279 | 280 | */ |
@@ -324,24 +325,24 @@ public function finish() |
324 | 325 | /** |
325 | 326 | * Get the URL of QR Code. |
326 | 327 | * |
327 | | - * @param integer $iSize Default 150 |
| 328 | + * @param int $iSize Default 150 |
328 | 329 | * @param string $sECLevel Default L |
329 | 330 | * @param integer $iMargin Default 1 |
330 | 331 | * |
331 | 332 | * @return string The API URL configure. |
332 | 333 | */ |
333 | | - public function get($iSize = 150, $sECLevel = 'L', $iMargin = 1) |
| 334 | + public function get($iSize = self::DEFAULT_QR_SIZE, $sECLevel = 'L', $iMargin = 1) |
334 | 335 | { |
335 | 336 | return self::API_URL . $iSize . 'x' . $iSize . '&cht=qr&chld=' . $sECLevel . '|' . $iMargin . '&chl=' . $this->sData; |
336 | 337 | } |
337 | 338 |
|
338 | 339 | /** |
339 | 340 | * The HTML code for displaying the QR Code. |
340 | 341 | * |
341 | | - * @param integer $iSize Default 150 |
| 342 | + * @param int $iSize Default 150 |
342 | 343 | * @return void |
343 | 344 | */ |
344 | | - public function display( $iSize = 150) |
| 345 | + public function display($iSize = self::DEFAULT_QR_SIZE) |
345 | 346 | { |
346 | 347 | echo '<p class="center"><img src="' . $this->_cleanUrl($this->get($iSize)) . '" alt="QR Code" /></p>'; |
347 | 348 | } |
|
0 commit comments