Skip to content

Commit

Permalink
remove Seed::first
Browse files Browse the repository at this point in the history
  • Loading branch information
dakujem committed Jan 19, 2024
1 parent 9965f5e commit 29632f4
Showing 1 changed file with 11 additions and 19 deletions.
30 changes: 11 additions & 19 deletions src/Seed.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,25 +44,6 @@ public static function nullFirst(iterable $input): Generator
yield from $input;
}

/**
* Returns the first element of an iterable collection.
*/
public static function firstOf(iterable $input): mixed
{
foreach ($input as $item) {
return $item;
}
return null;
}

/**
* @deprecated Name changed.
*/
public static function first(iterable $input): mixed
{
return self::firstOf($input);
}

/**
* Create a callable that omits the data nodes with `null` data.
* To be used with `Filter` iterator as the predicate:
Expand All @@ -83,6 +64,17 @@ public static function omitRoot(): callable
return fn(TreeNodeContract $node): bool => !$node->isRoot();
}

/**
* Returns the first element of an iterable collection.
*/
public static function firstOf(iterable $input): mixed
{
foreach ($input as $item) {
return $item;
}
return null;
}

/**
* Create an extractor that extracts a property of objects.
* Note: Abbreviation of "property".
Expand Down

0 comments on commit 29632f4

Please sign in to comment.