Completed
Pull Request — master (#9483)
by Robin
110:59 queued 88:14
created
lib/private/Files/ObjectStore/Azure.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -59,9 +59,9 @@  discard block
 block discarded – undo
59 59
 	private function getBlobClient() {
60 60
 		if (!$this->blobClient) {
61 61
 			$protocol = $this->endpoint ? substr($this->endpoint, 0, strpos($this->endpoint, ':')) : 'https';
62
-			$connectionString = "DefaultEndpointsProtocol=" . $protocol . ";AccountName=" . $this->accountName . ";AccountKey=" . $this->accountKey;
62
+			$connectionString = "DefaultEndpointsProtocol=".$protocol.";AccountName=".$this->accountName.";AccountKey=".$this->accountKey;
63 63
 			if ($this->endpoint) {
64
-				$connectionString .= ';BlobEndpoint=' . $this->endpoint;
64
+				$connectionString .= ';BlobEndpoint='.$this->endpoint;
65 65
 			}
66 66
 			$this->blobClient = BlobRestProxy::createBlobService($connectionString);
67 67
 
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 	 * @return string the container or bucket name where objects are stored
77 77
 	 */
78 78
 	public function getStorageId() {
79
-		return 'azure::blob::' . $this->containerName;
79
+		return 'azure::blob::'.$this->containerName;
80 80
 	}
81 81
 
82 82
 	/**
Please login to merge, or discard this patch.
Indentation   +82 added lines, -82 removed lines patch added patch discarded remove patch
@@ -26,93 +26,93 @@
 block discarded – undo
26 26
 use OCP\Files\ObjectStore\IObjectStore;
27 27
 
28 28
 class Azure implements IObjectStore {
29
-	/** @var string */
30
-	private $containerName;
31
-	/** @var string */
32
-	private $accountName;
33
-	/** @var string */
34
-	private $accountKey;
35
-	/** @var BlobRestProxy|null */
36
-	private $blobClient = null;
37
-	/** @var string|null */
38
-	private $endpoint = null;
39
-	/** @var bool  */
40
-	private $autoCreate = false;
29
+    /** @var string */
30
+    private $containerName;
31
+    /** @var string */
32
+    private $accountName;
33
+    /** @var string */
34
+    private $accountKey;
35
+    /** @var BlobRestProxy|null */
36
+    private $blobClient = null;
37
+    /** @var string|null */
38
+    private $endpoint = null;
39
+    /** @var bool  */
40
+    private $autoCreate = false;
41 41
 
42
-	/**
43
-	 * @param array $parameters
44
-	 */
45
-	public function __construct($parameters) {
46
-		$this->containerName = $parameters['container'];
47
-		$this->accountName = $parameters['account_name'];
48
-		$this->accountKey = $parameters['account_key'];
49
-		if (isset($parameters['endpoint'])) {
50
-			$this->endpoint = $parameters['endpoint'];
51
-		}
52
-		if (isset($parameters['autocreate'])) {
53
-			$this->autoCreate = $parameters['autocreate'];
54
-		}
55
-	}
42
+    /**
43
+     * @param array $parameters
44
+     */
45
+    public function __construct($parameters) {
46
+        $this->containerName = $parameters['container'];
47
+        $this->accountName = $parameters['account_name'];
48
+        $this->accountKey = $parameters['account_key'];
49
+        if (isset($parameters['endpoint'])) {
50
+            $this->endpoint = $parameters['endpoint'];
51
+        }
52
+        if (isset($parameters['autocreate'])) {
53
+            $this->autoCreate = $parameters['autocreate'];
54
+        }
55
+    }
56 56
 
57
-	/**
58
-	 * @return BlobRestProxy
59
-	 */
60
-	private function getBlobClient() {
61
-		if (!$this->blobClient) {
62
-			$protocol = $this->endpoint ? substr($this->endpoint, 0, strpos($this->endpoint, ':')) : 'https';
63
-			$connectionString = "DefaultEndpointsProtocol=" . $protocol . ";AccountName=" . $this->accountName . ";AccountKey=" . $this->accountKey;
64
-			if ($this->endpoint) {
65
-				$connectionString .= ';BlobEndpoint=' . $this->endpoint;
66
-			}
67
-			$this->blobClient = BlobRestProxy::createBlobService($connectionString);
57
+    /**
58
+     * @return BlobRestProxy
59
+     */
60
+    private function getBlobClient() {
61
+        if (!$this->blobClient) {
62
+            $protocol = $this->endpoint ? substr($this->endpoint, 0, strpos($this->endpoint, ':')) : 'https';
63
+            $connectionString = "DefaultEndpointsProtocol=" . $protocol . ";AccountName=" . $this->accountName . ";AccountKey=" . $this->accountKey;
64
+            if ($this->endpoint) {
65
+                $connectionString .= ';BlobEndpoint=' . $this->endpoint;
66
+            }
67
+            $this->blobClient = BlobRestProxy::createBlobService($connectionString);
68 68
 
69
-			if ($this->autoCreate) {
70
-				try {
71
-					$this->blobClient->createContainer($this->containerName);
72
-				} catch (ServiceException $e) {
73
-					if ($e->getCode() === 409) {
74
-						// already exists
75
-					} else {
76
-						throw $e;
77
-					}
78
-				}
79
-			}
80
-		}
81
-		return $this->blobClient;
82
-	}
69
+            if ($this->autoCreate) {
70
+                try {
71
+                    $this->blobClient->createContainer($this->containerName);
72
+                } catch (ServiceException $e) {
73
+                    if ($e->getCode() === 409) {
74
+                        // already exists
75
+                    } else {
76
+                        throw $e;
77
+                    }
78
+                }
79
+            }
80
+        }
81
+        return $this->blobClient;
82
+    }
83 83
 
84
-	/**
85
-	 * @return string the container or bucket name where objects are stored
86
-	 */
87
-	public function getStorageId() {
88
-		return 'azure::blob::' . $this->containerName;
89
-	}
84
+    /**
85
+     * @return string the container or bucket name where objects are stored
86
+     */
87
+    public function getStorageId() {
88
+        return 'azure::blob::' . $this->containerName;
89
+    }
90 90
 
91
-	/**
92
-	 * @param string $urn the unified resource name used to identify the object
93
-	 * @return resource stream with the read data
94
-	 * @throws \Exception when something goes wrong, message will be logged
95
-	 */
96
-	public function readObject($urn) {
97
-		$blob = $this->getBlobClient()->getBlob($this->containerName, $urn);
98
-		return $blob->getContentStream();
99
-	}
91
+    /**
92
+     * @param string $urn the unified resource name used to identify the object
93
+     * @return resource stream with the read data
94
+     * @throws \Exception when something goes wrong, message will be logged
95
+     */
96
+    public function readObject($urn) {
97
+        $blob = $this->getBlobClient()->getBlob($this->containerName, $urn);
98
+        return $blob->getContentStream();
99
+    }
100 100
 
101
-	/**
102
-	 * @param string $urn the unified resource name used to identify the object
103
-	 * @param resource $stream stream with the data to write
104
-	 * @throws \Exception when something goes wrong, message will be logged
105
-	 */
106
-	public function writeObject($urn, $stream) {
107
-		$this->getBlobClient()->createBlockBlob($this->containerName, $urn, $stream);
108
-	}
101
+    /**
102
+     * @param string $urn the unified resource name used to identify the object
103
+     * @param resource $stream stream with the data to write
104
+     * @throws \Exception when something goes wrong, message will be logged
105
+     */
106
+    public function writeObject($urn, $stream) {
107
+        $this->getBlobClient()->createBlockBlob($this->containerName, $urn, $stream);
108
+    }
109 109
 
110
-	/**
111
-	 * @param string $urn the unified resource name used to identify the object
112
-	 * @return void
113
-	 * @throws \Exception when something goes wrong, message will be logged
114
-	 */
115
-	public function deleteObject($urn) {
116
-		$this->getBlobClient()->deleteBlob($this->containerName, $urn);
117
-	}
110
+    /**
111
+     * @param string $urn the unified resource name used to identify the object
112
+     * @return void
113
+     * @throws \Exception when something goes wrong, message will be logged
114
+     */
115
+    public function deleteObject($urn) {
116
+        $this->getBlobClient()->deleteBlob($this->containerName, $urn);
117
+    }
118 118
 }
Please login to merge, or discard this patch.