Completed
Pull Request — master (#5745)
by Pauli
15:29
created
lib/private/Share20/LegacyHooks.php 1 patch
Indentation   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -27,74 +27,74 @@
 block discarded – undo
27 27
 use Symfony\Component\EventDispatcher\GenericEvent;
28 28
 
29 29
 class LegacyHooks {
30
-	/** @var EventDispatcher */
31
-	private $eventDispatcher;
30
+    /** @var EventDispatcher */
31
+    private $eventDispatcher;
32 32
 
33
-	/**
34
-	 * LegacyHooks constructor.
35
-	 *
36
-	 * @param EventDispatcher $eventDispatcher
37
-	 */
38
-	public function __construct(EventDispatcher $eventDispatcher) {
39
-		$this->eventDispatcher = $eventDispatcher;
33
+    /**
34
+     * LegacyHooks constructor.
35
+     *
36
+     * @param EventDispatcher $eventDispatcher
37
+     */
38
+    public function __construct(EventDispatcher $eventDispatcher) {
39
+        $this->eventDispatcher = $eventDispatcher;
40 40
 
41
-		$this->eventDispatcher->addListener('OCP\Share::preUnshare', [$this, 'preUnshare']);
42
-		$this->eventDispatcher->addListener('OCP\Share::postUnshare', [$this, 'postUnshare']);
43
-	}
41
+        $this->eventDispatcher->addListener('OCP\Share::preUnshare', [$this, 'preUnshare']);
42
+        $this->eventDispatcher->addListener('OCP\Share::postUnshare', [$this, 'postUnshare']);
43
+    }
44 44
 
45
-	/**
46
-	 * @param GenericEvent $e
47
-	 */
48
-	public function preUnshare(GenericEvent $e) {
49
-		/** @var IShare $share */
50
-		$share = $e->getSubject();
45
+    /**
46
+     * @param GenericEvent $e
47
+     */
48
+    public function preUnshare(GenericEvent $e) {
49
+        /** @var IShare $share */
50
+        $share = $e->getSubject();
51 51
 
52
-		$formatted = $this->formatHookParams($share);
53
-		\OC_Hook::emit('OCP\Share', 'pre_unshare', $formatted);
54
-	}
52
+        $formatted = $this->formatHookParams($share);
53
+        \OC_Hook::emit('OCP\Share', 'pre_unshare', $formatted);
54
+    }
55 55
 
56
-	/**
57
-	 * @param GenericEvent $e
58
-	 */
59
-	public function postUnshare(GenericEvent $e) {
60
-		/** @var IShare $share */
61
-		$share = $e->getSubject();
56
+    /**
57
+     * @param GenericEvent $e
58
+     */
59
+    public function postUnshare(GenericEvent $e) {
60
+        /** @var IShare $share */
61
+        $share = $e->getSubject();
62 62
 
63
-		$formatted = $this->formatHookParams($share);
63
+        $formatted = $this->formatHookParams($share);
64 64
 
65
-		/** @var IShare[] $deletedShares */
66
-		$deletedShares = $e->getArgument('deletedShares');
65
+        /** @var IShare[] $deletedShares */
66
+        $deletedShares = $e->getArgument('deletedShares');
67 67
 
68
-		$formattedDeletedShares = array_map(function($share) {
69
-			return $this->formatHookParams($share);
70
-		}, $deletedShares);
68
+        $formattedDeletedShares = array_map(function($share) {
69
+            return $this->formatHookParams($share);
70
+        }, $deletedShares);
71 71
 
72
-		$formatted['deletedShares'] = $formattedDeletedShares;
72
+        $formatted['deletedShares'] = $formattedDeletedShares;
73 73
 
74
-		\OC_Hook::emit('OCP\Share', 'post_unshare', $formatted);
75
-	}
74
+        \OC_Hook::emit('OCP\Share', 'post_unshare', $formatted);
75
+    }
76 76
 
77
-	private function formatHookParams(IShare $share) {
78
-		// Prepare hook
79
-		$shareType = $share->getShareType();
80
-		$sharedWith = '';
81
-		if ($shareType === \OCP\Share::SHARE_TYPE_USER ||
82
-			$shareType === \OCP\Share::SHARE_TYPE_GROUP ||
83
-			$shareType === \OCP\Share::SHARE_TYPE_REMOTE) {
84
-			$sharedWith = $share->getSharedWith();
85
-		}
77
+    private function formatHookParams(IShare $share) {
78
+        // Prepare hook
79
+        $shareType = $share->getShareType();
80
+        $sharedWith = '';
81
+        if ($shareType === \OCP\Share::SHARE_TYPE_USER ||
82
+            $shareType === \OCP\Share::SHARE_TYPE_GROUP ||
83
+            $shareType === \OCP\Share::SHARE_TYPE_REMOTE) {
84
+            $sharedWith = $share->getSharedWith();
85
+        }
86 86
 
87
-		$hookParams = [
88
-			'id' => $share->getId(),
89
-			'itemType' => $share->getNodeType(),
90
-			'itemSource' => $share->getNodeId(),
91
-			'shareType' => $shareType,
92
-			'shareWith' => $sharedWith,
93
-			'itemparent' => method_exists($share, 'getParent') ? $share->getParent() : '',
94
-			'uidOwner' => $share->getSharedBy(),
95
-			'fileSource' => $share->getNodeId(),
96
-			'fileTarget' => $share->getTarget()
97
-		];
98
-		return $hookParams;
99
-	}
87
+        $hookParams = [
88
+            'id' => $share->getId(),
89
+            'itemType' => $share->getNodeType(),
90
+            'itemSource' => $share->getNodeId(),
91
+            'shareType' => $shareType,
92
+            'shareWith' => $sharedWith,
93
+            'itemparent' => method_exists($share, 'getParent') ? $share->getParent() : '',
94
+            'uidOwner' => $share->getSharedBy(),
95
+            'fileSource' => $share->getNodeId(),
96
+            'fileTarget' => $share->getTarget()
97
+        ];
98
+        return $hookParams;
99
+    }
100 100
 }
Please login to merge, or discard this patch.