Conditions | 5 |
Paths | 5 |
Total Lines | 22 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
77 | public function download($storePath) |
||
78 | { |
||
79 | if (file_exists($storePath) && !is_writable($storePath)) { |
||
80 | throw new EntityException('File "' . $storePath . '" is already exist!"'); |
||
81 | } |
||
82 | |||
83 | $filePath = $this->getFilePath(); |
||
84 | |||
85 | if (!$filePath) { |
||
86 | throw new EntityException('Unable to get path to file!'); |
||
87 | } |
||
88 | |||
89 | try { |
||
90 | $contents = file_get_contents($filePath); |
||
91 | |||
92 | file_put_contents($storePath, $contents); |
||
93 | } catch (\Exception $e) { |
||
94 | throw new EntityException($e->getMessage(), $e->getCode(), $e); |
||
95 | } |
||
96 | |||
97 | return is_readable($storePath); |
||
98 | } |
||
99 | } |