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