@@ -126,33 +126,9 @@ public function process(PHP_CodeCoverage $coverage, $target)
126126
127127 $ date = date ('D M j G:i:s T Y ' , $ _SERVER ['REQUEST_TIME ' ]);
128128
129- $ dashboard = new PHP_CodeCoverage_Report_HTML_Renderer_Dashboard (
130- $ this ->templatePath ,
131- $ this ->charset ,
132- $ this ->generator ,
133- $ date ,
134- $ this ->lowUpperBound ,
135- $ this ->highLowerBound
136- );
137-
138- $ directory = new PHP_CodeCoverage_Report_HTML_Renderer_Directory (
139- $ this ->templatePath ,
140- $ this ->charset ,
141- $ this ->generator ,
142- $ date ,
143- $ this ->lowUpperBound ,
144- $ this ->highLowerBound
145- );
146-
147- $ file = new PHP_CodeCoverage_Report_HTML_Renderer_File (
148- $ this ->templatePath ,
149- $ this ->charset ,
150- $ this ->generator ,
151- $ date ,
152- $ this ->lowUpperBound ,
153- $ this ->highLowerBound ,
154- $ this ->highlight
155- );
129+ $ dashboard = $ this ->createDashboardRenderer ($ date );
130+ $ directory = $ this ->createDirectoryRenderer ($ date );
131+ $ file = $ this ->createFileRenderer ($ date );
156132
157133 $ dashboard ->render ($ report , $ target . 'index.dashboard.html ' );
158134 $ directory ->render ($ report , $ target . 'index.html ' );
@@ -219,4 +195,59 @@ protected function getDirectory($directory)
219195 )
220196 );
221197 }
198+
199+ /**
200+ * Create the renderer for the dashboards which are placed in each dir.
201+ *
202+ * @param $date string the report date
203+ * @return PHP_CodeCoverage_Report_HTML_Renderer_Dashboard
204+ */
205+ protected function createDashboardRenderer ($ date )
206+ {
207+ return new PHP_CodeCoverage_Report_HTML_Renderer_Dashboard (
208+ $ this ->templatePath ,
209+ $ this ->charset ,
210+ $ this ->generator ,
211+ $ date ,
212+ $ this ->lowUpperBound ,
213+ $ this ->highLowerBound
214+ );
215+ }
216+
217+ /**
218+ * Create the renderer for the directories.
219+ *
220+ * @param $date string the report date
221+ * @return PHP_CodeCoverage_Report_HTML_Renderer_Directory
222+ */
223+ protected function createDirectoryRenderer ($ date )
224+ {
225+ return new PHP_CodeCoverage_Report_HTML_Renderer_Directory (
226+ $ this ->templatePath ,
227+ $ this ->charset ,
228+ $ this ->generator ,
229+ $ date ,
230+ $ this ->lowUpperBound ,
231+ $ this ->highLowerBound
232+ );
233+ }
234+
235+ /**
236+ * Create the renderer for the file reports.
237+ *
238+ * @param $date string the report date
239+ * @return PHP_CodeCoverage_Report_HTML_Renderer_File
240+ */
241+ protected function createFileRenderer ($ date )
242+ {
243+ return new PHP_CodeCoverage_Report_HTML_Renderer_File (
244+ $ this ->templatePath ,
245+ $ this ->charset ,
246+ $ this ->generator ,
247+ $ date ,
248+ $ this ->lowUpperBound ,
249+ $ this ->highLowerBound ,
250+ $ this ->highlight
251+ );
252+ }
222253}
0 commit comments