| Total Complexity | 3 |
| Total Lines | 30 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 22 | trait BinaryPathAwareTrait |
||
| 23 | { |
||
| 24 | /** |
||
| 25 | * @var string PDF tool binary including full path |
||
| 26 | */ |
||
| 27 | private $binaryPath; |
||
| 28 | |||
| 29 | /** |
||
| 30 | * Set PDF tool binary to use. |
||
| 31 | * |
||
| 32 | * @throws FileNotFoundException |
||
| 33 | */ |
||
| 34 | public function setBinary(string $binaryPath): self |
||
| 35 | { |
||
| 36 | $fileChecker = new FileChecker(); |
||
| 37 | $fileChecker->checkFileExists($binaryPath, 'Binary "%s" not found!'); |
||
| 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 |