1 | <?php |
||
13 | class ZbarDecoder |
||
14 | { |
||
15 | const EXECUTABLE = 'zbarimg'; |
||
16 | |||
17 | private $path; |
||
18 | private $filePath; |
||
19 | |||
20 | /** |
||
21 | * @var AbstractResult|ResultCollection |
||
22 | */ |
||
23 | private $result; |
||
24 | /** |
||
25 | * @var Process |
||
26 | */ |
||
27 | private $process; |
||
28 | |||
29 | /** |
||
30 | * @param array $config |
||
31 | * @param Process $process |
||
32 | * @throws \Exception |
||
33 | */ |
||
34 | public function __construct(array $config = [], Process $process = null) |
||
41 | |||
42 | /** |
||
43 | * Main constructor - builds the process, runs it then returns the Result object |
||
44 | * |
||
45 | * @param $filename |
||
46 | * |
||
47 | * @return AbstractResult|ResultCollection |
||
48 | * @throws \Exception |
||
49 | */ |
||
50 | public function make($filename) |
||
58 | |||
59 | /** |
||
60 | * Returns the path to the executable zbarimg |
||
61 | * Defaults to /usr/bin |
||
62 | * |
||
63 | * @throws \Exception |
||
64 | * @return mixed |
||
65 | */ |
||
66 | public function getPath() |
||
74 | |||
75 | /** |
||
76 | * @param mixed $path |
||
77 | */ |
||
78 | public function setPath($path) |
||
82 | |||
83 | /** |
||
84 | * @return mixed |
||
85 | */ |
||
86 | public function getFilePath() |
||
90 | |||
91 | /** |
||
92 | * @param mixed $filePath |
||
93 | * |
||
94 | * @throws \Exception |
||
95 | */ |
||
96 | public function setFilePath($filePath) |
||
103 | |||
104 | /** |
||
105 | * Builds the process |
||
106 | * TODO: Configurable arguments |
||
107 | * |
||
108 | * @throws \Exception |
||
109 | */ |
||
110 | private function buildProcess() |
||
122 | |||
123 | /** |
||
124 | * Runs the process |
||
125 | * |
||
126 | * @throws \RuntimeException |
||
127 | */ |
||
128 | private function runProcess() |
||
154 | |||
155 | /** |
||
156 | * Only return the output class to the end user |
||
157 | * |
||
158 | * @return AbstractResult|ResultCollection |
||
159 | */ |
||
160 | private function output() |
||
164 | } |
||
165 |