We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 5487d5a + 7cdca13 commit 56dd9b1Copy full SHA for 56dd9b1
2 files changed
doc/services/object-store/cdn.rst
@@ -71,6 +71,12 @@ Once a container has been CDN-enabled, you can retrieve it like so:
71
72
$cdnContainer = $cdnService->cdnContainer('{containerName}');
73
74
+If you already have a container object and want to avoid instantiating a new service, you can also do:
75
+
76
+.. code-block:: php
77
78
+ $cdnContainer = $container->getCdn();
79
80
81
Retrieve the SSL URL of a CDN container
82
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/OpenCloud/ObjectStore/CDNService.php
@@ -54,18 +54,19 @@ public function cdnContainer($data)
54
{
55
$container = new CDNContainer($this, $data);
56
57
- $metadata = new ContainerMetadata();
58
- $metadata->setArray(array(
59
- 'Streaming-Uri' => $data->cdn_streaming_uri,
60
- 'Ios-Uri' => $data->cdn_ios_uri,
61
- 'Ssl-Uri' => $data->cdn_ssl_uri,
62
- 'Enabled' => $data->cdn_enabled,
63
- 'Ttl' => $data->ttl,
64
- 'Log-Retention' => $data->log_retention,
65
- 'Uri' => $data->cdn_uri,
66
- ));
67
-
68
- $container->setMetadata($metadata);
+ if (is_object($data)) {
+ $metadata = new ContainerMetadata();
+ $metadata->setArray(array(
+ 'Streaming-Uri' => $data->cdn_streaming_uri,
+ 'Ios-Uri' => $data->cdn_ios_uri,
+ 'Ssl-Uri' => $data->cdn_ssl_uri,
+ 'Enabled' => $data->cdn_enabled,
+ 'Ttl' => $data->ttl,
+ 'Log-Retention' => $data->log_retention,
+ 'Uri' => $data->cdn_uri,
+ ));
+ $container->setMetadata($metadata);
69
+ }
70
return $container;
}
0 commit comments