1 | <?php |
||
9 | class CloudAssets extends SS_Object |
||
10 | { |
||
11 | /** @var bool - kill switch via config - if true the module will ignore all cloud buckets */ |
||
12 | private static $disabled = false; |
||
13 | |||
14 | /** @var bool - kill switch for uploading local changes to the cdn - useful for safeguarding local development environments */ |
||
15 | private static $uploads_disabled = false; |
||
16 | |||
17 | /** @var bool - if this is set to true, the uploads will only occur when running UpdateCloudAssetsTask or CloudAssetsFullCheckTask */ |
||
18 | // COMING SOON |
||
19 | //private static $offline_uploads_only = false; |
||
20 | |||
21 | /** @var bool - you probably want this true overall, but in some cases like BuildTasks we may not want that */ |
||
22 | // COMING SOON |
||
23 | //private static $fail_silently = true; |
||
24 | |||
25 | /** @var string - if you have Monolog or something registered with the Injector - anything with info, error, and debug methods */ |
||
26 | private static $logger = ''; |
||
27 | |||
28 | /** @var array */ |
||
29 | private static $map = array( |
||
30 | //'assets/folder/path' => array( |
||
31 | // 'Type' => 'RackspaceBucket', |
||
32 | // 'BaseURL' => 'http://cdnurl.com/', |
||
33 | // 'SecureURL' => 'https://cdnurl.com/', |
||
34 | // 'Container' => 'container-name', |
||
35 | // 'UserID' => 'username', |
||
36 | // 'ApiKey' => 'key', |
||
37 | // 'LocalCopy' => true, |
||
38 | //); |
||
39 | ); |
||
40 | |||
41 | /** @var array - merged in with all bucket configs */ |
||
42 | private static $defaults = array(); |
||
43 | |||
44 | /** @var array - add to this if you have other file subclasses floating around */ |
||
45 | private static $wrappers = array( |
||
46 | 'File' => 'CloudFile', |
||
47 | 'Image' => 'CloudImage', |
||
48 | 'CloudImageCached' => 'CloudImageCached', // this is awkward but prevents it from trying to transform Image_Cached |
||
49 | ); |
||
50 | |||
51 | /** @var string - placeholder string used for local files */ |
||
52 | private static $file_placeholder = 'CloudFile'; |
||
53 | |||
54 | /** @var string - if an image is missing on the remote (usually when creating a thumbnail) use this instead */ |
||
55 | private static $missing_image = 'cloudassets/images/missing.svg'; |
||
56 | |||
57 | /** @var array - only keep one instance of each bucket */ |
||
58 | protected $bucketCache = array(); |
||
59 | |||
60 | |||
61 | /** |
||
62 | * @return CloudAssets |
||
63 | */ |
||
64 | public static function inst() |
||
68 | |||
69 | |||
70 | /** |
||
71 | * @param string|File $filename |
||
72 | * @return CloudBucket |
||
73 | */ |
||
74 | public function map($filename) |
||
109 | |||
110 | |||
111 | /** |
||
112 | * Updates the cloud status of all files (used in tests and cron job) |
||
113 | */ |
||
114 | public function updateAllFiles() |
||
120 | |||
121 | |||
122 | /** |
||
123 | * @param string $className |
||
124 | * @return string |
||
125 | */ |
||
126 | public function getWrapperClass($className) |
||
140 | |||
141 | |||
142 | /** |
||
143 | * Wipes out any buckets we've saved |
||
144 | */ |
||
145 | public function clearBucketCache() |
||
149 | |||
150 | |||
151 | /** |
||
152 | * @return object |
||
153 | */ |
||
154 | public function getLogger() |
||
164 | } |
||
165 | |||
185 |
There are different options of fixing this problem.
If you want to be on the safe side, you can add an additional type-check:
If you are sure that the expression is traversable, you might want to add a doc comment cast to improve IDE auto-completion and static analysis:
Mark the issue as a false-positive: Just hover the remove button, in the top-right corner of this issue for more options.