| Conditions | 1 |
| Paths | 1 |
| Total Lines | 73 |
| Code Lines | 50 |
| 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 |
||
| 30 | public function __invoke() |
||
| 31 | { |
||
| 32 | return [ |
||
| 33 | 'markdown_cms' => [ |
||
| 34 | 'options' => [ |
||
| 35 | 'content_dir' => 'data/content', |
||
| 36 | 'base_url' => 'http://replace.it', |
||
| 37 | 'images_base_url' => 'http://replace.it/img', |
||
| 38 | 'content_config_path' => 'config/autoload/markdown-cms.content.global.php', |
||
| 39 | 'sitemap_path' => 'public/sitemap.xml', |
||
| 40 | 'content_type_default' => 'blogEntry', |
||
| 41 | 'parse_content_executor' => [ |
||
| 42 | 'observers' => [ |
||
| 43 | 'save_content_config' => SaveContentConfigObserver::class, |
||
| 44 | 'sitemap' => SitemapObserver::class, |
||
| 45 | ] |
||
| 46 | ], |
||
| 47 | 'url_translation' => [ |
||
| 48 | // e.g.: 'http://devlopment.url' => 'https://production.url' |
||
| 49 | ], |
||
| 50 | 'content_types' => [ |
||
| 51 | 'page' => [ |
||
| 52 | 'creator' => PageCreator::class, |
||
| 53 | 'default_template' => 'app::page.twig' |
||
| 54 | ], |
||
| 55 | 'blogEntry' => [ |
||
| 56 | 'creator' => BlogEntryCreator::class, |
||
| 57 | 'default_template' => 'app::blog-entry.twig' |
||
| 58 | ] |
||
| 59 | ] |
||
| 60 | ] |
||
| 61 | ], |
||
| 62 | 'dependencies' => [ |
||
| 63 | 'factories' => [ |
||
| 64 | ParseContentExecutor::class => ParseContentExecutorFactory::class, // bleibt |
||
| 65 | ] |
||
| 66 | ], |
||
| 67 | 'routes' => [ |
||
| 68 | 'markdown_cms:blog' => [ |
||
| 69 | 'name' => 'blog', |
||
| 70 | 'path' => '/blog.{id:[^/]+}.html', |
||
| 71 | 'middleware' => SingleBlogEntryAction::class, |
||
| 72 | 'allowed_methods' => [ |
||
| 73 | 'GET' |
||
| 74 | ] |
||
| 75 | ], |
||
| 76 | 'markdown_cms:blog_overview' => [ |
||
| 77 | 'name' => 'blog_overview', |
||
| 78 | 'path' => '/blog.html', |
||
| 79 | 'middleware' => BlogOverviewAction::class, |
||
| 80 | 'allowed_methods' => [ |
||
| 81 | 'GET' |
||
| 82 | ] |
||
| 83 | ], |
||
| 84 | 'markdown_cms:tags' => [ |
||
| 85 | 'name' => 'tags', |
||
| 86 | 'path' => '/tag.{id}.html', |
||
| 87 | 'middleware' => TagArchiveAction::class, |
||
| 88 | 'allowed_methods' => [ |
||
| 89 | 'GET' |
||
| 90 | ] |
||
| 91 | ], |
||
| 92 | 'markdown_cms:pages' => [ |
||
| 93 | 'name' => 'pages', |
||
| 94 | 'path' => '/{id}.html', |
||
| 95 | 'middleware' => SingleBlogEntryAction::class, |
||
| 96 | 'allowed_methods' => [ |
||
| 97 | 'GET' |
||
| 98 | ] |
||
| 99 | ], |
||
| 100 | ], |
||
| 101 | ]; |
||
| 102 | } |
||
| 103 | } |