Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change reorder function to take values instead of Item #8

Closed
khalyomede opened this issue Jan 13, 2023 · 0 comments · Fixed by #13
Closed

Change reorder function to take values instead of Item #8

khalyomede opened this issue Jan 13, 2023 · 0 comments · Fixed by #13
Assignees
Labels
enhancement New feature or request

Comments

@khalyomede
Copy link
Owner

To make the API easier, we should be able to pass the value directly instead of saving an instance of the item.

This

use Khalyomede\ReorderBeforeAfter\Listing;
use Khalyomede\ReorderBeforeAfter\Placement;

$bag = new Item("bag", 1);
$book = new Item("book, 2);

$listing = new Listing([$bag, $book]);

$listing->reorder($bag, Placement::After, $book);

Would become this

use Khalyomede\ReorderBeforeAfter\Listing;
use Khalyomede\ReorderBeforeAfter\Placement;

$listing = new Listing([new Item("bag", 1), new Item("book", 2)]);

$listing->reorder("bag", Placement::After, "book");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant