QROutputInterface.php 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. <?php
  2. /**
  3. * Interface QROutputInterface,
  4. *
  5. * @created 02.12.2015
  6. * @author Smiley <smiley@chillerlan.net>
  7. * @copyright 2015 Smiley
  8. * @license MIT
  9. */
  10. namespace chillerlan\QRCode\Output;
  11. use chillerlan\QRCode\Data\QRMatrix;
  12. /**
  13. * Converts the data matrix into readable output
  14. */
  15. interface QROutputInterface{
  16. /**
  17. * @var string
  18. * @deprecated 5.0.0 <no replacement>
  19. * @see https://github.com/chillerlan/php-qrcode/issues/223
  20. */
  21. public const MARKUP_HTML = 'html';
  22. /**
  23. * @var string
  24. * @deprecated 5.0.0 <no replacement>
  25. * @see https://github.com/chillerlan/php-qrcode/issues/223
  26. */
  27. public const MARKUP_SVG = 'svg';
  28. /**
  29. * @var string
  30. * @deprecated 5.0.0 <no replacement>
  31. * @see https://github.com/chillerlan/php-qrcode/issues/223
  32. */
  33. public const GDIMAGE_BMP = 'bmp';
  34. /**
  35. * @var string
  36. * @deprecated 5.0.0 <no replacement>
  37. * @see https://github.com/chillerlan/php-qrcode/issues/223
  38. */
  39. public const GDIMAGE_GIF = 'gif';
  40. /**
  41. * @var string
  42. * @deprecated 5.0.0 <no replacement>
  43. * @see https://github.com/chillerlan/php-qrcode/issues/223
  44. */
  45. public const GDIMAGE_JPG = 'jpg';
  46. /**
  47. * @var string
  48. * @deprecated 5.0.0 <no replacement>
  49. * @see https://github.com/chillerlan/php-qrcode/issues/223
  50. */
  51. public const GDIMAGE_PNG = 'png';
  52. /**
  53. * @var string
  54. * @deprecated 5.0.0 <no replacement>
  55. * @see https://github.com/chillerlan/php-qrcode/issues/223
  56. */
  57. public const GDIMAGE_WEBP = 'webp';
  58. /**
  59. * @var string
  60. * @deprecated 5.0.0 <no replacement>
  61. * @see https://github.com/chillerlan/php-qrcode/issues/223
  62. */
  63. public const STRING_JSON = 'json';
  64. /**
  65. * @var string
  66. * @deprecated 5.0.0 <no replacement>
  67. * @see https://github.com/chillerlan/php-qrcode/issues/223
  68. */
  69. public const STRING_TEXT = 'text';
  70. /**
  71. * @var string
  72. * @deprecated 5.0.0 <no replacement>
  73. * @see https://github.com/chillerlan/php-qrcode/issues/223
  74. */
  75. public const IMAGICK = 'imagick';
  76. /**
  77. * @var string
  78. * @deprecated 5.0.0 <no replacement>
  79. * @see https://github.com/chillerlan/php-qrcode/issues/223
  80. */
  81. public const FPDF = 'fpdf';
  82. /**
  83. * @var string
  84. * @deprecated 5.0.0 <no replacement>
  85. * @see https://github.com/chillerlan/php-qrcode/issues/223
  86. */
  87. public const EPS = 'eps';
  88. /**
  89. * @var string
  90. * @deprecated 5.0.0 <no replacement>
  91. * @see https://github.com/chillerlan/php-qrcode/issues/223
  92. */
  93. public const CUSTOM = 'custom';
  94. /**
  95. * Map of built-in output modes => class FQN
  96. *
  97. * @var string[]
  98. * @deprecated 5.0.0 <no replacement>
  99. * @see https://github.com/chillerlan/php-qrcode/issues/223
  100. */
  101. public const MODES = [
  102. self::MARKUP_SVG => QRMarkupSVG::class,
  103. self::MARKUP_HTML => QRMarkupHTML::class,
  104. self::GDIMAGE_BMP => QRGdImageBMP::class,
  105. self::GDIMAGE_GIF => QRGdImageGIF::class,
  106. self::GDIMAGE_JPG => QRGdImageJPEG::class,
  107. self::GDIMAGE_PNG => QRGdImagePNG::class,
  108. self::GDIMAGE_WEBP => QRGdImageWEBP::class,
  109. self::STRING_JSON => QRStringJSON::class,
  110. self::STRING_TEXT => QRStringText::class,
  111. self::IMAGICK => QRImagick::class,
  112. self::FPDF => QRFpdf::class,
  113. self::EPS => QREps::class,
  114. ];
  115. /**
  116. * Map of module type => default value
  117. *
  118. * @var bool[]
  119. */
  120. public const DEFAULT_MODULE_VALUES = [
  121. // light
  122. QRMatrix::M_NULL => false,
  123. QRMatrix::M_DARKMODULE_LIGHT => false,
  124. QRMatrix::M_DATA => false,
  125. QRMatrix::M_FINDER => false,
  126. QRMatrix::M_SEPARATOR => false,
  127. QRMatrix::M_ALIGNMENT => false,
  128. QRMatrix::M_TIMING => false,
  129. QRMatrix::M_FORMAT => false,
  130. QRMatrix::M_VERSION => false,
  131. QRMatrix::M_QUIETZONE => false,
  132. QRMatrix::M_LOGO => false,
  133. QRMatrix::M_FINDER_DOT_LIGHT => false,
  134. // dark
  135. QRMatrix::M_DARKMODULE => true,
  136. QRMatrix::M_DATA_DARK => true,
  137. QRMatrix::M_FINDER_DARK => true,
  138. QRMatrix::M_SEPARATOR_DARK => true,
  139. QRMatrix::M_ALIGNMENT_DARK => true,
  140. QRMatrix::M_TIMING_DARK => true,
  141. QRMatrix::M_FORMAT_DARK => true,
  142. QRMatrix::M_VERSION_DARK => true,
  143. QRMatrix::M_QUIETZONE_DARK => true,
  144. QRMatrix::M_LOGO_DARK => true,
  145. QRMatrix::M_FINDER_DOT => true,
  146. ];
  147. /**
  148. * Map of module type => readable name (for CSS etc.)
  149. *
  150. * @var string[]
  151. */
  152. public const LAYERNAMES = [
  153. // light
  154. QRMatrix::M_NULL => 'null',
  155. QRMatrix::M_DARKMODULE_LIGHT => 'darkmodule-light',
  156. QRMatrix::M_DATA => 'data',
  157. QRMatrix::M_FINDER => 'finder',
  158. QRMatrix::M_SEPARATOR => 'separator',
  159. QRMatrix::M_ALIGNMENT => 'alignment',
  160. QRMatrix::M_TIMING => 'timing',
  161. QRMatrix::M_FORMAT => 'format',
  162. QRMatrix::M_VERSION => 'version',
  163. QRMatrix::M_QUIETZONE => 'quietzone',
  164. QRMatrix::M_LOGO => 'logo',
  165. QRMatrix::M_FINDER_DOT_LIGHT => 'finder-dot-light',
  166. // dark
  167. QRMatrix::M_DARKMODULE => 'darkmodule',
  168. QRMatrix::M_DATA_DARK => 'data-dark',
  169. QRMatrix::M_FINDER_DARK => 'finder-dark',
  170. QRMatrix::M_SEPARATOR_DARK => 'separator-dark',
  171. QRMatrix::M_ALIGNMENT_DARK => 'alignment-dark',
  172. QRMatrix::M_TIMING_DARK => 'timing-dark',
  173. QRMatrix::M_FORMAT_DARK => 'format-dark',
  174. QRMatrix::M_VERSION_DARK => 'version-dark',
  175. QRMatrix::M_QUIETZONE_DARK => 'quietzone-dark',
  176. QRMatrix::M_LOGO_DARK => 'logo-dark',
  177. QRMatrix::M_FINDER_DOT => 'finder-dot',
  178. ];
  179. /**
  180. * @var string
  181. * @see \chillerlan\QRCode\Output\QROutputAbstract::toBase64DataURI()
  182. * @internal do not call this constant from the interface, but rather from one of the child classes
  183. */
  184. public const MIME_TYPE = '';
  185. /**
  186. * Determines whether the given value is valid
  187. *
  188. * @param mixed $value
  189. */
  190. public static function moduleValueIsValid($value):bool;
  191. /**
  192. * Generates the output, optionally dumps it to a file, and returns it
  193. *
  194. * please note that the value of QROptions::$cachefile is already evaluated at this point.
  195. * if the output module is invoked manually, it has no effect at all.
  196. * you need to supply the $file parameter here in that case (or handle the option value in your custom output module).
  197. *
  198. * @see \chillerlan\QRCode\QRCode::renderMatrix()
  199. *
  200. * @return mixed
  201. */
  202. public function dump(?string $file = null);
  203. }