mirror of
https://github.com/wiosna-dev/common-library.git
synced 2026-03-12 09:31:51 +01:00
Rename Collection class to BaseCollection. Add BaseCollection::isValidType() method to validate type of element before add it to collection. Add BaseCollection ::prepareElements() method to allow preparation of elements in custom way.
This commit is contained in:
34
tests/Utilities/Reflection/ObjectsCollection.php
Normal file
34
tests/Utilities/Reflection/ObjectsCollection.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* (c) Meritoo.pl, http://www.meritoo.pl
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Meritoo\Test\Common\Utilities\Reflection;
|
||||
|
||||
use Meritoo\Common\Collection\BaseCollection;
|
||||
|
||||
/**
|
||||
* Collection of objects
|
||||
*
|
||||
* @author Meritoo <github@meritoo.pl>
|
||||
* @copyright Meritoo <http://www.meritoo.pl>
|
||||
*
|
||||
* @internal
|
||||
* @coversNothing
|
||||
*/
|
||||
class ObjectsCollection extends BaseCollection
|
||||
{
|
||||
protected function isValidType($element): bool
|
||||
{
|
||||
return $element instanceof A
|
||||
|| $element instanceof B
|
||||
|| $element instanceof C
|
||||
|| $element instanceof D
|
||||
|| $element instanceof F;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user