1 | <?php |
||
14 | class Result { |
||
15 | |||
16 | const FORMAT_QR_CODE = 'QR_CODE'; |
||
17 | const FORMAT_EAN_13 = 'EAN_13'; |
||
18 | const FORMAT_CODE_39 = 'CODE_39'; |
||
19 | const FORMAT_CODE_128 = 'CODE_128'; |
||
20 | const FORMAT_INTERLEAVED_2_5 = 'INTERLEAVED_2_5'; |
||
21 | |||
22 | public $code; |
||
23 | public $text; |
||
24 | public $format; |
||
25 | |||
26 | private static $prefix = [ |
||
27 | self::FORMAT_QR_CODE => "QR-Code", |
||
28 | self::FORMAT_EAN_13 => "EAN-13", |
||
29 | self::FORMAT_CODE_39 => "CODE-39", |
||
30 | self::FORMAT_CODE_128 => "CODE-128", |
||
31 | self::FORMAT_INTERLEAVED_2_5 => "I2/5", |
||
32 | ]; |
||
33 | |||
34 | protected $parser; |
||
35 | |||
36 | /** |
||
37 | * Pass in the raw result from the process |
||
38 | * @param $result |
||
39 | * @param $parser |
||
40 | */ |
||
41 | function __construct($result, $parser = null) { |
||
51 | |||
52 | /** |
||
53 | * Will determine what type of barcode and set the correct text response |
||
54 | * @param $text |
||
55 | */ |
||
56 | public function text($text) |
||
60 | |||
61 | /** |
||
62 | * Format of the bar code |
||
63 | * @param $format |
||
64 | */ |
||
65 | public function format($format) |
||
72 | |||
73 | /** |
||
74 | * Just returns the text output |
||
75 | * @return string |
||
76 | */ |
||
77 | public function __toString() |
||
84 | |||
85 | } |
Adding explicit visibility (
private
,protected
, orpublic
) is generally recommend to communicate to other developers how, and from where this method is intended to be used.