Conditions | 2 |
Paths | 2 |
Total Lines | 56 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
73 | public function kanvas(): void |
||
74 | { |
||
75 | $this->acl->addResource( |
||
76 | 'Default.SettingsMenu', |
||
77 | [ |
||
78 | 'company-settings', |
||
79 | 'app-settings', |
||
80 | 'companies-manager', |
||
81 | ] |
||
82 | ); |
||
83 | |||
84 | $defaultResources = [ |
||
85 | 'Default.CompanyBranches', |
||
86 | 'Default.CompanyUsers', |
||
87 | 'Default.CompanyRoles', |
||
88 | 'Default.CompanySubscriptions', |
||
89 | 'Default.CustomFields', |
||
90 | 'Default.CompaniesManager', |
||
91 | 'Default.Apps-plans' |
||
92 | ]; |
||
93 | |||
94 | foreach ($defaultResources as $resource) { |
||
95 | $this->acl->addResource( |
||
96 | $resource, |
||
97 | [ |
||
98 | 'read', |
||
99 | 'list', |
||
100 | 'create', |
||
101 | 'update', |
||
102 | 'delete' |
||
103 | ] |
||
104 | ); |
||
105 | |||
106 | $this->acl->allow( |
||
107 | 'Admins', |
||
108 | $resource, |
||
109 | [ |
||
110 | 'read', |
||
111 | 'list', |
||
112 | 'create', |
||
113 | 'update', |
||
114 | 'delete' |
||
115 | ] |
||
116 | ); |
||
117 | } |
||
118 | |||
119 | $this->acl->allow( |
||
120 | 'Admins', |
||
121 | 'Default.SettingsMenu', |
||
122 | [ |
||
123 | 'company-settings', |
||
124 | 'app-settings', |
||
125 | 'companies-manager', |
||
126 | ] |
||
127 | ); |
||
128 | } |
||
129 | } |
||
130 |