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 ProcessBuilder |
||
26 | */ |
||
27 | private $processBuilder; |
||
28 | |||
29 | /** |
||
30 | * @param array $config |
||
31 | * @param ProcessBuilder $processBuilder |
||
32 | */ |
||
33 | public function __construct(array $config = [], $processBuilder = null) |
||
40 | |||
41 | /** |
||
42 | * Main constructor - builds the process, runs it then returns the Result object |
||
43 | * |
||
44 | * @param $filename |
||
45 | * |
||
46 | * @return AbstractResult |
||
47 | * @throws \Exception |
||
48 | */ |
||
49 | public function make($filename) |
||
57 | |||
58 | /** |
||
59 | * Returns the path to the executable zbarimg |
||
60 | * Defaults to /usr/bin |
||
61 | * |
||
62 | * @throws \Exception |
||
63 | * @return mixed |
||
64 | */ |
||
65 | public function getPath() |
||
73 | |||
74 | /** |
||
75 | * @param mixed $path |
||
76 | */ |
||
77 | public function setPath($path) |
||
81 | |||
82 | /** |
||
83 | * @return mixed |
||
84 | */ |
||
85 | public function getFilePath() |
||
89 | |||
90 | /** |
||
91 | * @param mixed $filePath |
||
92 | * |
||
93 | * @throws \Exception |
||
94 | */ |
||
95 | public function setFilePath($filePath) |
||
102 | |||
103 | /** |
||
104 | * Builds the process |
||
105 | * TODO: Configurable arguments |
||
106 | * |
||
107 | * @throws \Exception |
||
108 | */ |
||
109 | private function buildProcess() |
||
115 | |||
116 | /** |
||
117 | * Runs the process |
||
118 | * |
||
119 | * @throws \Exception |
||
120 | */ |
||
121 | private function runProcess() |
||
147 | |||
148 | /** |
||
149 | * Only return the output class to the end user |
||
150 | * |
||
151 | * @return AbstractResult|ResultCollection |
||
152 | */ |
||
153 | private function output() |
||
157 | } |
||
158 |