mirror of
https://github.com/wiosna-dev/common-library.git
synced 2026-03-12 17:41:50 +01:00
Increase Mutation Score Indicator (MSI) by creating stronger tests of BaseCollection class
This commit is contained in:
@@ -46,13 +46,21 @@ abstract class BaseCollection implements Countable, ArrayAccess, IteratorAggrega
|
||||
return $elements;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns information if given element has valid type
|
||||
*
|
||||
* @param mixed $element Element of collection
|
||||
* @return bool
|
||||
*/
|
||||
abstract protected function isValidType($element): bool;
|
||||
|
||||
/**
|
||||
* Returns elements of collection with valid types
|
||||
*
|
||||
* @param array $elements The elements of collection to verify
|
||||
* @return array
|
||||
*/
|
||||
protected function getElementsWithValidType(array $elements): array
|
||||
private function getElementsWithValidType(array $elements): array
|
||||
{
|
||||
if (empty($elements)) {
|
||||
return [];
|
||||
@@ -70,12 +78,4 @@ abstract class BaseCollection implements Countable, ArrayAccess, IteratorAggrega
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns information if given element has valid type
|
||||
*
|
||||
* @param mixed $element Element of collection
|
||||
* @return bool
|
||||
*/
|
||||
abstract protected function isValidType($element): bool;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user