Conditions | 1 |
Paths | 1 |
Total Lines | 58 |
Code Lines | 41 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
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 __invoke() |
||
42 | { |
||
43 | return [ |
||
44 | 'markdown_cms' => [ |
||
45 | 'options' => [ |
||
46 | 'content_dir' => 'data/content', |
||
47 | 'content_config_path' => 'config/autoload/markdown-cms.global.php', |
||
48 | 'content_type_default' => 'blogEntry', |
||
49 | 'parse_content_executor' => [ |
||
50 | 'observers' => [ |
||
51 | 'save_content_config' => SaveContentConfigObserver::class, |
||
52 | ] |
||
53 | ], |
||
54 | 'content_types' => [ |
||
55 | 'page' => [ |
||
56 | 'creator' => PageCreator::class, |
||
57 | 'default_template' => 'app::page.twig' |
||
58 | ], |
||
59 | 'blogEntry' => [ |
||
60 | 'creator' => BlogEntryCreator::class, |
||
61 | 'default_template' => 'app::blog-entry.twig' |
||
62 | ] |
||
63 | ] |
||
64 | ] |
||
65 | ], |
||
66 | 'dependencies' => [ |
||
67 | 'factories' => [ |
||
68 | ContentCreator::class => ContentCreatorFactory::class, |
||
69 | ContentParser::class => ContentParserFactory::class, |
||
70 | MarkdownDocumentParser::class => MarkdownDocumentParserFactory::class, |
||
71 | MarkdownFileIterator::class => MarkdownFileIteratorFactory::class, |
||
72 | Parser::class => FrontYamlParserFactory::class, |
||
73 | ParseContentCommand::class => ParseContentCommandFactory::class, |
||
74 | ParseContentExecutor::class => ParseContentExecutorFactory::class, |
||
75 | SaveContentConfigObserver::class => SaveContentConfigObserverFactory::class, |
||
76 | SingleBlogEntryAction::class => SingleBlogEntryActionFactory::class, |
||
77 | ] |
||
78 | ], |
||
79 | 'routes' => [ |
||
80 | 'markdown_cms:blog' => [ |
||
81 | 'name' => 'blog', |
||
82 | 'path' => '/blog.{id:[^/]+}.html', |
||
83 | 'middleware' => SingleBlogEntryAction::class, |
||
84 | 'allowed_methods' => [ |
||
85 | 'GET' |
||
86 | ] |
||
87 | ], |
||
88 | 'markdown_cms:pages' => [ |
||
89 | 'name' => 'pages', |
||
90 | 'path' => '/{id}.html', |
||
91 | 'middleware' => SingleBlogEntryAction::class, |
||
92 | 'allowed_methods' => [ |
||
93 | 'GET' |
||
94 | ] |
||
95 | ] |
||
96 | ], |
||
97 | ]; |
||
98 | } |
||
99 | } |