| Conditions | 4 |
| Paths | 1 |
| 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 |
||
| 51 | public function __construct(array $urlParams = array()) { |
||
| 52 | parent::__construct('deck', $urlParams); |
||
| 53 | |||
| 54 | $container = $this->getContainer(); |
||
| 55 | $server = $container->getServer(); |
||
| 56 | |||
| 57 | $container->registerService('ExceptionMiddleware', function() use ($server) { |
||
| 58 | return new ExceptionMiddleware( |
||
| 59 | $server->getLogger(), |
||
| 60 | $server->getConfig() |
||
| 61 | ); |
||
| 62 | }); |
||
| 63 | $container->registerMiddleWare('ExceptionMiddleware'); |
||
| 64 | |||
| 65 | $container->registerService('databaseType', function($container) { |
||
| 66 | return $container->getServer()->getConfig()->getSystemValue('dbtype', 'sqlite'); |
||
| 67 | }); |
||
| 68 | |||
| 69 | $container->registerService('database4ByteSupport', function($container) { |
||
| 70 | return $container->getServer()->getDatabaseConnection()->supports4ByteText(); |
||
| 71 | }); |
||
| 72 | |||
| 73 | // Delete user/group acl entries when they get deleted |
||
| 74 | /** @var IUserManager $userManager */ |
||
| 75 | $userManager = $server->getUserManager(); |
||
| 76 | $userManager->listen('\OC\User', 'postDelete', function(IUser $user) use ($container) { |
||
|
|
|||
| 77 | // delete existing acl entries for deleted user |
||
| 78 | /** @var AclMapper $aclMapper */ |
||
| 79 | $aclMapper = $container->query(AclMapper::class); |
||
| 80 | $acls = $aclMapper->findByParticipant(Acl::PERMISSION_TYPE_USER, $user->getUID()); |
||
| 81 | foreach ($acls as $acl) { |
||
| 82 | $aclMapper->delete($acl); |
||
| 83 | } |
||
| 84 | // delete existing user assignments |
||
| 85 | $assignmentMapper = $container->query(AssignedUsersMapper::class); |
||
| 86 | $assignments = $assignmentMapper->findByUserId($user->getUID()); |
||
| 87 | foreach ($assignments as $assignment) { |
||
| 88 | $assignmentMapper->delete($assignment); |
||
| 89 | } |
||
| 90 | }); |
||
| 91 | |||
| 92 | /** @var IUserManager $userManager */ |
||
| 93 | $groupManager = $server->getGroupManager(); |
||
| 94 | $groupManager->listen('\OC\Group', 'postDelete', function(IGroup $group) use ($container) { |
||
| 95 | /** @var AclMapper $aclMapper */ |
||
| 96 | $aclMapper = $container->query(AclMapper::class); |
||
| 97 | $aclMapper->findByParticipant(Acl::PERMISSION_TYPE_GROUP, $group->getGID()); |
||
| 98 | $acls = $aclMapper->findByParticipant(Acl::PERMISSION_TYPE_GROUP, $group->getGID()); |
||
| 99 | foreach ($acls as $acl) { |
||
| 100 | $aclMapper->delete($acl); |
||
| 101 | } |
||
| 102 | }); |
||
| 103 | |||
| 104 | $this->registerCollaborationResources(); |
||
| 105 | |||
| 106 | } |
||
| 107 | |||
| 183 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.