Skip to content
This repository was archived by the owner on Aug 14, 2019. It is now read-only.

Permissions name mismatch fix#84

Open
bartoszpietrzak1994 wants to merge 3 commits intoSylius:masterfrom
bartoszpietrzak1994:permissions-name-mismatch-fix
Open

Permissions name mismatch fix#84
bartoszpietrzak1994 wants to merge 3 commits intoSylius:masterfrom
bartoszpietrzak1994:permissions-name-mismatch-fix

Conversation

@bartoszpietrzak1994
Copy link
Contributor

No description provided.

@bartoszpietrzak1994 bartoszpietrzak1994 requested a review from a team May 17, 2019 08:06
@bartoszpietrzak1994 bartoszpietrzak1994 force-pushed the permissions-name-mismatch-fix branch from 9107d18 to 319fa7e Compare May 17, 2019 08:09

public function __construct()
{
$this->sectionsToPermissionsMapping = [
Copy link
Contributor

Choose a reason for hiding this comment

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

It could be initialized not in the constructor, but in private $sectionsToPermissionsMapping; 🚀 It could then also be a static variable, I suppose

$availableSyliusSections = $this->syliusSectionsProvider->__invoke();
$availablePermissions = array_map(function (string $section): string {
return $this->sectionsToPermissionsMapper->map($section);
}, $this->syliusSectionsProvider->__invoke());
Copy link
Contributor

Choose a reason for hiding this comment

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

We could extract this to the private function (provideAndMapPermissions?) to make the main function more readable

@Zales0123 Zales0123 added the Enhancement Minor issues and PRs improving the current solutions (optimizations, typo fixes, etc.). label Aug 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Enhancement Minor issues and PRs improving the current solutions (optimizations, typo fixes, etc.).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants