Completed
Pull Request — master (#6779)
by Blizzz
21:23 queued 07:18
created
apps/files_sharing/lib/Collaboration/ShareRecipientSorter.php 1 patch
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -31,55 +31,55 @@
 block discarded – undo
31 31
 
32 32
 class ShareRecipientSorter implements ISorter {
33 33
 
34
-	/** @var IManager */
35
-	private $shareManager;
36
-	/** @var Folder */
37
-	private $userFolder;
34
+    /** @var IManager */
35
+    private $shareManager;
36
+    /** @var Folder */
37
+    private $userFolder;
38 38
 
39
-	public function __construct(IManager $shareManager, Folder $userFolder) {
40
-		$this->shareManager = $shareManager;
41
-		$this->userFolder = $userFolder;
42
-	}
39
+    public function __construct(IManager $shareManager, Folder $userFolder) {
40
+        $this->shareManager = $shareManager;
41
+        $this->userFolder = $userFolder;
42
+    }
43 43
 
44
-	public function getId() {
45
-		return 'share-recipients';
46
-	}
44
+    public function getId() {
45
+        return 'share-recipients';
46
+    }
47 47
 
48
-	public function sort(array &$sortArray, array $context) {
49
-		// let's be tolerant. Comments  uses "files" by default, other usages are often singular
50
-		if($context['itemType'] !== 'files' && $context['itemType'] !== 'file') {
51
-			return;
52
-		}
53
-		/** @var Node[] $nodes */
54
-		$nodes = $this->userFolder->getById((int)$context['itemId']);
55
-		if(count($nodes) === 0) {
56
-			return;
57
-		}
58
-		$al = $this->shareManager->getAccessList($nodes[0]);
48
+    public function sort(array &$sortArray, array $context) {
49
+        // let's be tolerant. Comments  uses "files" by default, other usages are often singular
50
+        if($context['itemType'] !== 'files' && $context['itemType'] !== 'file') {
51
+            return;
52
+        }
53
+        /** @var Node[] $nodes */
54
+        $nodes = $this->userFolder->getById((int)$context['itemId']);
55
+        if(count($nodes) === 0) {
56
+            return;
57
+        }
58
+        $al = $this->shareManager->getAccessList($nodes[0]);
59 59
 
60
-		foreach ($sortArray as $type => &$byType) {
61
-			if(!isset($al[$type]) || !is_array($al[$type])) {
62
-				continue;
63
-			}
64
-			usort($byType, function ($a, $b) use ($al, $type) {
65
-				return  $this->compare($a, $b, $al[$type]);
66
-			});
67
-		}
68
-	}
60
+        foreach ($sortArray as $type => &$byType) {
61
+            if(!isset($al[$type]) || !is_array($al[$type])) {
62
+                continue;
63
+            }
64
+            usort($byType, function ($a, $b) use ($al, $type) {
65
+                return  $this->compare($a, $b, $al[$type]);
66
+            });
67
+        }
68
+    }
69 69
 
70
-	/**
71
-	 * @param array $a
72
-	 * @param array $b
73
-	 * @param array $al
74
-	 * @return int
75
-	 */
76
-	protected function compare(array $a, array $b, array $al) {
77
-		$a = $a['value']['shareWith'];
78
-		$b = $b['value']['shareWith'];
70
+    /**
71
+     * @param array $a
72
+     * @param array $b
73
+     * @param array $al
74
+     * @return int
75
+     */
76
+    protected function compare(array $a, array $b, array $al) {
77
+        $a = $a['value']['shareWith'];
78
+        $b = $b['value']['shareWith'];
79 79
 
80
-		$valueA = (int)in_array($a, $al, true);
81
-		$valueB = (int)in_array($b, $al, true);
80
+        $valueA = (int)in_array($a, $al, true);
81
+        $valueB = (int)in_array($b, $al, true);
82 82
 
83
-		return $valueB - $valueA;
84
-	}
83
+        return $valueB - $valueA;
84
+    }
85 85
 }
Please login to merge, or discard this patch.
lib/public/Collaboration/AutoComplete/ISorter.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -33,18 +33,18 @@
 block discarded – undo
33 33
  */
34 34
 interface ISorter {
35 35
 
36
-	/**
37
-	 * @return string The ID of the sorter, e.g. commenters
38
-	 * @since 13.0.0
39
-	 */
40
-	public function getId();
36
+    /**
37
+     * @return string The ID of the sorter, e.g. commenters
38
+     * @since 13.0.0
39
+     */
40
+    public function getId();
41 41
 
42
-	/**
43
-	 * executes the sort action
44
-	 *
45
-	 * @param array $sortArray the array to be sorted, provided as reference
46
-	 * @param array $context carries key 'itemType' and 'itemId' of the source object (e.g. a file)
47
-	 * @since 13.0.0
48
-	 */
49
-	public function sort(array &$sortArray, array $context);
42
+    /**
43
+     * executes the sort action
44
+     *
45
+     * @param array $sortArray the array to be sorted, provided as reference
46
+     * @param array $context carries key 'itemType' and 'itemId' of the source object (e.g. a file)
47
+     * @since 13.0.0
48
+     */
49
+    public function sort(array &$sortArray, array $context);
50 50
 }
Please login to merge, or discard this patch.