PluginProbe
WPIDE – File Manager & Code Editor / 3.4.1
WPIDE – File Manager & Code Editor v3.4.1
3.5.9 3.5.8 3.5.7 2.0.14 2.0.15 2.0.16 2.0.2 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.1 2.2 2.3 2.3.1 2.3.2 2.4.0 2.5 2.6 3.0 3.1 3.2 3.3 All 55 releases
← All changes | App/Utils/Collection.php +5 -13 3.5.93.4.1 View file →
@@ -1,10 +1,8 @@
1 1 <?php
2 2
3 3 namespace WPIDE\App\Utils;
4 4
5 -use WPIDE\App\Services\Storage\DirectoryCollection;
6 -
7 5 trait Collection
8 6 {
9 7 protected $items = [];
10 8
@@ -43,9 +41,9 @@
43 41 {
44 42 return $this->items;
45 43 }
46 44
47 - public function filter(callable $callback): DirectoryCollection
45 + public function filter(callable $callback)
48 46 {
49 47 $this->items = array_filter($this->items, $callback);
50 48
51 49 return $this;
@@ -50,9 +48,9 @@
50 48
51 49 return $this;
52 50 }
53 51
54 - public function map(callable $callback): DirectoryCollection
52 + public function map(callable $callback)
55 53 {
56 54 $this->items = array_map($callback, $this->items);
57 55
58 56 return $this;
@@ -57,23 +55,17 @@
57 55
58 56 return $this;
59 57 }
60 58
61 - public function merge($collection): DirectoryCollection
62 - {
59 + public function merge($collection) {
63 60
64 61 $this->items = array_merge($this->items, $collection->items);
65 -
66 - return $this;
67 62 }
68 63
69 - public function sortByValue($value, $desc = false): DirectoryCollection
64 + public function sortByValue($value, $desc = false)
70 65 {
71 -
72 66 usort($this->items, function ($a, $b) use ($value) {
73 - return
74 - ($a['type'] <=> $b['type']) * 1000 +
75 - ($a[$value] <=> $b[$value]);
67 + return $a[$value] <=> $b[$value];
76 68 });
77 69
78 70 if ($desc) {
79 71 $this->items = array_reverse($this->items);