Skip to content

Commit

Permalink
readme and tests upd
Browse files Browse the repository at this point in the history
  • Loading branch information
Smoren committed Mar 10, 2024
1 parent ec93b7b commit 7c8387c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ $originalView = ArrayView::toView($originalArray);
$originalView[new MaskSelector([true, false, true, false, true])]; // [1, 3, 5]
$originalView[new IndexListSelector([1, 2, 4])]; // [2, 3, 5]
$originalView[new SliceSelector('::-1')]; // [5, 4, 3, 2, 1]
$originalView['::-1']; // [5, 4, 3, 2, 1]

$originalView[new MaskSelector([true, false, true, false, true])] = [10, 30, 50];
print_r(originalArray); // [10, 2, 30, 4, 50]
Expand Down
4 changes: 4 additions & 0 deletions tests/unit/Examples/ExamplesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ public function testSubarray()
[5, 4, 3, 2, 1],
$originalView[new SliceSelector('::-1')],
);
$this->assertSame(
[5, 4, 3, 2, 1],
$originalView['::-1'],
);

$originalView[new MaskSelector([true, false, true, false, true])] = [10, 30, 50];

Expand Down

0 comments on commit 7c8387c

Please sign in to comment.