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 the package #2

Merged
merged 3 commits into from
Oct 29, 2019
Merged

Refactor the package #2

merged 3 commits into from
Oct 29, 2019

Conversation

adiachenko
Copy link
Collaborator

@adiachenko adiachenko commented Mar 29, 2019

The following changes are made in this PR:

  • Publishing package configuration is no longer required if you're satisfied with the defaults
  • Adhere to PSR-4 autoloading standard
  • Define package dependencies better
  • Add simple PHPUnit tests
  • Rename Guide facade to Country facade for clarity
  • Add phpDoc comments for better code intel
  • Added Laravel package auto-discovery

- Publishing package configuration is no longer requried if you're satisfied with the defaults
- Adhere to PSR-4 autoloading standard
- Define package dependencies better
- Add simple PHPUnit tests
- Rename Guide facade to Country facade for clarity
- Add phpDoc comments for better code intel
Copy link
Member

@Mulkave Mulkave left a comment

Choose a reason for hiding this comment

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

Pretty good improvements 👍

src/Guide.php Outdated
{
$countries = $this->config->get('countries');

if (array_search(ucwords($name), $countries)) {
Copy link
Member

Choose a reason for hiding this comment

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

would this be better assigned to a variable and then returned? e.g.

$found = array_search(ucwords($name), $countries);

if ($found) {
  return $found
} else {
  ...
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@Mulkave Sure, I took it a bit further and also extracted the logic into scanStringNames and scanArrayNames methods, because it was hard to understand what's going when looking at this condition.

@adiachenko
Copy link
Collaborator Author

Also added package auto-discovery.

@adiachenko adiachenko merged commit d5bbd50 into Vinelab:master Oct 29, 2019
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