Skip to content

Commit 3736697

Browse files
Merge pull request #34 from TheDragonCode/2.x
Fixed method name after upgrading
2 parents b558fd8 + c20cdec commit 3736697

4 files changed

Lines changed: 21 additions & 21 deletions

File tree

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ return new Sorter([
5050
'XXS',
5151
'2',
5252
'54',
53-
])->sort1();
53+
])->sort();
5454

5555
/*
5656
* Returns:
@@ -76,7 +76,7 @@ $items = Size::query()->get();
7676

7777
return new Sorter($items)
7878
->column('title')
79-
->sort1();
79+
->sort();
8080
```
8181

8282
```php
@@ -86,7 +86,7 @@ use DragonCode\SizeSorter\Sorter;
8686
$items = collect([...]);
8787

8888
return new Sorter($items)
89-
->sort1();
89+
->sort();
9090

9191
/*
9292
* Returns:
@@ -115,7 +115,7 @@ use DragonCode\SizeSorter\Sorter;
115115

116116
return new Sorter($items)
117117
->groupsOrder([3, 5, 4, 2, 1])
118-
->sort1();
118+
->sort();
119119

120120
// or
121121

@@ -127,7 +127,7 @@ return new Sorter($items)
127127
Group::ClothesAndShoes,
128128
Group::LetterClothingSize,
129129
])
130-
->sort1();
130+
->sort();
131131
```
132132

133133
The final array will be formed in the specified order:
@@ -144,13 +144,13 @@ use DragonCode\SizeSorter\Sorter;
144144

145145
return new Sorter($items)
146146
->groupsOrder([3, 5])
147-
->sort1();
147+
->sort();
148148

149149
// or
150150

151151
return new Sorter($items)
152152
->groupsOrder([Group::BraSize, Group::OtherSizes])
153-
->sort1();
153+
->sort();
154154
```
155155

156156
In this case, the first two logical groups will be sorted in the specified order, and the subsequent ones will be in

src/Sorter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function groupsOrder(?array $order): static
4040
return $this;
4141
}
4242

43-
public function sort1(): iterable
43+
public function sort(): iterable
4444
{
4545
return MainLogic::sort($this->items, $this->column, $this->groupsOrder);
4646
}

tests/Sorters/SortTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public function testArray(?array $order, array $expected): void
1616
{
1717
$actual = Sorter::same($this->values)
1818
->groupsOrder($order)
19-
->sort1()
19+
->sort()
2020
->toArray();
2121

2222
$this->assertSame($expected, $actual);
@@ -33,7 +33,7 @@ public function testObjects(?array $order, array $expected): void
3333

3434
$actual = Sorter::same($items)
3535
->groupsOrder($order)
36-
->sort1()
36+
->sort()
3737
->pluck('value', 'id')
3838
->toArray();
3939

@@ -51,7 +51,7 @@ public function testCustomColumn(?array $order, array $expected): void
5151
$actual = Sorter::same($items)
5252
->groupsOrder($order)
5353
->column('some')
54-
->sort1()
54+
->sort()
5555
->pluck('some', 'id')
5656
->toArray();
5757

@@ -73,7 +73,7 @@ public function testWithSaveKeys(?array $order, array $expected): void
7373

7474
$actual = Sorter::same($values)
7575
->groupsOrder($order)
76-
->sort1()
76+
->sort()
7777
->toArray();
7878

7979
$this->assertSame($expected, $actual);

tests/Sorters/TypeTest.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function testString(): void
6363
104 => 'ONE SIZE',
6464
131 => 'some',
6565
],
66-
Sorter::same($items)->sort1()->toArray()
66+
Sorter::same($items)->sort()->toArray()
6767
);
6868
}
6969

@@ -116,7 +116,7 @@ public function testStringable(): void
116116
104 => $items[104],
117117
131 => $items[131],
118118
],
119-
Sorter::same($items)->sort1()->toArray()
119+
Sorter::same($items)->sort()->toArray()
120120
);
121121
}
122122

@@ -139,7 +139,7 @@ public function testInteger(): void
139139
149 => 21,
140140
133 => 30,
141141
],
142-
Sorter::same($items)->sort1()->toArray()
142+
Sorter::same($items)->sort()->toArray()
143143
);
144144
}
145145

@@ -162,7 +162,7 @@ public function testFloat(): void
162162
149 => 21.8,
163163
133 => 30.5,
164164
],
165-
Sorter::same($items)->sort1()->toArray()
165+
Sorter::same($items)->sort()->toArray()
166166
);
167167
}
168168

@@ -213,7 +213,7 @@ public function testEnumString(): void
213213
104 => StringValue::VALUE_ONE_SIZE,
214214
131 => StringValue::VALUE_SOME,
215215
],
216-
Sorter::same($items)->sort1()->toArray()
216+
Sorter::same($items)->sort()->toArray()
217217
);
218218
}
219219

@@ -236,7 +236,7 @@ public function testEnumInteger(): void
236236
149 => IntegerValue::VALUE_21,
237237
133 => IntegerValue::VALUE_30,
238238
],
239-
Sorter::same($items)->sort1()->toArray()
239+
Sorter::same($items)->sort()->toArray()
240240
);
241241
}
242242

@@ -289,7 +289,7 @@ public function testNestedArray(): void
289289
104 => ['foo' => 'Foo', 'bar' => ['some' => ['nested' => 'ONE SIZE']]],
290290
131 => ['foo' => 'Foo', 'bar' => ['some' => ['nested' => 'some']]],
291291
],
292-
Sorter::same($items)->column('bar.some.nested')->sort1()->toArray()
292+
Sorter::same($items)->column('bar.some.nested')->sort()->toArray()
293293
);
294294
}
295295

@@ -344,7 +344,7 @@ public function testLaravelModels(): void
344344
104 => 'ONE SIZE',
345345
131 => 'some',
346346
],
347-
Sorter::same($items)->sort1()->pluck('value', 'id')->toArray()
347+
Sorter::same($items)->sort()->pluck('value', 'id')->toArray()
348348
);
349349
}
350350

@@ -397,7 +397,7 @@ public function testCollection(): void
397397
104 => 'ONE SIZE',
398398
131 => 'some',
399399
],
400-
Sorter::same($items)->sort1()->toArray()
400+
Sorter::same($items)->sort()->toArray()
401401
);
402402
}
403403
}

0 commit comments

Comments
 (0)