Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add groupBy() for matching #35

Closed
danon opened this issue Jan 15, 2019 · 2 comments
Closed

Add groupBy() for matching #35

danon opened this issue Jan 15, 2019 · 2 comments
Labels
feature Adds new functionality
Milestone

Comments

@danon
Copy link
Member

danon commented Jan 15, 2019

Allow certain match() methods to return grouped values.

Methods:

  • groupBy(string|int) - groups by capturing group
  • groupByCallback(callable) - groups by user defined callback

Requirements:

  • All of them must be usable with filter()->groupBy().

Example for all()

pattern('\d+(?<unit>cm|mm)')->match('12cm 14mm 13cm 19cm 18mm 2mm')->groupBy('unit')
  ->all();
[
  'cm' => ['12cm', '13cm', '19cm'],
  'mm' => ['14mm', '18mm', '2mm']
]
@danon

This comment has been minimized.

@danon

This comment has been minimized.

@danon danon added the feature Adds new functionality label Jan 16, 2019
@danon danon changed the title Add match()->all()->groupBy() Add groupBy() for matching Sep 16, 2019
@danon danon added this to To do in Release version Sep 18, 2019
@danon danon added this to the Group By milestone Sep 19, 2019
danon added a commit that referenced this issue Nov 4, 2019
danon added a commit that referenced this issue Feb 23, 2020
@danon danon moved this from To do to In progress in Release version Feb 24, 2020
danon added a commit that referenced this issue Feb 25, 2020
danon added a commit that referenced this issue Feb 25, 2020
@danon danon closed this as completed Feb 25, 2020
Release version automation moved this from In progress to Done Feb 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Adds new functionality
Projects
No open projects
Development

No branches or pull requests

1 participant