Conditions | 5 |
Paths | 7 |
Total Lines | 65 |
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 |
||
58 | public function build() |
||
59 | { |
||
60 | if (empty($this->getConfiguration()->getPageViewFolders())) |
||
61 | { |
||
62 | $this->logger->error('No PageViews were configured for this site. Check the `pageviews` key in your _config.yml.'); |
||
63 | |||
64 | return false; |
||
65 | } |
||
66 | |||
67 | // Configure the environment |
||
68 | $this->createFolderStructure(); |
||
69 | |||
70 | // Our output directory |
||
71 | $outputDirectory = new Folder($this->getConfiguration()->getTargetFolder()); |
||
72 | $outputDirectory->setTargetDirectory($this->getConfiguration()->getBaseUrl()); |
||
73 | |||
74 | // Compile everything |
||
75 | $theme = $this->getConfiguration()->getTheme(); |
||
76 | |||
77 | $this->compiler->setTargetFolder($outputDirectory); |
||
78 | $this->compiler->setThemeName($theme); |
||
79 | $this->compiler->compileAll(); |
||
80 | |||
81 | if (Service::hasRunTimeFlag(RuntimeStatus::IN_PROFILE_MODE)) |
||
82 | { |
||
83 | if (!$this->templateBridge->hasProfiler()) |
||
84 | { |
||
85 | $this->logger->writeln('This template engine currently does not support a profiler.'); |
||
86 | } |
||
87 | else |
||
88 | { |
||
89 | $profilerText = $this->templateBridge->getProfilerOutput($this->compiler); |
||
90 | $this->logger->writeln($profilerText); |
||
91 | } |
||
92 | } |
||
93 | |||
94 | // At this point, we are looking at static files to copy over meaning we need to ignore all of the files that |
||
95 | // make up the source of a stakx website |
||
96 | $assetsToIgnore = array_merge( |
||
97 | Configuration::$stakxSourceFiles, |
||
98 | $this->getConfiguration()->getExcludes() |
||
99 | ); |
||
100 | |||
101 | // |
||
102 | // Theme Management |
||
103 | // |
||
104 | if ($theme !== null) |
||
105 | { |
||
106 | $this->logger->notice("Looking for '${theme}' theme..."); |
||
107 | |||
108 | $tm = new ThemeManager($theme, $this->eventDispatcher, $this->logger); |
||
109 | $tm->configureFinder($this->getConfiguration()->getIncludes(), $assetsToIgnore); |
||
110 | $tm->setFolder($outputDirectory); |
||
111 | $tm->copyFiles(); |
||
112 | } |
||
113 | |||
114 | // |
||
115 | // Static file management |
||
116 | // |
||
117 | $this->assetManager->configureFinder($this->getConfiguration()->getIncludes(), $assetsToIgnore); |
||
118 | $this->assetManager->setFolder($outputDirectory); |
||
119 | $this->assetManager->copyFiles(); |
||
120 | |||
121 | $this->eventDispatcher->dispatch(BuildProcessComplete::NAME, new BuildProcessComplete()); |
||
122 | } |
||
123 | |||
187 |
This check compares the return type specified in the
@return
annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.