1 | <?php |
||
10 | class ZbarDecoder { |
||
11 | |||
12 | const EXECUTABLE = 'zbarimg'; |
||
13 | |||
14 | private $path; |
||
15 | private $file_path; |
||
16 | private $result; |
||
17 | /** |
||
18 | * @var ProcessBuilder |
||
19 | */ |
||
20 | private $processBuilder; |
||
21 | /** |
||
22 | * @var array |
||
23 | */ |
||
24 | private $config; |
||
25 | |||
26 | /** |
||
27 | * @param array $config |
||
28 | * @param ProcessBuilder $processBuilder |
||
29 | */ |
||
30 | function __construct($config = [], $processBuilder = null) |
||
38 | |||
39 | /** |
||
40 | * Main constructor - builds the process, runs it then returns the Result object |
||
41 | * @param $filename |
||
42 | * @return mixed |
||
43 | * @throws \Exception |
||
44 | */ |
||
45 | public function make($filename) |
||
52 | |||
53 | /** |
||
54 | * Returns the path to the executable zbarimg |
||
55 | * Defaults to /usr/bin |
||
56 | * @throws \Exception |
||
57 | * @return mixed |
||
58 | */ |
||
59 | public function getPath() |
||
66 | |||
67 | /** |
||
68 | * @param mixed $path |
||
69 | */ |
||
70 | public function setPath($path) |
||
74 | |||
75 | /** |
||
76 | * @return mixed |
||
77 | */ |
||
78 | public function getFilepath() |
||
82 | |||
83 | /** |
||
84 | * @param mixed $filepath |
||
85 | * @throws \Exception |
||
86 | */ |
||
87 | public function setFilepath($filepath) |
||
94 | |||
95 | /** |
||
96 | * Builds the process |
||
97 | * TODO: Configurable arguments |
||
98 | * @throws \Exception |
||
99 | */ |
||
100 | private function buildProcess() |
||
106 | |||
107 | /** |
||
108 | * Runs the process |
||
109 | * @throws \Exception |
||
110 | */ |
||
111 | private function runProcess() |
||
132 | |||
133 | /** |
||
134 | * Only return the output class to the end user |
||
135 | * @return mixed |
||
136 | */ |
||
137 | private function output() |
||
141 | |||
142 | } |
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.