Debian Codegraph @

vendor/chillerlan/php-qrcode/src/QRCodeReaderOptionsTrait.php

raw
1 <?php
2 /**
3 * QRCodeReaderOptionsTrait.php
4 *
5 * @created 01.03.2024
6 * @author smiley <[email protected]>
7 * @copyright 2024 smiley
8 * @license MIT
9 */
10 declare(strict_types=1);
11
12 namespace chillerlan\QRCode;
13
14 use function extension_loaded;
15
16 /**
17 * Trait QRCodeReaderOptionsTrait
18 *
19 * @property bool $readerUseImagickIfAvailable
20 * @property bool $readerGrayscale
21 * @property bool $readerInvertColors
22 * @property bool $readerIncreaseContrast
23 */
24 trait QRCodeReaderOptionsTrait{
25
26 /**
27 * Use Imagick (if available) when reading QR Codes
28 */
29 protected bool $readerUseImagickIfAvailable = false;
30
31 /**
32 * Grayscale the image before reading
33 */
34 protected bool $readerGrayscale = false;
35
36 /**
37 * Invert the colors of the image
38 */
39 protected bool $readerInvertColors = false;
40
41 /**
42 * Increase the contrast before reading
43 *
44 * note that applying contrast works different in GD and Imagick, so mileage may vary
45 */
46 protected bool $readerIncreaseContrast = false;
47
48 /**
49 * enables Imagick for the QR Code reader if the extension is available
50 */
51 protected function set_readerUseImagickIfAvailable(bool $useImagickIfAvailable):void{
52 $this->readerUseImagickIfAvailable = ($useImagickIfAvailable && extension_loaded('imagick'));
53 }
54
55 }