1 | <?php |
||
20 | abstract class AmazonS3 extends Sync |
||
21 | { |
||
22 | /** |
||
23 | * AWS key |
||
24 | * |
||
25 | * @var string |
||
26 | */ |
||
27 | protected $key; |
||
28 | |||
29 | /** |
||
30 | * AWS secret |
||
31 | * |
||
32 | * @var string |
||
33 | */ |
||
34 | protected $secret; |
||
35 | |||
36 | /** |
||
37 | * AWS S3 bucket |
||
38 | * |
||
39 | * @var string |
||
40 | */ |
||
41 | protected $bucket; |
||
42 | |||
43 | /** |
||
44 | * TTL for all items in this bucket. |
||
45 | * |
||
46 | * @var int |
||
47 | */ |
||
48 | protected $bucketTTL; |
||
49 | |||
50 | /** |
||
51 | * AWS S3 region |
||
52 | * |
||
53 | * @var string |
||
54 | */ |
||
55 | protected $region; |
||
56 | |||
57 | /** |
||
58 | * AWS remote path / object key |
||
59 | * |
||
60 | * @var string |
||
61 | */ |
||
62 | protected $path; |
||
63 | |||
64 | /** |
||
65 | * AWS remote raw path / object key |
||
66 | * |
||
67 | * @var string |
||
68 | */ |
||
69 | protected $pathRaw; |
||
70 | |||
71 | /** |
||
72 | * Unix timestamp of generating path from placeholder. |
||
73 | * |
||
74 | * @var int |
||
75 | */ |
||
76 | protected $time; |
||
77 | |||
78 | /** |
||
79 | * AWS acl |
||
80 | * 'private' by default |
||
81 | * |
||
82 | * @var string |
||
83 | */ |
||
84 | protected $acl; |
||
85 | |||
86 | /** |
||
87 | * Use multi part config |
||
88 | * |
||
89 | * @var boolean |
||
90 | */ |
||
91 | protected $multiPartUpload; |
||
92 | |||
93 | /** |
||
94 | * Min multi part upload size |
||
95 | * |
||
96 | * @var int |
||
97 | */ |
||
98 | protected $minMultiPartUploadSize = 5242880; |
||
99 | |||
100 | /** |
||
101 | * Max stream upload size |
||
102 | * |
||
103 | * @var int |
||
104 | */ |
||
105 | protected $maxStreamUploadSize = 104857600; |
||
106 | |||
107 | /** |
||
108 | * Configure the sync. |
||
109 | * |
||
110 | * @see \phpbu\App\Backup\Sync::setup() |
||
111 | * @param array $config |
||
112 | * @throws \phpbu\App\Backup\Sync\Exception |
||
113 | */ |
||
114 | 9 | public function setup(array $config) |
|
134 | |||
135 | /** |
||
136 | * Simulate the sync execution. |
||
137 | * |
||
138 | * @param \phpbu\App\Backup\Target $target |
||
139 | * @param \phpbu\App\Result $result |
||
140 | */ |
||
141 | 1 | public function simulate(Target $target, Result $result) |
|
151 | |||
152 | /** |
||
153 | * Should multi part upload be used. |
||
154 | * |
||
155 | * @param \phpbu\App\Backup\Target $target |
||
156 | * @return bool |
||
157 | * @throws \phpbu\App\Exception |
||
158 | */ |
||
159 | protected function useMultiPartUpload(Target $target) |
||
167 | } |
||
168 |
Let’s assume that you have a directory layout like this:
and let’s assume the following content of
Bar.php
:If both files
OtherDir/Foo.php
andSomeDir/Foo.php
are loaded in the same runtime, you will see a PHP error such as the following:PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php
However, as
OtherDir/Foo.php
does not necessarily have to be loaded and the error is only triggered if it is loaded beforeOtherDir/Bar.php
, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias: