Conditions | 1 |
Paths | 1 |
Total Lines | 58 |
Code Lines | 12 |
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 |
||
38 | public function __construct() { |
||
39 | parent::__construct('nextnote'); |
||
40 | $container = $this->getContainer(); |
||
41 | // Allow automatic DI for the View, until we migrated to Nodes API |
||
42 | $container->registerService(View::class, function () { |
||
43 | return new View(''); |
||
44 | }, false); |
||
45 | $container->registerService('isCLI', function () { |
||
46 | return \OC::$CLI; |
||
47 | }); |
||
48 | |||
49 | |||
50 | |||
51 | |||
52 | /** Cron |
||
53 | $container->registerService('CronService', function ($c) { |
||
54 | return new CronService( |
||
55 | $c->query('CredentialService'), |
||
56 | $c->query('Logger'), |
||
57 | $c->query('Utils'), |
||
58 | $c->query('NotificationService'), |
||
59 | $c->query('ActivityService'), |
||
60 | $c->query('IDBConnection') |
||
61 | ); |
||
62 | });**/ |
||
63 | /* |
||
64 | $container->registerService('Db', function () { |
||
65 | return new Db(); |
||
66 | });*/ |
||
67 | |||
68 | |||
69 | |||
70 | $container->registerService('Logger', function ($c) { |
||
71 | return $c->query('ServerContainer')->getLogger(); |
||
72 | }); |
||
73 | |||
74 | // Aliases for the controllers so we can use the automatic DI |
||
75 | $container->registerAlias('PageController', PageController::class); |
||
76 | $container->registerAlias('NextNoteApiController', NextNoteApiController::class); |
||
77 | |||
78 | |||
79 | /*$container->registerAlias('CredentialController', CredentialController::class); |
||
80 | $container->registerAlias('PageController', PageController::class); |
||
81 | $container->registerAlias('PageController', PageController::class); |
||
82 | $container->registerAlias('VaultController', VaultController::class); |
||
83 | $container->registerAlias('VaultController', VaultController::class); |
||
84 | $container->registerAlias('CredentialService', CredentialService::class); |
||
85 | $container->registerAlias('NotificationService', NotificationService::class); |
||
86 | $container->registerAlias('ActivityService', ActivityService::class); |
||
87 | $container->registerAlias('VaultService', VaultService::class); |
||
88 | $container->registerAlias('FileService', FileService::class); |
||
89 | $container->registerAlias('ShareService', ShareService::class); |
||
90 | $container->registerAlias('Utils', Utils::class); |
||
91 | $container->registerAlias('IDBConnection', IDBConnection::class); |
||
92 | $container->registerAlias('IConfig', IConfig::class); |
||
93 | $container->registerAlias('SettingsService', SettingsService::class); |
||
94 | $container->registerAlias('APIMiddleware', APIMiddleware::class);*/ |
||
95 | } |
||
96 | |||
115 | } |