| Total Complexity | 4 |
| Total Lines | 31 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 21 | trait BinaryPathAwareTrait |
||
| 22 | { |
||
| 23 | /** |
||
| 24 | * @var string PDF tool binary including full path |
||
| 25 | */ |
||
| 26 | private $binaryPath; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * Set PDF tool binary to use. |
||
| 30 | * |
||
| 31 | * @throws FileNotFoundException |
||
| 32 | */ |
||
| 33 | public function setBinary(string $binaryPath): self |
||
| 34 | { |
||
| 35 | if (!file_exists($binaryPath)) { |
||
| 36 | throw new FileNotFoundException(sprintf('Binary "%s" not found', $binaryPath)); |
||
| 37 | } |
||
| 38 | |||
| 39 | $this->binaryPath = $binaryPath; |
||
| 40 | |||
| 41 | return $this; |
||
| 42 | } |
||
| 43 | |||
| 44 | /** |
||
| 45 | * Get currently used PDF tool binary. |
||
| 46 | * |
||
| 47 | * @param bool $escaped Whether the binary path should be shell escaped |
||
| 48 | */ |
||
| 49 | public function getBinary(bool $escaped = true): string |
||
| 52 | } |
||
| 53 | } |
||
| 54 |