| Conditions | 1 |
| Paths | 1 |
| Total Lines | 66 |
| 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 |
||
| 41 | public function __construct() { |
||
| 42 | parent::__construct('federatedfilesharing'); |
||
| 43 | $container = $this->getContainer(); |
||
| 44 | $server = $container->getServer(); |
||
| 45 | |||
| 46 | $container->registerService( |
||
| 47 | 'AddressHandler', |
||
| 48 | function ($c) use ($server) { |
||
|
|
|||
| 49 | return new AddressHandler( |
||
| 50 | $server->getURLGenerator(), |
||
| 51 | $server->getL10N('federatedfilesharing') |
||
| 52 | ); |
||
| 53 | } |
||
| 54 | ); |
||
| 55 | |||
| 56 | $container->registerService( |
||
| 57 | 'DiscoveryManager', |
||
| 58 | function ($c) use ($server) { |
||
| 59 | return new DiscoveryManager( |
||
| 60 | $server->getMemCacheFactory(), |
||
| 61 | $server->getHTTPClientService() |
||
| 62 | ); |
||
| 63 | } |
||
| 64 | ); |
||
| 65 | |||
| 66 | $container->registerService( |
||
| 67 | 'Notifications', |
||
| 68 | function ($c) use ($server) { |
||
| 69 | return new Notifications( |
||
| 70 | $c->query('AddressHandler'), |
||
| 71 | $server->getHTTPClientService(), |
||
| 72 | $c->query('DiscoveryManager'), |
||
| 73 | $server->getJobList(), |
||
| 74 | $server->getConfig() |
||
| 75 | ); |
||
| 76 | } |
||
| 77 | ); |
||
| 78 | |||
| 79 | $container->registerService( |
||
| 80 | 'FederatedShareManager', |
||
| 81 | function ($c) use ($server) { |
||
| 82 | return new FedShareManager( |
||
| 83 | $this->getFederatedShareProvider(), |
||
| 84 | $server->getUserManager(), |
||
| 85 | $server->getActivityManager(), |
||
| 86 | $server->getLogger() |
||
| 87 | ); |
||
| 88 | } |
||
| 89 | ); |
||
| 90 | |||
| 91 | $container->registerService( |
||
| 92 | 'RequestHandlerController', |
||
| 93 | function ($c) use ($server) { |
||
| 94 | return new RequestHandlerController( |
||
| 95 | $c->query('AppName'), |
||
| 96 | $c->query('Request'), |
||
| 97 | $this->getFederatedShareProvider(), |
||
| 98 | $server->getDatabaseConnection(), |
||
| 99 | $c->query('Notifications'), |
||
| 100 | $c->query('AddressHandler'), |
||
| 101 | $c->query('FederatedShareManager'), |
||
| 102 | $server->getEventDispatcher() |
||
| 103 | ); |
||
| 104 | } |
||
| 105 | ); |
||
| 106 | } |
||
| 107 | |||
| 156 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.