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

Refactor generate method #109

Merged
merged 2 commits into from
Feb 15, 2017
Merged

Refactor generate method #109

merged 2 commits into from
Feb 15, 2017

Conversation

sebdesign
Copy link
Contributor

Decompose the conditionals of the $method by extracting it into two
methods.

This way the MethodNotFoundException becomes redundant because each
condition is explicitly handled by its corresponding method.

Also the generate method has fewer responsibilities and is way
simpler.

Decompose the conditionals of the `$method` by extracting it into two
methods.

This way the `MethodNotFoundException` becomes redundant because each
condition is explicitly handled by its corresponding method.

Also the `generate` method has fewer responsibilities and is way
simpler.
foreach ( $tables as $table ) {
$this->table = $table;
$this->migrationName = 'create_'. $this->table .'_table';
$this->fields = $this->schemaGenerator->getFields( $this->table );
Copy link
Owner

Choose a reason for hiding this comment

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

Shouldn't this one also call $this->generate()?

Copy link
Contributor Author

@sebdesign sebdesign Dec 29, 2016

Choose a reason for hiding this comment

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

Yes it should! My bad.

Copy link
Owner

Choose a reason for hiding this comment

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

Do you want me to fix this? Or would you like to?

@Xethron
Copy link
Owner

Xethron commented Dec 29, 2016

Love it! Will test it out when I have a moment

@sebdesign
Copy link
Contributor Author

I'm glad you like it! But I should write some unit tests. I'll try to push them ASAP.

@Xethron Xethron merged commit 8a9e187 into Xethron:master Feb 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants