Skip to content

Instantly share code, notes, and snippets.

@maks-rafalko
Created September 28, 2017 20:25
Show Gist options
  • Save maks-rafalko/d983c015d9073fa3a9e6dc3c862ce2a2 to your computer and use it in GitHub Desktop.
Save maks-rafalko/d983c015d9073fa3a9e6dc3c862ce2a2 to your computer and use it in GitHub Desktop.
Medium: first mutation
class UserFilterAge
{
const AGE_THRESHOLD = 18;
public function __invoke(array $collection)
{
return array_filter(
$collection,
function (array $item) {
- return $item['age'] >= self::AGE_THRESHOLD;
+ return $item['age'] > self::AGE_THRESHOLD;
}
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment