Code Duplication    Length = 49-55 lines in 3 locations

web/ckfinder/core/connector/php/vendor/microsoft/azure-storage/src/Blob/BlobRestProxy.php 3 locations

@@ 2754-2808 (lines=55) @@
2751
     *
2752
     * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179350.aspx
2753
     */
2754
    public function getBlobMetadataAsync(
2755
        $container,
2756
        $blob,
2757
        Models\GetBlobMetadataOptions $options = null
2758
    ) {
2759
        Validate::isString($container, 'container');
2760
        Validate::isString($blob, 'blob');
2761
        Validate::notNullOrEmpty($blob, 'blob');
2762
        
2763
        $method      = Resources::HTTP_HEAD;
2764
        $headers     = array();
2765
        $postParams  = array();
2766
        $queryParams = array();
2767
        $path        = $this->_createPath($container, $blob);
2768
        
2769
        if (is_null($options)) {
2770
            $options = new GetBlobMetadataOptions();
2771
        }
2772
        
2773
        $headers = $this->addOptionalAccessConditionHeader(
2774
            $headers,
2775
            $options->getAccessConditions()
2776
        );
2777
        
2778
        $this->addOptionalHeader(
2779
            $headers,
2780
            Resources::X_MS_LEASE_ID,
2781
            $options->getLeaseId()
2782
        );
2783
        $this->addOptionalQueryParam(
2784
            $queryParams,
2785
            Resources::QP_SNAPSHOT,
2786
            $options->getSnapshot()
2787
        );
2788
2789
        $this->addOptionalQueryParam(
2790
            $queryParams,
2791
            Resources::QP_COMP,
2792
            'metadata'
2793
        );
2794
        
2795
        return $this->sendAsync(
2796
            $method,
2797
            $headers,
2798
            $queryParams,
2799
            $postParams,
2800
            $path,
2801
            Resources::STATUS_OK,
2802
            Resources::EMPTY_STRING,
2803
            $options
2804
        )->then(function ($response) {
2805
            $responseHeaders = HttpFormatter::formatHeaders($response->getHeaders());
2806
            return GetBlobMetadataResult::create($responseHeaders);
2807
        });
2808
    }
2809
    
2810
    /**
2811
     * Returns a list of active page ranges for a page blob. Active page ranges are
@@ 3090-3144 (lines=55) @@
3087
     *
3088
     * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179414.aspx
3089
     */
3090
    public function setBlobMetadataAsync(
3091
        $container,
3092
        $blob,
3093
        array $metadata,
3094
        Models\BlobServiceOptions $options = null
3095
    ) {
3096
        Validate::isString($container, 'container');
3097
        Validate::isString($blob, 'blob');
3098
        Validate::notNullOrEmpty($blob, 'blob');
3099
        Utilities::validateMetadata($metadata);
3100
        
3101
        $method      = Resources::HTTP_PUT;
3102
        $headers     = array();
3103
        $postParams  = array();
3104
        $queryParams = array();
3105
        $path        = $this->_createPath($container, $blob);
3106
        
3107
        if (is_null($options)) {
3108
            $options = new BlobServiceOptions();
3109
        }
3110
        
3111
        $headers = $this->addOptionalAccessConditionHeader(
3112
            $headers,
3113
            $options->getAccessConditions()
3114
        );
3115
        $headers = $this->addMetadataHeaders($headers, $metadata);
3116
        
3117
        $this->addOptionalHeader(
3118
            $headers,
3119
            Resources::X_MS_LEASE_ID,
3120
            $options->getLeaseId()
3121
        );
3122
        $this->addOptionalQueryParam(
3123
            $queryParams,
3124
            Resources::QP_COMP,
3125
            'metadata'
3126
        );
3127
        
3128
        $options->setLocationMode(LocationMode::PRIMARY_ONLY);
3129
3130
        return $this->sendAsync(
3131
            $method,
3132
            $headers,
3133
            $queryParams,
3134
            $postParams,
3135
            $path,
3136
            Resources::STATUS_OK,
3137
            Resources::EMPTY_STRING,
3138
            $options
3139
        )->then(function ($response) {
3140
            return SetBlobMetadataResult::create(
3141
                HttpFormatter::formatHeaders($response->getHeaders())
3142
            );
3143
        }, null);
3144
    }
3145
3146
    /**
3147
     * Downloads a blob to a file, the result contains its metadata and
@@ 3449-3497 (lines=49) @@
3446
     *
3447
     * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee691971.aspx
3448
     */
3449
    public function createBlobSnapshotAsync(
3450
        $container,
3451
        $blob,
3452
        Models\CreateBlobSnapshotOptions $options = null
3453
    ) {
3454
        Validate::isString($container, 'container');
3455
        Validate::isString($blob, 'blob');
3456
        Validate::notNullOrEmpty($blob, 'blob');
3457
        
3458
        $method             = Resources::HTTP_PUT;
3459
        $headers            = array();
3460
        $postParams         = array();
3461
        $queryParams        = array();
3462
        $path               = $this->_createPath($container, $blob);
3463
        
3464
        if (is_null($options)) {
3465
            $options = new CreateBlobSnapshotOptions();
3466
        }
3467
        
3468
        $queryParams[Resources::QP_COMP] = 'snapshot';
3469
3470
        $headers = $this->addOptionalAccessConditionHeader(
3471
            $headers,
3472
            $options->getAccessConditions()
3473
        );
3474
        $headers = $this->addMetadataHeaders($headers, $options->getMetadata());
3475
        $this->addOptionalHeader(
3476
            $headers,
3477
            Resources::X_MS_LEASE_ID,
3478
            $options->getLeaseId()
3479
        );
3480
        
3481
        $options->setLocationMode(LocationMode::PRIMARY_ONLY);
3482
3483
        return $this->sendAsync(
3484
            $method,
3485
            $headers,
3486
            $queryParams,
3487
            $postParams,
3488
            $path,
3489
            Resources::STATUS_CREATED,
3490
            Resources::EMPTY_STRING,
3491
            $options
3492
        )->then(function ($response) {
3493
            return CreateBlobSnapshotResult::create(
3494
                HttpFormatter::formatHeaders($response->getHeaders())
3495
            );
3496
        }, null);
3497
    }
3498
    
3499
    /**
3500
     * Copies a source blob to a destination blob within the same storage account.