Total Complexity | 9 |
Total Lines | 50 |
Duplicated Lines | 0 % |
Coverage | 90.91% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
12 | class blob |
||
13 | { |
||
14 | public $parentguid; |
||
15 | |||
16 | public $content; |
||
17 | |||
18 | protected $attachment; |
||
19 | |||
20 | 9 | public function __construct(attachment $attachment, string $encoding = 'UTF-8') |
|
23 | } |
||
24 | |||
25 | 5 | public function read_content() : ?string |
|
26 | { |
||
27 | 5 | if ($this->exists()) { |
|
28 | 5 | return file_get_contents($this->get_path()); |
|
29 | } |
||
30 | 2 | return null; |
|
31 | } |
||
32 | |||
33 | 4 | public function write_content($content) : bool |
|
34 | { |
||
35 | 4 | return file_put_contents($this->get_path(), $content) !== false; |
|
36 | } |
||
37 | |||
38 | public function remove_file() |
||
39 | { |
||
40 | } |
||
41 | |||
42 | 3 | public function get_handler(string $mode = 'w') |
|
45 | } |
||
46 | |||
47 | 8 | public function get_path() : string |
|
48 | { |
||
49 | 8 | if (empty($this->attachment->location)) { |
|
50 | 7 | $location = connection::generate_guid(); |
|
51 | 7 | $subdir1 = strtoupper($location[0]); |
|
52 | 7 | $subdir2 = strtoupper($location[1]); |
|
53 | 7 | $this->attachment->location = $subdir1 . DIRECTORY_SEPARATOR . $subdir2 . DIRECTORY_SEPARATOR . $location; |
|
54 | } |
||
55 | 8 | $blobdir = midgard_connection::get_instance()->config->blobdir; |
|
56 | 8 | return $blobdir . DIRECTORY_SEPARATOR . $this->attachment->location; |
|
57 | } |
||
58 | |||
59 | 6 | public function exists() : bool |
|
62 | } |
||
63 | } |
||
64 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.