Code Duplication    Length = 42-48 lines in 2 locations

web/ckfinder/core/connector/php/vendor/microsoft/azure-storage/src/File/FileRestProxy.php 2 locations

@@ 477-518 (lines=42) @@
474
     *
475
     * @see https://docs.microsoft.com/en-us/rest/api/storageservices/create-share
476
     */
477
    public function createShareAsync(
478
        $share,
479
        CreateShareOptions $options = null
480
    ) {
481
        Validate::isString($share, 'share');
482
        Validate::notNullOrEmpty($share, 'share');
483
        
484
        $method      = Resources::HTTP_PUT;
485
        $headers     = array();
486
        $postParams  = array();
487
        $queryParams = array(Resources::QP_REST_TYPE => 'share');
488
        $path        = $this->createPath($share);
489
        
490
        if (is_null($options)) {
491
            $options = new CreateShareOptions();
492
        }
493
494
        $metadata = $options->getMetadata();
495
        $headers  = $this->generateMetadataHeaders($metadata);
496
        $this->addOptionalHeader(
497
            $headers,
498
            Resources::X_MS_SHARE_QUOTA,
499
            $options->getQuota()
500
        );
501
502
        $this->addOptionalQueryParam(
503
            $queryParams,
504
            Resources::QP_TIMEOUT,
505
            $options->getTimeout()
506
        );
507
508
        return $this->sendAsync(
509
            $method,
510
            $headers,
511
            $queryParams,
512
            $postParams,
513
            $path,
514
            Resources::STATUS_CREATED,
515
            Resources::EMPTY_STRING,
516
            $options
517
        );
518
    }
519
520
    /**
521
     * Deletes a share in the given storage account.
@@ 943-990 (lines=48) @@
940
     *
941
     * @see https://docs.microsoft.com/en-us/rest/api/storageservices/get-share-stats
942
     */
943
    public function getShareStatsAsync($share, FileServiceOptions $options = null)
944
    {
945
        Validate::isString($share, 'share');
946
        
947
        $method      = Resources::HTTP_GET;
948
        $headers     = array();
949
        $queryParams = array();
950
        $postParams  = array();
951
        $path        = $this->createPath($share);
952
        
953
        if (is_null($options)) {
954
            $options = new FileServiceOptions();
955
        }
956
        
957
        $this->addOptionalQueryParam(
958
            $queryParams,
959
            Resources::QP_REST_TYPE,
960
            'share'
961
        );
962
963
        $this->addOptionalQueryParam(
964
            $queryParams,
965
            Resources::QP_COMP,
966
            'stats'
967
        );
968
969
        $this->addOptionalQueryParam(
970
            $queryParams,
971
            Resources::QP_TIMEOUT,
972
            $options->getTimeout()
973
        );
974
975
        $dataSerializer = $this->dataSerializer;
976
977
        return $this->sendAsync(
978
            $method,
979
            $headers,
980
            $queryParams,
981
            $postParams,
982
            $path,
983
            Resources::STATUS_OK,
984
            Resources::EMPTY_STRING,
985
            $options
986
        )->then(function ($response) use ($dataSerializer) {
987
            $parsed = $dataSerializer->unserialize($response->getBody());
988
            return GetShareStatsResult::create($parsed);
989
        }, null);
990
    }
991
992
    /**
993
     * List directories and files under specified path.