Skip to content

Commit

Permalink
Merge pull request #11 from Chemaclass/replace-array_map-foreach
Browse files Browse the repository at this point in the history
Replace an array_map by a foreach in SegmentFactory
  • Loading branch information
JesusValera committed Jun 6, 2020
2 parents 07273ec + c8535f1 commit 349db8c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/Segments/SegmentFactory.php
Expand Up @@ -55,13 +55,12 @@ public static function withDefaultSegments(): self
/** @param array<string,string> $segments */
private function __construct(array $segments)
{
Assert::allLength(array_keys($segments), self::TAG_LENGTH);

array_map(function (string $class): void {
foreach ($segments as $tag => $class) {
Assert::length($tag, self::TAG_LENGTH);
if (!$this->classImplements($class, SegmentInterface::class)) {
throw new InvalidArgumentException("'{$class}' must implements 'SegmentInterface'");
}
}, $segments);
}

$this->segments = $segments;
}
Expand Down

0 comments on commit 349db8c

Please sign in to comment.