Closed agussuhartono closed 4 years ago
While proposal may make sense, in fact these methods comply with SRP and ISP well:
I'm also afraid of the number of occurrences in the code "instanceof"
I agree that it is worth dividing the methods into addRole, addPermision...
Also, in my opinion, a good solution would be to divide everything into storage and Manager.
@romkatsu agree.
RBAC Manager manage multiple object like Role, Permission, Rule but RBAC Manager use single method for manage them
add, remove, update
i think this method not compliant with solid principle on S = Single responsibility, and I = Interface segregation
use dedicated metthod for each object i think more better
add() -> addRole(), addPermision, AddRule addChild() -> addRoleChild() remove() -> removeRole(), removePermision(), removeRule()
currenly for more readable code, i'm use meaning variable name as solution
regards mr_a_ton
ref : https://github.com/samdark/yii2-cookbook/blob/master/book/solid.md