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

Dispatcher refactor #540

Merged
merged 5 commits into from
Feb 9, 2024
Merged

Dispatcher refactor #540

merged 5 commits into from
Feb 9, 2024

Conversation

fadrian06
Copy link
Contributor

Before:

Dispatcher::run(...)

// run pre filters
// ...

// run requested method
// ...

// run post filters
// ...

After

$this->runPreFilters(...);
$this->runEvent(...);
$this->runPostFilters(...);

Next refactor I want that it will be:

$event = $this->events->get($eventName);

// Events::__invoke() will call pre filters and post filters
return $event(...$params);

@fadrian06
Copy link
Contributor Author

fadrian06 commented Feb 8, 2024

If you accept this refactor, please

don't delete the branch to add Events::class and Filters::class in another refactor.

@fadrian06
Copy link
Contributor Author

image
image

Copy link
Collaborator

@n0nag0n n0nag0n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know the unit tests that you removed were....a tad redundant but they still held together old functionality. In the future just be mindful of that.

@fadrian06 fadrian06 requested review from n0nag0n and krmu and removed request for n0nag0n February 9, 2024 05:14
Copy link
Contributor

@krmu krmu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything works as expected. ✅

@fadrian06 fadrian06 merged commit b06b8da into master Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants