-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: calling
slice()
on a LazyMatchingReadableCollection` now shou…
…ld not trigger initialization of the underlying collection. (#12) * feat: calling `slice()` on a LazyMatchingReadableCollection` now should not trigger initialization of the underlying collection. * remove order to pass test
- Loading branch information
Showing
5 changed files
with
94 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of rekalogika/doctrine-collections-decorator package. | ||
* | ||
* (c) Priyadi Iman Nurcahyo <https://rekalogika.dev> | ||
* | ||
* For the full copyright and license information, please view the LICENSE file | ||
* that was distributed with this source code. | ||
*/ | ||
|
||
namespace Rekalogika\Collections\Decorator\Tests\Model; | ||
|
||
use Rekalogika\Collections\Decorator\Decorator\SelectableCollectionDecorator; | ||
|
||
/** | ||
* @extends SelectableCollectionDecorator<int|string,Book> | ||
*/ | ||
class SliceInterceptor extends SelectableCollectionDecorator | ||
{ | ||
private int $sliceCount = 0; | ||
|
||
public function count(): int | ||
{ | ||
$this->sliceCount++; | ||
return $this->getWrapped()->count(); | ||
} | ||
|
||
public function getSliceCount(): int | ||
{ | ||
return $this->sliceCount; | ||
} | ||
} |