Completed
Pull Request — master (#8112)
by Morris
31:15 queued 15:12
created
apps/dav/lib/Upload/ChunkingPlugin.php 2 patches
Indentation   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -28,80 +28,80 @@
 block discarded – undo
28 28
 
29 29
 class ChunkingPlugin extends ServerPlugin {
30 30
 
31
-	/** @var Server */
32
-	private $server;
33
-	/** @var FutureFile */
34
-	private $sourceNode;
31
+    /** @var Server */
32
+    private $server;
33
+    /** @var FutureFile */
34
+    private $sourceNode;
35 35
 
36
-	/**
37
-	 * @inheritdoc
38
-	 */
39
-	function initialize(Server $server) {
40
-		$server->on('beforeMove', [$this, 'beforeMove']);
41
-		$this->server = $server;
42
-	}
36
+    /**
37
+     * @inheritdoc
38
+     */
39
+    function initialize(Server $server) {
40
+        $server->on('beforeMove', [$this, 'beforeMove']);
41
+        $this->server = $server;
42
+    }
43 43
 
44
-	/**
45
-	 * @param string $sourcePath source path
46
-	 * @param string $destination destination path
47
-	 */
48
-	function beforeMove($sourcePath, $destination) {
49
-		$this->sourceNode = $this->server->tree->getNodeForPath($sourcePath);
50
-		if (!$this->sourceNode instanceof FutureFile) {
51
-			// skip handling as the source is not a chunked FutureFile
52
-			return;
53
-		}
44
+    /**
45
+     * @param string $sourcePath source path
46
+     * @param string $destination destination path
47
+     */
48
+    function beforeMove($sourcePath, $destination) {
49
+        $this->sourceNode = $this->server->tree->getNodeForPath($sourcePath);
50
+        if (!$this->sourceNode instanceof FutureFile) {
51
+            // skip handling as the source is not a chunked FutureFile
52
+            return;
53
+        }
54 54
 
55
-		$this->verifySize();
56
-		return $this->performMove($sourcePath, $destination);
57
-	}
55
+        $this->verifySize();
56
+        return $this->performMove($sourcePath, $destination);
57
+    }
58 58
 
59
-	/**
60
-	 * Move handler for future file.
61
-	 *
62
-	 * This overrides the default move behavior to prevent Sabre
63
-	 * to delete the target file before moving. Because deleting would
64
-	 * lose the file id and metadata.
65
-	 *
66
-	 * @param string $path source path
67
-	 * @param string $destination destination path
68
-	 * @return bool|void false to stop handling, void to skip this handler
69
-	 */
70
-	public function performMove($path, $destination) {
71
-		if (!$this->server->tree->nodeExists($destination)) {
72
-			// skip and let the default handler do its work
73
-			return;
74
-		}
59
+    /**
60
+     * Move handler for future file.
61
+     *
62
+     * This overrides the default move behavior to prevent Sabre
63
+     * to delete the target file before moving. Because deleting would
64
+     * lose the file id and metadata.
65
+     *
66
+     * @param string $path source path
67
+     * @param string $destination destination path
68
+     * @return bool|void false to stop handling, void to skip this handler
69
+     */
70
+    public function performMove($path, $destination) {
71
+        if (!$this->server->tree->nodeExists($destination)) {
72
+            // skip and let the default handler do its work
73
+            return;
74
+        }
75 75
 
76
-		// do a move manually, skipping Sabre's default "delete" for existing nodes
77
-		$this->server->tree->move($path, $destination);
76
+        // do a move manually, skipping Sabre's default "delete" for existing nodes
77
+        $this->server->tree->move($path, $destination);
78 78
 
79
-		// trigger all default events (copied from CorePlugin::move)
80
-		$this->server->emit('afterMove', [$path, $destination]);
81
-		$this->server->emit('afterUnbind', [$path]);
82
-		$this->server->emit('afterBind', [$destination]);
79
+        // trigger all default events (copied from CorePlugin::move)
80
+        $this->server->emit('afterMove', [$path, $destination]);
81
+        $this->server->emit('afterUnbind', [$path]);
82
+        $this->server->emit('afterBind', [$destination]);
83 83
 
84
-		$response = $this->server->httpResponse;
85
-		$response->setHeader('Content-Length', '0');
86
-		$response->setStatus(204);
84
+        $response = $this->server->httpResponse;
85
+        $response->setHeader('Content-Length', '0');
86
+        $response->setStatus(204);
87 87
 
88
-		return false;
89
-	}
88
+        return false;
89
+    }
90 90
 
91
-	/**
92
-	 * @throws BadRequest
93
-	 */
94
-	private function verifySize() {
95
-		$expectedSize = $this->server->httpRequest->getHeader('OC-Total-Length');
96
-		if ($expectedSize === null) {
97
-			return;
98
-		}
99
-		$actualSize = $this->sourceNode->getSize();
91
+    /**
92
+     * @throws BadRequest
93
+     */
94
+    private function verifySize() {
95
+        $expectedSize = $this->server->httpRequest->getHeader('OC-Total-Length');
96
+        if ($expectedSize === null) {
97
+            return;
98
+        }
99
+        $actualSize = $this->sourceNode->getSize();
100 100
 
101
-		// casted to string because cast to float cause equality for non equal numbers
102
-		// and integer has the problem of limited size on 32 bit systems
103
-		if ((string)$expectedSize !== (string)$actualSize) {
104
-			throw new BadRequest("Chunks on server do not sum up to $expectedSize but to $actualSize bytes");
105
-		}
106
-	}
101
+        // casted to string because cast to float cause equality for non equal numbers
102
+        // and integer has the problem of limited size on 32 bit systems
103
+        if ((string)$expectedSize !== (string)$actualSize) {
104
+            throw new BadRequest("Chunks on server do not sum up to $expectedSize but to $actualSize bytes");
105
+        }
106
+    }
107 107
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@
 block discarded – undo
100 100
 
101 101
 		// casted to string because cast to float cause equality for non equal numbers
102 102
 		// and integer has the problem of limited size on 32 bit systems
103
-		if ((string)$expectedSize !== (string)$actualSize) {
103
+		if ((string) $expectedSize !== (string) $actualSize) {
104 104
 			throw new BadRequest("Chunks on server do not sum up to $expectedSize but to $actualSize bytes");
105 105
 		}
106 106
 	}
Please login to merge, or discard this patch.