Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
Complex classes like BlobRestProxy often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use BlobRestProxy, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
95 | class BlobRestProxy extends ServiceRestProxy implements IBlob |
||
96 | { |
||
97 | use ServiceRestTrait; |
||
98 | |||
99 | private $_SingleBlobUploadThresholdInBytes = Resources::MB_IN_BYTES_32; |
||
100 | |||
101 | /** |
||
102 | * Get the value for SingleBlobUploadThresholdInBytes |
||
103 | * |
||
104 | * @return int |
||
105 | */ |
||
106 | public function getSingleBlobUploadThresholdInBytes() |
||
107 | { |
||
108 | return $this->_SingleBlobUploadThresholdInBytes; |
||
109 | } |
||
110 | |||
111 | /** |
||
112 | * Set the value for SingleBlobUploadThresholdInBytes, Max 64MB |
||
113 | * |
||
114 | * @param int $val The max size to send as a single blob block |
||
115 | * |
||
116 | * @return void |
||
117 | */ |
||
118 | public function setSingleBlobUploadThresholdInBytes($val) |
||
119 | { |
||
120 | if ($val > Resources::MB_IN_BYTES_64) { |
||
121 | // What should the proper action here be? |
||
122 | $val = Resources::MB_IN_BYTES_64; |
||
123 | } elseif ($val < 1) { |
||
124 | // another spot that could use looking at |
||
125 | $val = Resources::MB_IN_BYTES_32; |
||
126 | } |
||
127 | $this->_SingleBlobUploadThresholdInBytes = $val; |
||
128 | } |
||
129 | |||
130 | /** |
||
131 | * Gets the copy blob source name with specified parameters. |
||
132 | * |
||
133 | * @param string $containerName The name of the container. |
||
134 | * @param string $blobName The name of the blob. |
||
135 | * @param Models\CopyBlobOptions $options The optional parameters. |
||
136 | * |
||
137 | * @return string |
||
138 | */ |
||
139 | private function _getCopyBlobSourceName( |
||
140 | $containerName, |
||
141 | $blobName, |
||
142 | Models\CopyBlobOptions $options |
||
143 | ) { |
||
144 | $sourceName = $this->_getBlobUrl($containerName, $blobName); |
||
145 | |||
146 | if (!is_null($options->getSourceSnapshot())) { |
||
147 | $sourceName .= '?snapshot=' . $options->getSourceSnapshot(); |
||
148 | } |
||
149 | |||
150 | return $sourceName; |
||
151 | } |
||
152 | |||
153 | /** |
||
154 | * Creates URI path for blob or container. |
||
155 | * |
||
156 | * @param string $container The container name. |
||
157 | * @param string $blob The blob name. |
||
158 | * |
||
159 | * @return string |
||
160 | */ |
||
161 | View Code Duplication | private function _createPath($container, $blob = '') |
|
|
|||
162 | { |
||
163 | if (empty($blob)) { |
||
164 | if (!empty($container)) { |
||
165 | return $container; |
||
166 | } else { |
||
167 | return '/' . $container; |
||
168 | } |
||
169 | } else { |
||
170 | $encodedBlob = urlencode($blob); |
||
171 | // Unencode the forward slashes to match what the server expects. |
||
172 | $encodedBlob = str_replace('%2F', '/', $encodedBlob); |
||
173 | // Unencode the backward slashes to match what the server expects. |
||
174 | $encodedBlob = str_replace('%5C', '/', $encodedBlob); |
||
175 | // Re-encode the spaces (encoded as space) to the % encoding. |
||
176 | $encodedBlob = str_replace('+', '%20', $encodedBlob); |
||
177 | // Empty container means accessing default container |
||
178 | if (empty($container)) { |
||
179 | return $encodedBlob; |
||
180 | } else { |
||
181 | return '/' . $container . '/' . $encodedBlob; |
||
182 | } |
||
183 | } |
||
184 | } |
||
185 | |||
186 | /** |
||
187 | * Creates full URI to the given blob. |
||
188 | * |
||
189 | * @param string $container The container name. |
||
190 | * @param string $blob The blob name. |
||
191 | * |
||
192 | * @return string |
||
193 | */ |
||
194 | private function _getBlobUrl($container, $blob) |
||
195 | { |
||
196 | $encodedBlob = $this->_createPath($container, $blob); |
||
197 | |||
198 | return (string)($this->getPsrPrimaryUri()->withPath($encodedBlob)); |
||
199 | } |
||
200 | |||
201 | /** |
||
202 | * Helper method to create promise for getContainerProperties API call. |
||
203 | * |
||
204 | * @param string $container The container name. |
||
205 | * @param Models\BlobServiceOptions $options The optional parameters. |
||
206 | * @param string $operation The operation string. Should be |
||
207 | * 'metadata' to get metadata. |
||
208 | * |
||
209 | * @return \GuzzleHttp\Promise\PromiseInterface |
||
210 | */ |
||
211 | private function _getContainerPropertiesAsyncImpl( |
||
263 | |||
264 | /** |
||
265 | * Adds optional create blob headers. |
||
266 | * |
||
267 | * @param CreateBlobOptions $options The optional parameters. |
||
268 | * @param array $headers The HTTP request headers. |
||
269 | * |
||
270 | * @return array |
||
271 | */ |
||
272 | private function _addCreateBlobOptionalHeaders( |
||
273 | CreateBlobOptions $options, |
||
274 | array $headers |
||
275 | ) { |
||
276 | $headers = $this->addOptionalAccessConditionHeader( |
||
277 | $headers, |
||
278 | $options->getAccessConditions() |
||
279 | ); |
||
280 | |||
281 | $this->addOptionalHeader( |
||
282 | $headers, |
||
283 | Resources::X_MS_LEASE_ID, |
||
284 | $options->getLeaseId() |
||
285 | ); |
||
286 | |||
287 | $headers = $this->addMetadataHeaders( |
||
288 | $headers, |
||
289 | $options->getMetadata() |
||
290 | ); |
||
291 | |||
292 | $contentType = $options->getContentType(); |
||
293 | if (is_null($contentType)) { |
||
294 | $contentType = Resources::BINARY_FILE_TYPE; |
||
295 | } |
||
296 | |||
297 | $this->addOptionalHeader( |
||
298 | $headers, |
||
299 | Resources::X_MS_BLOB_CONTENT_TYPE, |
||
300 | $contentType |
||
301 | ); |
||
302 | $this->addOptionalHeader( |
||
303 | $headers, |
||
304 | Resources::X_MS_BLOB_CONTENT_ENCODING, |
||
305 | $options->getContentEncoding() |
||
306 | ); |
||
307 | $this->addOptionalHeader( |
||
308 | $headers, |
||
309 | Resources::X_MS_BLOB_CONTENT_LANGUAGE, |
||
310 | $options->getContentLanguage() |
||
311 | ); |
||
312 | $this->addOptionalHeader( |
||
313 | $headers, |
||
314 | Resources::X_MS_BLOB_CONTENT_MD5, |
||
315 | $options->getContentMD5() |
||
316 | ); |
||
317 | $this->addOptionalHeader( |
||
318 | $headers, |
||
319 | Resources::X_MS_BLOB_CACHE_CONTROL, |
||
320 | $options->getCacheControl() |
||
321 | ); |
||
322 | $this->addOptionalHeader( |
||
323 | $headers, |
||
324 | Resources::X_MS_BLOB_CONTENT_DISPOSITION, |
||
325 | $options->getContentDisposition() |
||
326 | ); |
||
327 | $this->addOptionalHeader( |
||
328 | $headers, |
||
329 | Resources::CONTENT_TYPE, |
||
330 | Resources::URL_ENCODED_CONTENT_TYPE |
||
331 | ); |
||
332 | |||
333 | return $headers; |
||
334 | } |
||
335 | |||
336 | /** |
||
337 | * Adds Range header to the headers array. |
||
338 | * |
||
339 | * @param array $headers The HTTP request headers. |
||
340 | * @param integer $start The start byte. |
||
341 | * @param integer $end The end byte. |
||
342 | * |
||
343 | * @return array |
||
344 | */ |
||
345 | private function _addOptionalRangeHeader(array $headers, $start, $end) |
||
346 | { |
||
347 | if (!is_null($start) || !is_null($end)) { |
||
348 | $range = $start . '-' . $end; |
||
349 | $rangeValue = 'bytes=' . $range; |
||
350 | $this->addOptionalHeader($headers, Resources::RANGE, $rangeValue); |
||
351 | } |
||
352 | |||
353 | return $headers; |
||
354 | } |
||
355 | |||
356 | /** |
||
357 | * Get the expected status code of a given lease action. |
||
358 | * |
||
359 | * @param string $leaseAction The given lease action |
||
360 | * |
||
361 | * @return string |
||
362 | */ |
||
363 | private static function getStatusCodeOfLeaseAction($leaseAction) |
||
385 | |||
386 | /** |
||
387 | * Creates promise that does the actual work for leasing a blob. |
||
388 | * |
||
389 | * @param string $leaseAction Lease action string. |
||
390 | * @param string $container Container name. |
||
391 | * @param string $blob Blob to lease name. |
||
392 | * @param string $leaseId Existing lease id. |
||
393 | * @param string $expectedStatusCode Expected status code. |
||
394 | * @param Models\BlobServiceOptions $options Optional parameters. |
||
395 | * @param Models\AccessCondition $accessCondition Access conditions. |
||
396 | * |
||
397 | * @return \GuzzleHttp\Promise\PromiseInterface |
||
398 | */ |
||
399 | private function _putLeaseAsyncImpl( |
||
478 | |||
479 | /** |
||
480 | * Creates promise that does actual work for create and clear blob pages. |
||
481 | * |
||
482 | * @param string $action Either clear or create. |
||
483 | * @param string $container The container name. |
||
484 | * @param string $blob The blob name. |
||
485 | * @param Range $range The page ranges. |
||
486 | * @param string $content The content string. |
||
487 | * @param CreateBlobPagesOptions $options The optional parameters. |
||
488 | * |
||
489 | * @return \GuzzleHttp\Promise\PromiseInterface |
||
490 | */ |
||
491 | private function _updatePageBlobPagesAsyncImpl( |
||
573 | |||
574 | /** |
||
575 | * Lists all of the containers in the given storage account. |
||
576 | * |
||
577 | * @param ListContainersOptions $options The optional parameters. |
||
578 | * |
||
579 | * @return ListContainersResult |
||
580 | * |
||
581 | * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179352.aspx |
||
582 | */ |
||
583 | public function listContainers(ListContainersOptions $options = null) |
||
584 | { |
||
585 | return $this->listContainersAsync($options)->wait(); |
||
586 | } |
||
587 | |||
588 | /** |
||
589 | * Create a promise for lists all of the containers in the given |
||
590 | * storage account. |
||
591 | * |
||
592 | * @param ListContainersOptions $options The optional parameters. |
||
593 | * |
||
594 | * @return \GuzzleHttp\Promise\PromiseInterface |
||
595 | */ |
||
596 | public function listContainersAsync( |
||
656 | |||
657 | /** |
||
658 | * Creates a new container in the given storage account. |
||
659 | * |
||
660 | * @param string $container The container name. |
||
661 | * @param Models\CreateContainerOptions $options The optional parameters. |
||
662 | * |
||
663 | * @return void |
||
664 | * |
||
665 | * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179468.aspx |
||
666 | */ |
||
667 | public function createContainer( |
||
668 | $container, |
||
669 | Models\CreateContainerOptions $options = null |
||
670 | ) { |
||
671 | $this->createContainerAsync($container, $options)->wait(); |
||
672 | } |
||
673 | |||
674 | /** |
||
675 | * Creates a new container in the given storage account. |
||
676 | * |
||
677 | * @param string $container The container name. |
||
678 | * @param Models\CreateContainerOptions $options The optional parameters. |
||
679 | * |
||
680 | * @return \GuzzleHttp\Promise\PromiseInterface |
||
681 | * |
||
682 | * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179468.aspx |
||
683 | */ |
||
684 | public function createContainerAsync( |
||
722 | |||
723 | /** |
||
724 | * Deletes a container in the given storage account. |
||
725 | * |
||
726 | * @param string $container The container name. |
||
727 | * @param Models\BlobServiceOptions $options The optional parameters. |
||
728 | * |
||
729 | * @return void |
||
730 | * |
||
731 | * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179408.aspx |
||
732 | */ |
||
733 | public function deleteContainer( |
||
734 | $container, |
||
735 | Models\BlobServiceOptions $options = null |
||
736 | ) { |
||
737 | $this->deleteContainerAsync($container, $options)->wait(); |
||
738 | } |
||
739 | |||
740 | /** |
||
741 | * Create a promise for deleting a container. |
||
742 | * |
||
743 | * @param string $container name of the container |
||
744 | * @param Models\BlobServiceOptions|null $options optional parameters |
||
745 | * |
||
746 | * @return \GuzzleHttp\Promise\PromiseInterface |
||
747 | */ |
||
748 | public function deleteContainerAsync( |
||
794 | |||
795 | /** |
||
796 | * Returns all properties and metadata on the container. |
||
797 | * |
||
798 | * @param string $container name |
||
799 | * @param Models\BlobServiceOptions $options optional parameters |
||
800 | * |
||
801 | * @return Models\GetContainerPropertiesResult |
||
802 | * |
||
803 | * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179370.aspx |
||
804 | */ |
||
805 | public function getContainerProperties( |
||
806 | $container, |
||
807 | Models\BlobServiceOptions $options = null |
||
808 | ) { |
||
809 | return $this->getContainerPropertiesAsync($container, $options)->wait(); |
||
810 | } |
||
811 | |||
812 | /** |
||
813 | * Create promise to return all properties and metadata on the container. |
||
814 | * |
||
815 | * @param string $container name |
||
816 | * @param Models\BlobServiceOptions $options optional parameters |
||
817 | * |
||
818 | * @return \GuzzleHttp\Promise\PromiseInterface |
||
819 | * |
||
820 | * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179370.aspx |
||
821 | */ |
||
822 | public function getContainerPropertiesAsync( |
||
828 | |||
829 | /** |
||
830 | * Returns only user-defined metadata for the specified container. |
||
831 | * |
||
832 | * @param string $container name |
||
833 | * @param Models\BlobServiceOptions $options optional parameters |
||
834 | * |
||
835 | * @return Models\GetContainerPropertiesResult |
||
836 | * |
||
837 | * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee691976.aspx |
||
838 | */ |
||
839 | public function getContainerMetadata( |
||
840 | $container, |
||
841 | Models\BlobServiceOptions $options = null |
||
842 | ) { |
||
843 | return $this->getContainerMetadataAsync($container, $options)->wait(); |
||
844 | } |
||
845 | |||
846 | /** |
||
847 | * Create promise to return only user-defined metadata for the specified |
||
848 | * container. |
||
849 | * |
||
850 | * @param string $container name |
||
851 | * @param Models\BlobServiceOptions $options optional parameters |
||
852 | * |
||
853 | * @return \GuzzleHttp\Promise\PromiseInterface |
||
854 | * |
||
855 | * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee691976.aspx |
||
856 | */ |
||
857 | public function getContainerMetadataAsync( |
||
863 | |||
864 | /** |
||
865 | * Gets the access control list (ACL) and any container-level access policies |
||
866 | * for the container. |
||
867 | * |
||
868 | * @param string $container The container name. |
||
869 | * @param Models\BlobServiceOptions $options The optional parameters. |
||
870 | * |
||
871 | * @return Models\GetContainerACLResult |
||
872 | * |
||
873 | * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179469.aspx |
||
874 | */ |
||
875 | public function getContainerAcl( |
||
876 | $container, |
||
877 | Models\BlobServiceOptions $options = null |
||
878 | ) { |
||
879 | return $this->getContainerAclAsync($container, $options)->wait(); |
||
880 | } |
||
881 | |||
882 | /** |
||
883 | * Creates the promise to get the access control list (ACL) and any |
||
884 | * container-level access policies for the container. |
||
885 | * |
||
886 | * @param string $container The container name. |
||
887 | * @param Models\BlobServiceOptions $options The optional parameters. |
||
888 | * |
||
889 | * @return \GuzzleHttp\Promise\PromiseInterface |
||
890 | * |
||
891 | * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179469.aspx |
||
892 | */ |
||
893 | public function getContainerAclAsync( |
||
967 | |||
968 | /** |
||
969 | * Sets the ACL and any container-level access policies for the container. |
||
970 | * |
||
971 | * @param string $container name |
||
972 | * @param Models\ContainerACL $acl access control list for container |
||
973 | * @param Models\BlobServiceOptions $options optional parameters |
||
974 | * |
||
975 | * @return void |
||
976 | * |
||
977 | * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179391.aspx |
||
978 | */ |
||
979 | public function setContainerAcl( |
||
980 | $container, |
||
981 | Models\ContainerACL $acl, |
||
982 | Models\BlobServiceOptions $options = null |
||
983 | ) { |
||
984 | $this->setContainerAclAsync($container, $acl, $options)->wait(); |
||
985 | } |
||
986 | |||
987 | /** |
||
988 | * Creates promise to set the ACL and any container-level access policies |
||
989 | * for the container. |
||
990 | * |
||
991 | * @param string $container name |
||
992 | * @param Models\ContainerACL $acl access control list for container |
||
993 | * @param Models\BlobServiceOptions $options optional parameters |
||
994 | * |
||
995 | * @return \GuzzleHttp\Promise\PromiseInterface |
||
996 | * |
||
997 | * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179391.aspx |
||
998 | */ |
||
999 | public function setContainerAclAsync( |
||
1061 | |||
1062 | /** |
||
1063 | * Sets metadata headers on the container. |
||
1064 | * |
||
1065 | * @param string $container name |
||
1066 | * @param array $metadata metadata key/value pair. |
||
1067 | * @param Models\BlobServiceOptions $options optional parameters |
||
1068 | * |
||
1069 | * @return void |
||
1070 | * |
||
1071 | * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179362.aspx |
||
1072 | */ |
||
1073 | public function setContainerMetadata( |
||
1074 | $container, |
||
1075 | array $metadata, |
||
1076 | Models\BlobServiceOptions $options = null |
||
1077 | ) { |
||
1078 | $this->setContainerMetadataAsync($container, $metadata, $options)->wait(); |
||
1079 | } |
||
1080 | |||
1081 | /** |
||
1082 | * Sets metadata headers on the container. |
||
1083 | * |
||
1084 | * @param string $container name |
||
1085 | * @param array $metadata metadata key/value pair. |
||
1086 | * @param Models\BlobServiceOptions $options optional parameters |
||
1087 | * |
||
1088 | * @return \GuzzleHttp\Promise\PromiseInterface |
||
1089 | * |
||
1090 | * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179362.aspx |
||
1091 | */ |
||
1092 | public function setContainerMetadataAsync( |
||
1145 | |||
1146 | /** |
||
1147 | * Lists all of the blobs in the given container. |
||
1148 | * |
||
1149 | * @param string $container The container name. |
||
1150 | * @param Models\ListBlobsOptions $options The optional parameters. |
||
1151 | * |
||
1152 | * @return Models\ListBlobsResult |
||
1153 | * |
||
1154 | * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd135734.aspx |
||
1155 | */ |
||
1156 | public function listBlobs($container, Models\ListBlobsOptions $options = null) |
||
1157 | { |
||
1158 | return $this->listBlobsAsync($container, $options)->wait(); |
||
1159 | } |
||
1160 | |||
1161 | /** |
||
1162 | * Creates promise to list all of the blobs in the given container. |
||
1163 | * |
||
1164 | * @param string $container The container name. |
||
1165 | * @param Models\ListBlobsOptions $options The optional parameters. |
||
1166 | * |
||
1167 | * @return \GuzzleHttp\Promise\PromiseInterface |
||
1168 | * |
||
1169 | * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd135734.aspx |
||
1170 | */ |
||
1171 | public function listBlobsAsync( |
||
1257 | |||
1258 | /** |
||
1259 | * Creates a new page blob. Note that calling createPageBlob to create a page |
||
1260 | * blob only initializes the blob. |
||
1261 | * To add content to a page blob, call createBlobPages method. |
||
1262 | * |
||
1263 | * @param string $container The container name. |
||
1264 | * @param string $blob The blob name. |
||
1265 | * @param integer $length Specifies the maximum size |
||
1266 | * for the page blob, up to 1 TB. |
||
1267 | * The page blob size must be |
||
1268 | * aligned to a 512-byte |
||
1269 | * boundary. |
||
1270 | * @param Models\CreateBlobOptions $options The optional parameters. |
||
1271 | * |
||
1272 | * @return Models\PutBlobResult |
||
1273 | * |
||
1274 | * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179451.aspx |
||
1275 | */ |
||
1276 | public function createPageBlob( |
||
1277 | $container, |
||
1278 | $blob, |
||
1279 | $length, |
||
1280 | Models\CreateBlobOptions $options = null |
||
1281 | ) { |
||
1282 | return $this->createPageBlobAsync( |
||
1283 | $container, |
||
1284 | $blob, |
||
1285 | $length, |
||
1286 | $options |
||
1287 | )->wait(); |
||
1288 | } |
||
1289 | |||
1290 | /** |
||
1291 | * Creates promise to create a new page blob. Note that calling |
||
1292 | * createPageBlob to create a page blob only initializes the blob. |
||
1293 | * To add content to a page blob, call createBlobPages method. |
||
1294 | * |
||
1295 | * @param string $container The container name. |
||
1296 | * @param string $blob The blob name. |
||
1297 | * @param integer $length Specifies the maximum size |
||
1298 | * for the page blob, up to 1 TB. |
||
1299 | * The page blob size must be |
||
1300 | * aligned to a 512-byte |
||
1301 | * boundary. |
||
1302 | * @param Models\CreateBlobOptions $options The optional parameters. |
||
1303 | * |
||
1304 | * @return \GuzzleHttp\Promise\PromiseInterface |
||
1305 | * |
||
1306 | * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179451.aspx |
||
1307 | */ |
||
1308 | public function createPageBlobAsync( |
||
1365 | |||
1366 | /** |
||
1367 | * Create a new append blob. |
||
1368 | * If the blob already exists on the service, it will be overwritten. |
||
1369 | * |
||
1370 | * @param string $container The container name. |
||
1371 | * @param string $blob The blob name. |
||
1372 | * @param Models\CreateBlobOptions $options The optional parameters. |
||
1373 | * |
||
1374 | * @return Models\PutBlobResult |
||
1375 | * |
||
1376 | * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179451.aspx |
||
1377 | */ |
||
1378 | public function createAppendBlob( |
||
1389 | |||
1390 | /** |
||
1391 | * Creates promise to create a new append blob. |
||
1392 | * If the blob already exists on the service, it will be overwritten. |
||
1393 | * |
||
1394 | * @param string $container The container name. |
||
1395 | * @param string $blob The blob name. |
||
1396 | * @param Models\CreateBlobOptions $options The optional parameters. |
||
1397 | * |
||
1398 | * @return \GuzzleHttp\Promise\PromiseInterface |
||
1399 | * |
||
1400 | * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179451.aspx |
||
1401 | */ |
||
1402 | public function createAppendBlobAsync( |
||
1447 | |||
1448 | /** |
||
1449 | * Creates a new block blob or updates the content of an existing block blob. |
||
1450 | * |
||
1451 | * Updating an existing block blob overwrites any existing metadata on the blob. |
||
1452 | * Partial updates are not supported with createBlockBlob the content of the |
||
1453 | * existing blob is overwritten with the content of the new blob. To perform a |
||
1454 | * partial update of the content of a block blob, use the createBlockList |
||
1455 | * method. |
||
1456 | * Note that the default content type is application/octet-stream. |
||
1457 | * |
||
1458 | * @param string $container The name of the container. |
||
1459 | * @param string $blob The name of the blob. |
||
1460 | * @param string|resource|StreamInterface $content The content of the blob. |
||
1461 | * @param Models\CreateBlobOptions $options The optional parameters. |
||
1462 | * |
||
1463 | * @return Models\PutBlobResult |
||
1464 | * |
||
1465 | * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179451.aspx |
||
1466 | */ |
||
1467 | public function createBlockBlob( |
||
1468 | $container, |
||
1469 | $blob, |
||
1470 | $content, |
||
1471 | Models\CreateBlobOptions $options = null |
||
1472 | ) { |
||
1473 | return $this->createBlockBlobAsync( |
||
1474 | $container, |
||
1475 | $blob, |
||
1476 | $content, |
||
1477 | $options |
||
1478 | )->wait(); |
||
1479 | } |
||
1480 | |||
1481 | /** |
||
1482 | * Creates a promise to create a new block blob or updates the content of |
||
1483 | * an existing block blob. |
||
1484 | * |
||
1485 | * Updating an existing block blob overwrites any existing metadata on the blob. |
||
1486 | * Partial updates are not supported with createBlockBlob the content of the |
||
1487 | * existing blob is overwritten with the content of the new blob. To perform a |
||
1488 | * partial update of the content of a block blob, use the createBlockList |
||
1489 | * method. |
||
1490 | * |
||
1491 | * @param string $container The name of the container. |
||
1492 | * @param string $blob The name of the blob. |
||
1493 | * @param string|resource|StreamInterface $content The content of the blob. |
||
1494 | * @param Models\CreateBlobOptions $options The optional parameters. |
||
1495 | * |
||
1496 | * @return Models\PutBlobResult |
||
1497 | * |
||
1498 | * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179451.aspx |
||
1499 | */ |
||
1500 | public function createBlockBlobAsync( |
||
1534 | |||
1535 | /** |
||
1536 | * Create a new page blob and upload the content to the page blob. |
||
1537 | * |
||
1538 | * @param string $container The name of the container. |
||
1539 | * @param string $blob The name of the blob. |
||
1540 | * @param int $length The length of the blob. |
||
1541 | * @param string|resource|StreamInterface $content The content of the blob. |
||
1542 | * @param Models\CreateBlobOptions $options The optional parameters. |
||
1543 | * |
||
1544 | * @return Models\GetBlobPropertiesResult |
||
1545 | * |
||
1546 | * @see https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/get-blob-properties |
||
1547 | */ |
||
1548 | public function createPageBlobFromContent( |
||
1563 | |||
1564 | /** |
||
1565 | * Creates a promise to create a new page blob and upload the content |
||
1566 | * to the page blob. |
||
1567 | * |
||
1568 | * @param string $container The name of the container. |
||
1569 | * @param string $blob The name of the blob. |
||
1570 | * @param int $length The length of the blob. |
||
1571 | * @param string|resource|StreamInterface $content The content of the blob. |
||
1572 | * @param Models\CreateBlobOptions $options The optional parameters. |
||
1573 | * |
||
1574 | * @return \GuzzleHttp\Promise\PromiseInterface |
||
1575 | * |
||
1576 | * @see https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/get-blob-properties |
||
1577 | */ |
||
1578 | public function createPageBlobFromContentAsync( |
||
1633 | |||
1634 | /** |
||
1635 | * Creates promise to create a new block blob or updates the content of an |
||
1636 | * existing block blob. This only supports contents smaller than single |
||
1637 | * upload threashold. |
||
1638 | * |
||
1639 | * Updating an existing block blob overwrites any existing metadata on |
||
1640 | * the blob. |
||
1641 | * |
||
1642 | * @param string $container The name of the container. |
||
1643 | * @param string $blob The name of the blob. |
||
1644 | * @param StreamInterface $content The content of the blob. |
||
1645 | * @param Models\CreateBlobOptions $options The optional parameters. |
||
1646 | * |
||
1647 | * @return \GuzzleHttp\Promise\PromiseInterface |
||
1648 | * |
||
1649 | * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179451.aspx |
||
1650 | */ |
||
1651 | protected function createBlockBlobBySingleUploadAsync( |
||
1709 | |||
1710 | /** |
||
1711 | * This method creates the blob blocks. This method will send the request |
||
1712 | * concurrently for better performance. |
||
1713 | * |
||
1714 | * @param string $container Name of the container |
||
1715 | * @param string $blob Name of the blob |
||
1716 | * @param StreamInterface $content Content's stream |
||
1717 | * @param Models\CreateBlobOptions $options Array that contains |
||
1718 | * all the option |
||
1719 | * |
||
1720 | * @return \GuzzleHttp\Promise\PromiseInterface |
||
1721 | */ |
||
1722 | protected function createBlockBlobByMultipleUploadAsync( |
||
1823 | |||
1824 | |||
1825 | /** |
||
1826 | * This method upload the page blob pages. This method will send the request |
||
1827 | * concurrently for better performance. |
||
1828 | * |
||
1829 | * @param string $container Name of the container |
||
1830 | * @param string $blob Name of the blob |
||
1831 | * @param StreamInterface $content Content's stream |
||
1832 | * @param Models\CreateBlobOptions $options Array that contains |
||
1833 | * all the option |
||
1834 | * |
||
1835 | * @return \GuzzleHttp\Promise\PromiseInterface |
||
1836 | */ |
||
1837 | private function uploadPageBlobAsync( |
||
1941 | |||
1942 | /** |
||
1943 | * Clears a range of pages from the blob. |
||
1944 | * |
||
1945 | * @param string $container name of the container |
||
1946 | * @param string $blob name of the blob |
||
1947 | * @param Range $range Can be up to the value of |
||
1948 | * the blob's full size. |
||
1949 | * Note that ranges must be |
||
1950 | * aligned to 512 (0-511, |
||
1951 | * 512-1023) |
||
1952 | * @param Models\CreateBlobPagesOptions $options optional parameters |
||
1953 | * |
||
1954 | * @return Models\CreateBlobPagesResult |
||
1955 | * |
||
1956 | * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee691975.aspx |
||
1957 | */ |
||
1958 | public function clearBlobPages( |
||
1959 | $container, |
||
1960 | $blob, |
||
1961 | Range $range, |
||
1962 | Models\CreateBlobPagesOptions $options = null |
||
1963 | ) { |
||
1964 | return $this->clearBlobPagesAsync( |
||
1965 | $container, |
||
1966 | $blob, |
||
1967 | $range, |
||
1968 | $options |
||
1969 | )->wait(); |
||
1970 | } |
||
1971 | |||
1972 | /** |
||
1973 | * Creates promise to clear a range of pages from the blob. |
||
1974 | * |
||
1975 | * @param string $container name of the container |
||
1976 | * @param string $blob name of the blob |
||
1977 | * @param Range $range Can be up to the value of |
||
1978 | * the blob's full size. |
||
1979 | * Note that ranges must be |
||
1980 | * aligned to 512 (0-511, |
||
1981 | * 512-1023) |
||
1982 | * @param Models\CreateBlobPagesOptions $options optional parameters |
||
1983 | * |
||
1984 | * @return \GuzzleHttp\Promise\PromiseInterface |
||
1985 | * |
||
1986 | * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee691975.aspx |
||
1987 | */ |
||
1988 | public function clearBlobPagesAsync( |
||
2003 | |||
2004 | /** |
||
2005 | * Creates a range of pages to a page blob. |
||
2006 | * |
||
2007 | * @param string $container name of the container |
||
2008 | * @param string $blob name of the blob |
||
2009 | * @param Range $range Can be up to 4 MB in |
||
2010 | * size. Note that ranges |
||
2011 | * must be aligned to 512 |
||
2012 | * (0-511, 512-1023) |
||
2013 | * @param string|resource|StreamInterface $content the blob contents. |
||
2014 | * @param Models\CreateBlobPagesOptions $options optional parameters |
||
2015 | * |
||
2016 | * @return Models\CreateBlobPagesResult |
||
2017 | * |
||
2018 | * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee691975.aspx |
||
2019 | */ |
||
2020 | public function createBlobPages( |
||
2021 | $container, |
||
2022 | $blob, |
||
2023 | Range $range, |
||
2024 | $content, |
||
2025 | Models\CreateBlobPagesOptions $options = null |
||
2026 | ) { |
||
2027 | return $this->createBlobPagesAsync( |
||
2028 | $container, |
||
2029 | $blob, |
||
2030 | $range, |
||
2031 | $content, |
||
2032 | $options |
||
2033 | )->wait(); |
||
2034 | } |
||
2035 | |||
2036 | /** |
||
2037 | * Creates promise to create a range of pages to a page blob. |
||
2038 | * |
||
2039 | * @param string $container name of the container |
||
2040 | * @param string $blob name of the blob |
||
2041 | * @param Range $range Can be up to 4 MB in |
||
2042 | * size. Note that ranges |
||
2043 | * must be aligned to 512 |
||
2044 | * (0-511, 512-1023) |
||
2045 | * @param string|resource|StreamInterface $content the blob contents. |
||
2046 | * @param Models\CreateBlobPagesOptions $options optional parameters |
||
2047 | * |
||
2048 | * @return \GuzzleHttp\Promise\PromiseInterface |
||
2049 | * |
||
2050 | * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee691975.aspx |
||
2051 | */ |
||
2052 | public function createBlobPagesAsync( |
||
2079 | |||
2080 | /** |
||
2081 | * Creates a new block to be committed as part of a block blob. |
||
2082 | * |
||
2083 | * @param string $container name of the container |
||
2084 | * @param string $blob name of the blob |
||
2085 | * @param string $blockId must be less than or |
||
2086 | * equal to 64 bytes in |
||
2087 | * size. For a given blob, |
||
2088 | * the length of the value |
||
2089 | * specified for the |
||
2090 | * blockid parameter must |
||
2091 | * be the same size for |
||
2092 | * each block. |
||
2093 | * @param resource|string|StreamInterface $content the blob block contents |
||
2094 | * @param Models\CreateBlobBlockOptions $options optional parameters |
||
2095 | * |
||
2096 | * @return Models\PutBlockResult |
||
2097 | * |
||
2098 | * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd135726.aspx |
||
2099 | */ |
||
2100 | public function createBlobBlock( |
||
2101 | $container, |
||
2102 | $blob, |
||
2103 | $blockId, |
||
2104 | $content, |
||
2105 | Models\CreateBlobBlockOptions $options = null |
||
2106 | ) { |
||
2107 | return $this->createBlobBlockAsync( |
||
2108 | $container, |
||
2109 | $blob, |
||
2110 | $blockId, |
||
2111 | $content, |
||
2112 | $options |
||
2113 | )->wait(); |
||
2114 | } |
||
2115 | |||
2116 | /** |
||
2117 | * Creates a new block to be committed as part of a block blob. |
||
2118 | * |
||
2119 | * @param string $container name of the container |
||
2120 | * @param string $blob name of the blob |
||
2121 | * @param string $blockId must be less than or |
||
2122 | * equal to 64 bytes in |
||
2123 | * size. For a given blob, |
||
2124 | * the length of the value |
||
2125 | * specified for the |
||
2126 | * blockid parameter must |
||
2127 | * be the same size for |
||
2128 | * each block. |
||
2129 | * @param resource|string|StreamInterface $content the blob block contents |
||
2130 | * @param Models\CreateBlobBlockOptions $options optional parameters |
||
2131 | * |
||
2132 | * @return \GuzzleHttp\Promise\PromiseInterface |
||
2133 | * |
||
2134 | * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd135726.aspx |
||
2135 | */ |
||
2136 | public function createBlobBlockAsync( |
||
2179 | |||
2180 | /** |
||
2181 | * Commits a new block of data to the end of an existing append blob. |
||
2182 | * |
||
2183 | * @param string $container name of the container |
||
2184 | * @param string $blob name of the blob |
||
2185 | * @param resource|string|StreamInterface $content the blob block contents |
||
2186 | * @param Models\AppendBlockOptions $options optional parameters |
||
2187 | * |
||
2188 | * @return Models\AppendBlockResult |
||
2189 | * |
||
2190 | * @see https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/append-block |
||
2191 | */ |
||
2192 | public function appendBlock( |
||
2205 | |||
2206 | |||
2207 | /** |
||
2208 | * Creates promise to commit a new block of data to the end of an existing append blob. |
||
2209 | * |
||
2210 | * @param string $container name of the container |
||
2211 | * @param string $blob name of the blob |
||
2212 | * @param resource|string|StreamInterface $content the blob block contents |
||
2213 | * @param Models\AppendBlockOptions $options optional parameters |
||
2214 | * |
||
2215 | * @return \GuzzleHttp\Promise\PromiseInterface |
||
2216 | * |
||
2217 | * @see https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/append-block |
||
2218 | */ |
||
2219 | public function appendBlockAsync( |
||
2299 | |||
2300 | /** |
||
2301 | * create the header for createBlobBlock(s) |
||
2302 | * @param Models\CreateBlobBlockOptions $options the option of the request |
||
2303 | * |
||
2304 | * @return array |
||
2305 | */ |
||
2306 | protected function createBlobBlockHeader(Models\CreateBlobBlockOptions $options = null) |
||
2307 | { |
||
2308 | $headers = array(); |
||
2309 | $this->addOptionalHeader( |
||
2310 | $headers, |
||
2311 | Resources::X_MS_LEASE_ID, |
||
2312 | $options->getLeaseId() |
||
2313 | ); |
||
2314 | $this->addOptionalHeader( |
||
2315 | $headers, |
||
2316 | Resources::CONTENT_MD5, |
||
2317 | $options->getContentMD5() |
||
2318 | ); |
||
2319 | $this->addOptionalHeader( |
||
2320 | $headers, |
||
2321 | Resources::CONTENT_TYPE, |
||
2322 | Resources::URL_ENCODED_CONTENT_TYPE |
||
2323 | ); |
||
2324 | |||
2325 | return $headers; |
||
2326 | } |
||
2327 | |||
2328 | /** |
||
2329 | * create the query params for createBlobBlock(s) |
||
2330 | * @param Models\CreateBlobBlockOptions $options the option of the |
||
2331 | * request |
||
2332 | * @param string $blockId the block id of the |
||
2333 | * block. |
||
2334 | * @param bool $isConcurrent if the query |
||
2335 | * parameter is for |
||
2336 | * concurrent upload. |
||
2337 | * |
||
2338 | * @return array the constructed query parameters. |
||
2339 | */ |
||
2340 | protected function createBlobBlockQueryParams( |
||
2341 | Models\CreateBlobBlockOptions $options, |
||
2342 | $blockId, |
||
2343 | $isConcurrent = false |
||
2344 | ) { |
||
2345 | $queryParams = array(); |
||
2346 | $this->addOptionalQueryParam( |
||
2347 | $queryParams, |
||
2348 | Resources::QP_COMP, |
||
2349 | 'block' |
||
2350 | ); |
||
2351 | $this->addOptionalQueryParam( |
||
2352 | $queryParams, |
||
2353 | Resources::QP_BLOCKID, |
||
2354 | $blockId |
||
2355 | ); |
||
2356 | if ($isConcurrent) { |
||
2357 | $this->addOptionalQueryParam( |
||
2358 | $queryParams, |
||
2359 | Resources::QP_TIMEOUT, |
||
2360 | $options->getTimeout() |
||
2361 | ); |
||
2362 | } |
||
2363 | |||
2364 | return $queryParams; |
||
2365 | } |
||
2366 | |||
2367 | /** |
||
2368 | * This method writes a blob by specifying the list of block IDs that make up the |
||
2369 | * blob. In order to be written as part of a blob, a block must have been |
||
2370 | * successfully written to the server in a prior createBlobBlock method. |
||
2371 | * |
||
2372 | * You can call Put Block List to update a blob by uploading only those blocks |
||
2373 | * that have changed, then committing the new and existing blocks together. |
||
2374 | * You can do this by specifying whether to commit a block from the committed |
||
2375 | * block list or from the uncommitted block list, or to commit the most recently |
||
2376 | * uploaded version of the block, whichever list it may belong to. |
||
2377 | * |
||
2378 | * @param string $container The container name. |
||
2379 | * @param string $blob The blob name. |
||
2380 | * @param Models\BlockList|array $blockList The block entries. |
||
2381 | * @param Models\CommitBlobBlocksOptions $options The optional parameters. |
||
2382 | * |
||
2383 | * @return Models\PutBlobResult |
||
2384 | * |
||
2385 | * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179467.aspx |
||
2386 | */ |
||
2387 | public function commitBlobBlocks( |
||
2388 | $container, |
||
2389 | $blob, |
||
2390 | $blockList, |
||
2391 | Models\CommitBlobBlocksOptions $options = null |
||
2392 | ) { |
||
2393 | return $this->commitBlobBlocksAsync( |
||
2394 | $container, |
||
2395 | $blob, |
||
2396 | $blockList, |
||
2397 | $options |
||
2398 | )->wait(); |
||
2399 | } |
||
2400 | |||
2401 | /** |
||
2402 | * This method writes a blob by specifying the list of block IDs that make up the |
||
2403 | * blob. In order to be written as part of a blob, a block must have been |
||
2404 | * successfully written to the server in a prior createBlobBlock method. |
||
2405 | * |
||
2406 | * You can call Put Block List to update a blob by uploading only those blocks |
||
2407 | * that have changed, then committing the new and existing blocks together. |
||
2408 | * You can do this by specifying whether to commit a block from the committed |
||
2409 | * block list or from the uncommitted block list, or to commit the most recently |
||
2410 | * uploaded version of the block, whichever list it may belong to. |
||
2411 | * |
||
2412 | * @param string $container The container name. |
||
2413 | * @param string $blob The blob name. |
||
2414 | * @param Models\BlockList|array $blockList The block entries. |
||
2415 | * @param Models\CommitBlobBlocksOptions $options The optional parameters. |
||
2416 | * |
||
2417 | * @return \GuzzleHttp\Promise\PromiseInterface |
||
2418 | * |
||
2419 | * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179467.aspx |
||
2420 | */ |
||
2421 | public function commitBlobBlocksAsync( |
||
2532 | |||
2533 | /** |
||
2534 | * Retrieves the list of blocks that have been uploaded as part of a block blob. |
||
2535 | * |
||
2536 | * There are two block lists maintained for a blob: |
||
2537 | * 1) Committed Block List: The list of blocks that have been successfully |
||
2538 | * committed to a given blob with commitBlobBlocks. |
||
2539 | * 2) Uncommitted Block List: The list of blocks that have been uploaded for a |
||
2540 | * blob using Put Block (REST API), but that have not yet been committed. |
||
2541 | * These blocks are stored in Windows Azure in association with a blob, but do |
||
2542 | * not yet form part of the blob. |
||
2543 | * |
||
2544 | * @param string $container name of the container |
||
2545 | * @param string $blob name of the blob |
||
2546 | * @param Models\ListBlobBlocksOptions $options optional parameters |
||
2547 | * |
||
2548 | * @return Models\ListBlobBlocksResult |
||
2549 | * |
||
2550 | * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179400.aspx |
||
2551 | */ |
||
2552 | public function listBlobBlocks( |
||
2553 | $container, |
||
2554 | $blob, |
||
2555 | Models\ListBlobBlocksOptions $options = null |
||
2556 | ) { |
||
2557 | return $this->listBlobBlocksAsync($container, $blob, $options)->wait(); |
||
2558 | } |
||
2559 | |||
2560 | /** |
||
2561 | * Creates promise to retrieve the list of blocks that have been uploaded as |
||
2562 | * part of a block blob. |
||
2563 | * |
||
2564 | * There are two block lists maintained for a blob: |
||
2565 | * 1) Committed Block List: The list of blocks that have been successfully |
||
2566 | * committed to a given blob with commitBlobBlocks. |
||
2567 | * 2) Uncommitted Block List: The list of blocks that have been uploaded for a |
||
2568 | * blob using Put Block (REST API), but that have not yet been committed. |
||
2569 | * These blocks are stored in Windows Azure in association with a blob, but do |
||
2570 | * not yet form part of the blob. |
||
2571 | * |
||
2572 | * @param string $container name of the container |
||
2573 | * @param string $blob name of the blob |
||
2574 | * @param Models\ListBlobBlocksOptions $options optional parameters |
||
2575 | * |
||
2576 | * @return \GuzzleHttp\Promise\PromiseInterface |
||
2577 | * |
||
2578 | * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179400.aspx |
||
2579 | */ |
||
2580 | public function listBlobBlocksAsync( |
||
2639 | |||
2640 | /** |
||
2641 | * Returns all properties and metadata on the blob. |
||
2642 | * |
||
2643 | * @param string $container name of the container |
||
2644 | * @param string $blob name of the blob |
||
2645 | * @param Models\GetBlobPropertiesOptions $options optional parameters |
||
2646 | * |
||
2647 | * @return Models\GetBlobPropertiesResult |
||
2648 | * |
||
2649 | * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179394.aspx |
||
2650 | */ |
||
2651 | public function getBlobProperties( |
||
2652 | $container, |
||
2653 | $blob, |
||
2654 | Models\GetBlobPropertiesOptions $options = null |
||
2655 | ) { |
||
2656 | return $this->getBlobPropertiesAsync( |
||
2657 | $container, |
||
2658 | $blob, |
||
2659 | $options |
||
2660 | )->wait(); |
||
2661 | } |
||
2662 | |||
2663 | /** |
||
2664 | * Creates promise to return all properties and metadata on the blob. |
||
2665 | * |
||
2666 | * @param string $container name of the container |
||
2667 | * @param string $blob name of the blob |
||
2668 | * @param Models\GetBlobPropertiesOptions $options optional parameters |
||
2669 | * |
||
2670 | * @return \GuzzleHttp\Promise\PromiseInterface |
||
2671 | * |
||
2672 | * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179394.aspx |
||
2673 | */ |
||
2674 | public function getBlobPropertiesAsync( |
||
2723 | |||
2724 | /** |
||
2725 | * Returns all properties and metadata on the blob. |
||
2726 | * |
||
2727 | * @param string $container name of the container |
||
2728 | * @param string $blob name of the blob |
||
2729 | * @param Models\GetBlobMetadataOptions $options optional parameters |
||
2730 | * |
||
2731 | * @return Models\GetBlobMetadataResult |
||
2732 | * |
||
2733 | * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179350.aspx |
||
2734 | */ |
||
2735 | public function getBlobMetadata( |
||
2736 | $container, |
||
2737 | $blob, |
||
2738 | Models\GetBlobMetadataOptions $options = null |
||
2739 | ) { |
||
2740 | return $this->getBlobMetadataAsync($container, $blob, $options)->wait(); |
||
2741 | } |
||
2742 | |||
2743 | /** |
||
2744 | * Creates promise to return all properties and metadata on the blob. |
||
2745 | * |
||
2746 | * @param string $container name of the container |
||
2747 | * @param string $blob name of the blob |
||
2748 | * @param Models\GetBlobMetadataOptions $options optional parameters |
||
2749 | * |
||
2750 | * @return \GuzzleHttp\Promise\PromiseInterface |
||
2751 | * |
||
2752 | * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179350.aspx |
||
2753 | */ |
||
2754 | View Code Duplication | public function getBlobMetadataAsync( |
|
2809 | |||
2810 | /** |
||
2811 | * Returns a list of active page ranges for a page blob. Active page ranges are |
||
2812 | * those that have been populated with data. |
||
2813 | * |
||
2814 | * @param string $container name of the container |
||
2815 | * @param string $blob name of the blob |
||
2816 | * @param Models\ListPageBlobRangesOptions $options optional parameters |
||
2817 | * |
||
2818 | * @return Models\ListPageBlobRangesResult |
||
2819 | * |
||
2820 | * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee691973.aspx |
||
2821 | */ |
||
2822 | public function listPageBlobRanges( |
||
2823 | $container, |
||
2824 | $blob, |
||
2825 | Models\ListPageBlobRangesOptions $options = null |
||
2826 | ) { |
||
2827 | return $this->listPageBlobRangesAsync( |
||
2828 | $container, |
||
2829 | $blob, |
||
2830 | $options |
||
2831 | )->wait(); |
||
2832 | } |
||
2833 | |||
2834 | /** |
||
2835 | * Creates promise to return a list of active page ranges for a page blob. |
||
2836 | * Active page ranges are those that have been populated with data. |
||
2837 | * |
||
2838 | * @param string $container name of the container |
||
2839 | * @param string $blob name of the blob |
||
2840 | * @param Models\ListPageBlobRangesOptions $options optional parameters |
||
2841 | * |
||
2842 | * @return \GuzzleHttp\Promise\PromiseInterface |
||
2843 | * |
||
2844 | * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee691973.aspx |
||
2845 | */ |
||
2846 | public function listPageBlobRangesAsync( |
||
2911 | |||
2912 | /** |
||
2913 | * Sets system properties defined for a blob. |
||
2914 | * |
||
2915 | * @param string $container name of the container |
||
2916 | * @param string $blob name of the blob |
||
2917 | * @param Models\SetBlobPropertiesOptions $options optional parameters |
||
2918 | * |
||
2919 | * @return Models\SetBlobPropertiesResult |
||
2920 | * |
||
2921 | * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee691966.aspx |
||
2922 | */ |
||
2923 | public function setBlobProperties( |
||
2924 | $container, |
||
2925 | $blob, |
||
2926 | Models\SetBlobPropertiesOptions $options = null |
||
2927 | ) { |
||
2928 | return $this->setBlobPropertiesAsync( |
||
2929 | $container, |
||
2930 | $blob, |
||
2931 | $options |
||
2932 | )->wait(); |
||
2933 | } |
||
2934 | |||
2935 | /** |
||
2936 | * Creates promise to set system properties defined for a blob. |
||
2937 | * |
||
2938 | * @param string $container name of the container |
||
2939 | * @param string $blob name of the blob |
||
2940 | * @param Models\SetBlobPropertiesOptions $options optional parameters |
||
2941 | * |
||
2942 | * @return \GuzzleHttp\Promise\PromiseInterface |
||
2943 | * |
||
2944 | * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee691966.aspx |
||
2945 | */ |
||
2946 | public function setBlobPropertiesAsync( |
||
3051 | |||
3052 | /** |
||
3053 | * Sets metadata headers on the blob. |
||
3054 | * |
||
3055 | * @param string $container name of the container |
||
3056 | * @param string $blob name of the blob |
||
3057 | * @param array $metadata key/value pair representation |
||
3058 | * @param Models\BlobServiceOptions $options optional parameters |
||
3059 | * |
||
3060 | * @return Models\SetBlobMetadataResult |
||
3061 | * |
||
3062 | * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179414.aspx |
||
3063 | */ |
||
3064 | public function setBlobMetadata( |
||
3065 | $container, |
||
3066 | $blob, |
||
3067 | array $metadata, |
||
3068 | Models\BlobServiceOptions $options = null |
||
3069 | ) { |
||
3070 | return $this->setBlobMetadataAsync( |
||
3071 | $container, |
||
3072 | $blob, |
||
3073 | $metadata, |
||
3074 | $options |
||
3075 | )->wait(); |
||
3076 | } |
||
3077 | |||
3078 | /** |
||
3079 | * Creates promise to set metadata headers on the blob. |
||
3080 | * |
||
3081 | * @param string $container name of the container |
||
3082 | * @param string $blob name of the blob |
||
3083 | * @param array $metadata key/value pair representation |
||
3084 | * @param Models\BlobServiceOptions $options optional parameters |
||
3085 | * |
||
3086 | * @return \GuzzleHttp\Promise\PromiseInterface |
||
3087 | * |
||
3088 | * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179414.aspx |
||
3089 | */ |
||
3090 | View Code Duplication | public function setBlobMetadataAsync( |
|
3145 | |||
3146 | /** |
||
3147 | * Downloads a blob to a file, the result contains its metadata and |
||
3148 | * properties. The result will not contain a stream pointing to the |
||
3149 | * content of the file. |
||
3150 | * |
||
3151 | * @param string $path The path and name of the file |
||
3152 | * @param string $container name of the container |
||
3153 | * @param string $blob name of the blob |
||
3154 | * @param Models\GetBlobOptions $options optional parameters |
||
3155 | * |
||
3156 | * @return Models\GetBlobResult |
||
3157 | * |
||
3158 | * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179440.aspx |
||
3159 | */ |
||
3160 | public function saveBlobToFile( |
||
3161 | $path, |
||
3162 | $container, |
||
3163 | $blob, |
||
3164 | Models\GetBlobOptions $options = null |
||
3165 | ) { |
||
3166 | return $this->saveBlobToFileAsync( |
||
3167 | $path, |
||
3168 | $container, |
||
3169 | $blob, |
||
3170 | $options |
||
3171 | )->wait(); |
||
3172 | } |
||
3173 | |||
3174 | /** |
||
3175 | * Creates promise to download a blob to a file, the result contains its |
||
3176 | * metadata and properties. The result will not contain a stream pointing |
||
3177 | * to the content of the file. |
||
3178 | * |
||
3179 | * @param string $path The path and name of the file |
||
3180 | * @param string $container name of the container |
||
3181 | * @param string $blob name of the blob |
||
3182 | * @param Models\GetBlobOptions $options optional parameters |
||
3183 | * |
||
3184 | * @return \GuzzleHttp\Promise\PromiseInterface |
||
3185 | * |
||
3186 | * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179440.aspx |
||
3187 | */ |
||
3188 | public function saveBlobToFileAsync( |
||
3216 | |||
3217 | /** |
||
3218 | * Reads or downloads a blob from the system, including its metadata and |
||
3219 | * properties. |
||
3220 | * |
||
3221 | * @param string $container name of the container |
||
3222 | * @param string $blob name of the blob |
||
3223 | * @param Models\GetBlobOptions $options optional parameters |
||
3224 | * |
||
3225 | * @return Models\GetBlobResult |
||
3226 | * |
||
3227 | * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179440.aspx |
||
3228 | */ |
||
3229 | public function getBlob( |
||
3230 | $container, |
||
3231 | $blob, |
||
3232 | Models\GetBlobOptions $options = null |
||
3233 | ) { |
||
3234 | return $this->getBlobAsync($container, $blob, $options)->wait(); |
||
3235 | } |
||
3236 | |||
3237 | /** |
||
3238 | * Creates promise to read or download a blob from the system, including its |
||
3239 | * metadata and properties. |
||
3240 | * |
||
3241 | * @param string $container name of the container |
||
3242 | * @param string $blob name of the blob |
||
3243 | * @param Models\GetBlobOptions $options optional parameters |
||
3244 | * |
||
3245 | * @return \GuzzleHttp\Promise\PromiseInterface |
||
3246 | * |
||
3247 | * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179440.aspx |
||
3248 | */ |
||
3249 | public function getBlobAsync( |
||
3317 | |||
3318 | /** |
||
3319 | * Deletes a blob or blob snapshot. |
||
3320 | * |
||
3321 | * Note that if the snapshot entry is specified in the $options then only this |
||
3322 | * blob snapshot is deleted. To delete all blob snapshots, do not set Snapshot |
||
3323 | * and just set getDeleteSnaphotsOnly to true. |
||
3324 | * |
||
3325 | * @param string $container name of the container |
||
3326 | * @param string $blob name of the blob |
||
3327 | * @param Models\DeleteBlobOptions $options optional parameters |
||
3328 | * |
||
3329 | * @return void |
||
3330 | * |
||
3331 | * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179413.aspx |
||
3332 | */ |
||
3333 | public function deleteBlob( |
||
3334 | $container, |
||
3335 | $blob, |
||
3336 | Models\DeleteBlobOptions $options = null |
||
3337 | ) { |
||
3338 | $this->deleteBlobAsync($container, $blob, $options)->wait(); |
||
3339 | } |
||
3340 | |||
3341 | /** |
||
3342 | * Creates promise to delete a blob or blob snapshot. |
||
3343 | * |
||
3344 | * Note that if the snapshot entry is specified in the $options then only this |
||
3345 | * blob snapshot is deleted. To delete all blob snapshots, do not set Snapshot |
||
3346 | * and just set getDeleteSnaphotsOnly to true. |
||
3347 | * |
||
3348 | * @param string $container name of the container |
||
3349 | * @param string $blob name of the blob |
||
3350 | * @param Models\DeleteBlobOptions $options optional parameters |
||
3351 | * |
||
3352 | * @return \GuzzleHttp\Promise\PromiseInterface |
||
3353 | * |
||
3354 | * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179413.aspx |
||
3355 | */ |
||
3356 | public function deleteBlobAsync( |
||
3414 | |||
3415 | /** |
||
3416 | * Creates a snapshot of a blob. |
||
3417 | * |
||
3418 | * @param string $container The name of the container. |
||
3419 | * @param string $blob The name of the blob. |
||
3420 | * @param Models\CreateBlobSnapshotOptions $options The optional parameters. |
||
3421 | * |
||
3422 | * @return Models\CreateBlobSnapshotResult |
||
3423 | * |
||
3424 | * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee691971.aspx |
||
3425 | */ |
||
3426 | public function createBlobSnapshot( |
||
3427 | $container, |
||
3428 | $blob, |
||
3429 | Models\CreateBlobSnapshotOptions $options = null |
||
3430 | ) { |
||
3431 | return $this->createBlobSnapshotAsync( |
||
3432 | $container, |
||
3433 | $blob, |
||
3434 | $options |
||
3435 | )->wait(); |
||
3436 | } |
||
3437 | |||
3438 | /** |
||
3439 | * Creates promise to create a snapshot of a blob. |
||
3440 | * |
||
3441 | * @param string $container The name of the container. |
||
3442 | * @param string $blob The name of the blob. |
||
3443 | * @param Models\CreateBlobSnapshotOptions $options The optional parameters. |
||
3444 | * |
||
3445 | * @return \GuzzleHttp\Promise\PromiseInterface |
||
3446 | * |
||
3447 | * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee691971.aspx |
||
3448 | */ |
||
3449 | View Code Duplication | public function createBlobSnapshotAsync( |
|
3498 | |||
3499 | /** |
||
3500 | * Copies a source blob to a destination blob within the same storage account. |
||
3501 | * |
||
3502 | * @param string $destinationContainer name of the destination |
||
3503 | * container |
||
3504 | * @param string $destinationBlob name of the destination |
||
3505 | * blob |
||
3506 | * @param string $sourceContainer name of the source |
||
3507 | * container |
||
3508 | * @param string $sourceBlob name of the source |
||
3509 | * blob |
||
3510 | * @param Models\CopyBlobOptions $options optional parameters |
||
3511 | * |
||
3512 | * @return Models\CopyBlobResult |
||
3513 | * |
||
3514 | * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd894037.aspx |
||
3515 | */ |
||
3516 | public function copyBlob( |
||
3517 | $destinationContainer, |
||
3518 | $destinationBlob, |
||
3519 | $sourceContainer, |
||
3520 | $sourceBlob, |
||
3521 | Models\CopyBlobOptions $options = null |
||
3522 | ) { |
||
3523 | return $this->copyBlobAsync( |
||
3524 | $destinationContainer, |
||
3525 | $destinationBlob, |
||
3526 | $sourceContainer, |
||
3527 | $sourceBlob, |
||
3528 | $options |
||
3529 | )->wait(); |
||
3530 | } |
||
3531 | |||
3532 | /** |
||
3533 | * Creates promise to copy a source blob to a destination blob within the |
||
3534 | * same storage account. |
||
3535 | * |
||
3536 | * @param string $destinationContainer name of the destination |
||
3537 | * container |
||
3538 | * @param string $destinationBlob name of the destination |
||
3539 | * blob |
||
3540 | * @param string $sourceContainer name of the source |
||
3541 | * container |
||
3542 | * @param string $sourceBlob name of the source |
||
3543 | * blob |
||
3544 | * @param Models\CopyBlobOptions $options optional parameters |
||
3545 | * |
||
3546 | * @return \GuzzleHttp\Promise\PromiseInterface |
||
3547 | * |
||
3548 | * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd894037.aspx |
||
3549 | */ |
||
3550 | public function copyBlobAsync( |
||
3623 | |||
3624 | /** |
||
3625 | * Abort a blob copy operation |
||
3626 | * |
||
3627 | * @param string $container name of the container |
||
3628 | * @param string $blob name of the blob |
||
3629 | * @param string $copyId copy operation identifier. |
||
3630 | * @param Models\BlobServiceOptions $options optional parameters |
||
3631 | * |
||
3632 | * @return void |
||
3633 | * |
||
3634 | * @see https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/abort-copy-blob |
||
3635 | */ |
||
3636 | public function abortCopy( |
||
3649 | |||
3650 | /** |
||
3651 | * Creates promise to abort a blob copy operation |
||
3652 | * |
||
3653 | * @param string $container name of the container |
||
3654 | * @param string $blob name of the blob |
||
3655 | * @param string $copyId copy operation identifier. |
||
3656 | * @param Models\BlobServiceOptions $options optional parameters |
||
3657 | * |
||
3658 | * @return \GuzzleHttp\Promise\PromiseInterface |
||
3659 | * |
||
3660 | * @see https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/abort-copy-blob |
||
3661 | */ |
||
3662 | public function abortCopyAsync( |
||
3729 | |||
3730 | /** |
||
3731 | * Establishes an exclusive write lock on a blob. To write to a locked |
||
3732 | * blob, a client must provide a lease ID. |
||
3733 | * |
||
3734 | * @param string $container name of the container |
||
3735 | * @param string $blob name of the blob |
||
3736 | * @param string $proposedLeaseId lease id when acquiring |
||
3737 | * @param int $leaseDuration the lease duration. A non-infinite |
||
3738 | * lease can be between 15 and 60 seconds. |
||
3739 | * Default is never to expire. |
||
3740 | * @param Models\BlobServiceOptions $options optional parameters |
||
3741 | * |
||
3742 | * @return Models\LeaseResult |
||
3743 | * |
||
3744 | * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee691972.aspx |
||
3745 | */ |
||
3746 | public function acquireLease( |
||
3747 | $container, |
||
3748 | $blob, |
||
3749 | $proposedLeaseId = null, |
||
3750 | $leaseDuration = null, |
||
3751 | Models\BlobServiceOptions $options = null |
||
3752 | ) { |
||
3753 | return $this->acquireLeaseAsync( |
||
3754 | $container, |
||
3755 | $blob, |
||
3756 | $proposedLeaseId, |
||
3757 | $leaseDuration, |
||
3758 | $options |
||
3759 | )->wait(); |
||
3760 | } |
||
3761 | |||
3762 | /** |
||
3763 | * Creates promise to establish an exclusive one-minute write lock on a blob. |
||
3764 | * To write to a locked blob, a client must provide a lease ID. |
||
3765 | * |
||
3766 | * @param string $container name of the container |
||
3767 | * @param string $blob name of the blob |
||
3768 | * @param string $proposedLeaseId lease id when acquiring |
||
3769 | * @param int $leaseDuration the lease duration. A non-infinite |
||
3770 | * lease can be between 15 and 60 seconds. |
||
3771 | * Default is never to expire. |
||
3772 | * @param Models\BlobServiceOptions $options optional parameters |
||
3773 | * |
||
3774 | * @return \GuzzleHttp\Promise\PromiseInterface |
||
3775 | * |
||
3776 | * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee691972.aspx |
||
3777 | */ |
||
3778 | public function acquireLeaseAsync( |
||
3810 | |||
3811 | /** |
||
3812 | * change an existing lease |
||
3813 | * |
||
3814 | * @param string $container name of the container |
||
3815 | * @param string $blob name of the blob |
||
3816 | * @param string $leaseId lease id when acquiring |
||
3817 | * @param string $proposedLeaseId lease id when acquiring |
||
3818 | * @param Models\BlobServiceOptions $options optional parameters |
||
3819 | * |
||
3820 | * @return Models\LeaseResult |
||
3821 | * |
||
3822 | * @see https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/lease-blob |
||
3823 | */ |
||
3824 | public function changeLease( |
||
3839 | |||
3840 | /** |
||
3841 | * Creates promise to change an existing lease |
||
3842 | * |
||
3843 | * @param string $container name of the container |
||
3844 | * @param string $blob name of the blob |
||
3845 | * @param string $leaseId lease id when acquiring |
||
3846 | * @param string $proposedLeaseId the proposed lease id |
||
3847 | * @param Models\BlobServiceOptions $options optional parameters |
||
3848 | * |
||
3849 | * @return \GuzzleHttp\Promise\PromiseInterface |
||
3850 | * |
||
3851 | * @see https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/lease-blob |
||
3852 | */ |
||
3853 | View Code Duplication | public function changeLeaseAsync( |
|
3876 | |||
3877 | /** |
||
3878 | * Renews an existing lease |
||
3879 | * |
||
3880 | * @param string $container name of the container |
||
3881 | * @param string $blob name of the blob |
||
3882 | * @param string $leaseId lease id when acquiring |
||
3883 | * @param Models\BlobServiceOptions $options optional parameters |
||
3884 | * |
||
3885 | * @return Models\LeaseResult |
||
3886 | * |
||
3887 | * @see https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/lease-blob |
||
3888 | */ |
||
3889 | public function renewLease( |
||
3890 | $container, |
||
3891 | $blob, |
||
3892 | $leaseId, |
||
3893 | Models\BlobServiceOptions $options = null |
||
3894 | ) { |
||
3895 | return $this->renewLeaseAsync( |
||
3896 | $container, |
||
3897 | $blob, |
||
3898 | $leaseId, |
||
3899 | $options |
||
3900 | )->wait(); |
||
3901 | } |
||
3902 | |||
3903 | /** |
||
3904 | * Creates promise to renew an existing lease |
||
3905 | * |
||
3906 | * @param string $container name of the container |
||
3907 | * @param string $blob name of the blob |
||
3908 | * @param string $leaseId lease id when acquiring |
||
3909 | * @param Models\BlobServiceOptions $options optional parameters |
||
3910 | * |
||
3911 | * @return \GuzzleHttp\Promise\PromiseInterface |
||
3912 | * |
||
3913 | * @see https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/lease-blob |
||
3914 | */ |
||
3915 | View Code Duplication | public function renewLeaseAsync( |
|
3937 | |||
3938 | /** |
||
3939 | * Frees the lease if it is no longer needed so that another client may |
||
3940 | * immediately acquire a lease against the blob. |
||
3941 | * |
||
3942 | * @param string $container name of the container |
||
3943 | * @param string $blob name of the blob |
||
3944 | * @param string $leaseId lease id when acquiring |
||
3945 | * @param Models\BlobServiceOptions $options optional parameters |
||
3946 | * |
||
3947 | * @return void |
||
3948 | * |
||
3949 | * @see https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/lease-blob |
||
3950 | */ |
||
3951 | public function releaseLease( |
||
3952 | $container, |
||
3953 | $blob, |
||
3954 | $leaseId, |
||
3955 | Models\BlobServiceOptions $options = null |
||
3956 | ) { |
||
3957 | $this->releaseLeaseAsync($container, $blob, $leaseId, $options)->wait(); |
||
3958 | } |
||
3959 | |||
3960 | /** |
||
3961 | * Creates promise to free the lease if it is no longer needed so that |
||
3962 | * another client may immediately acquire a lease against the blob. |
||
3963 | * |
||
3964 | * @param string $container name of the container |
||
3965 | * @param string $blob name of the blob |
||
3966 | * @param string $leaseId lease id when acquiring |
||
3967 | * @param Models\BlobServiceOptions $options optional parameters |
||
3968 | * |
||
3969 | * @return \GuzzleHttp\Promise\PromiseInterface |
||
3970 | * |
||
3971 | * @see https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/lease-blob |
||
3972 | */ |
||
3973 | public function releaseLeaseAsync( |
||
3991 | |||
3992 | /** |
||
3993 | * Ends the lease but ensure that another client cannot acquire a new lease until |
||
3994 | * the current lease period has expired. |
||
3995 | * |
||
3996 | * @param string $container name of the container |
||
3997 | * @param string $blob name of the blob |
||
3998 | * @param int $breakPeriod the proposed duration of seconds that |
||
3999 | * lease should continue before it it broken, |
||
4000 | * between 0 and 60 seconds. |
||
4001 | * @param Models\BlobServiceOptions $options optional parameters |
||
4002 | * |
||
4003 | * @return BreakLeaseResult |
||
4004 | * |
||
4005 | * @see https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/lease-blob |
||
4006 | */ |
||
4007 | public function breakLease( |
||
4008 | $container, |
||
4009 | $blob, |
||
4010 | $breakPeriod = null, |
||
4011 | Models\BlobServiceOptions $options = null |
||
4012 | ) { |
||
4013 | return $this->breakLeaseAsync( |
||
4014 | $container, |
||
4015 | $blob, |
||
4016 | $options |
||
4017 | )->wait(); |
||
4018 | } |
||
4019 | |||
4020 | /** |
||
4021 | * Creates promise to end the lease but ensure that another client cannot |
||
4022 | * acquire a new lease until the current lease period has expired. |
||
4023 | * |
||
4024 | * @param string $container name of the container |
||
4025 | * @param string $blob name of the blob |
||
4026 | * @param Models\BlobServiceOptions $options optional parameters |
||
4027 | * |
||
4028 | * @return \GuzzleHttp\Promise\PromiseInterface |
||
4029 | * |
||
4030 | * @see https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/lease-blob |
||
4031 | */ |
||
4032 | View Code Duplication | public function breakLeaseAsync( |
|
4054 | |||
4055 | /** |
||
4056 | * Adds optional header to headers if set |
||
4057 | * |
||
4058 | * @param array $headers The array of request headers. |
||
4059 | * @param Models\AccessCondition $accessCondition The access condition object. |
||
4060 | * |
||
4061 | * @return array |
||
4062 | */ |
||
4063 | public function addOptionalAccessConditionHeader( |
||
4088 | |||
4089 | /** |
||
4090 | * Adds optional header to headers if set |
||
4091 | * |
||
4092 | * @param array $headers The array of request headers. |
||
4093 | * @param array $accessCondition The access condition object. |
||
4094 | * |
||
4095 | * @return array |
||
4096 | */ |
||
4097 | public function addOptionalSourceAccessConditionHeader( |
||
4140 | } |
||
4141 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.