| Conditions | 21 |
| Paths | > 20000 |
| Total Lines | 127 |
| Code 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 |
||
| 301 | public function render(array $options = []) |
||
| 302 | { |
||
| 303 | if(profiler() !== false) { |
||
| 304 | profiler()->watch('Starting View Rendering'); |
||
| 305 | } |
||
| 306 | |||
| 307 | $htmlOutput = ''; |
||
| 308 | parser()->loadVars(presenter()->getArrayCopy()); |
||
| 309 | |||
| 310 | // set document meta title |
||
| 311 | if (presenter()->meta->title instanceof Meta\Title) { |
||
| 312 | $this->document->title->text(presenter()->meta->title->__toString()); |
||
| 313 | } |
||
| 314 | |||
| 315 | /** |
||
| 316 | * Injecting Meta Opengraph |
||
| 317 | */ |
||
| 318 | if (presenter()->meta->opengraph instanceof Meta\Opengraph) { |
||
| 319 | // set opengraph title |
||
| 320 | if (presenter()->meta->title instanceof Meta\Title) { |
||
| 321 | presenter()->meta->opengraph->setTitle(presenter()->meta->title->__toString()); |
||
| 322 | } |
||
| 323 | |||
| 324 | // set opengraph site name |
||
| 325 | if (presenter()->exists('siteName')) { |
||
| 326 | presenter()->meta->opengraph->setSiteName(presenter()->offsetGet('siteName')); |
||
| 327 | } |
||
| 328 | |||
| 329 | if (presenter()->meta->opengraph->count()) { |
||
| 330 | $htmlElement = $this->document->getElementsByTagName('html')->item(0); |
||
| 331 | $htmlElement->setAttribute('prefix', 'og: ' . presenter()->meta->opengraph->prefix); |
||
| 332 | |||
| 333 | if (presenter()->meta->opengraph->exists('og:type') === false) { |
||
| 334 | presenter()->meta->opengraph->setType('website'); |
||
| 335 | } |
||
| 336 | |||
| 337 | $opengraph = presenter()->meta->opengraph->getArrayCopy(); |
||
| 338 | |||
| 339 | foreach ($opengraph as $tag) { |
||
| 340 | $this->document->metaNodes->createElement($tag->attributes->getArrayCopy()); |
||
| 341 | } |
||
| 342 | } |
||
| 343 | } |
||
| 344 | |||
| 345 | if (false !== ($controller = controller())) { |
||
| 346 | presenter()->meta->offsetSet('module-controller', $controller->getClassInfo()->getParameter()); |
||
| 347 | } |
||
| 348 | |||
| 349 | $meta = presenter()->meta->getArrayCopy(); |
||
| 350 | |||
| 351 | foreach ($meta as $tag) { |
||
| 352 | $this->document->metaNodes->createElement($tag->attributes->getArrayCopy()); |
||
| 353 | } |
||
| 354 | |||
| 355 | if (presenter()->theme->use === true) { |
||
| 356 | presenter()->theme->load(); |
||
| 357 | if (false !== ($layout = presenter()->theme->active->getLayout())) { |
||
| 358 | parser()->loadFile($layout->getRealPath()); |
||
| 359 | $htmlOutput = parser()->parse(); |
||
| 360 | } |
||
| 361 | } else { |
||
| 362 | $this->document->find('body')->append(presenter()->partials->__get('content')); |
||
| 363 | } |
||
| 364 | |||
| 365 | $this->document->loadHTML(presenter()->assets->parseSourceCode($htmlOutput)); |
||
| 366 | |||
| 367 | /** |
||
| 368 | * Injecting Single Sign-On (SSO) iFrame |
||
| 369 | */ |
||
| 370 | if (services()->has('user')) { |
||
| 371 | $iframe = services()->get('user')->getIframeCode(); |
||
| 372 | |||
| 373 | if ( ! empty($iframe)) { |
||
| 374 | $this->document->find('body')->append($iframe); |
||
| 375 | } |
||
| 376 | } |
||
| 377 | |||
| 378 | if (input()->env('DEBUG_STAGE') === 'DEVELOPER' and |
||
| 379 | config()->getItem('presenter')->debugToolBar === true and |
||
| 380 | services()->has('profiler') |
||
| 381 | ) { |
||
| 382 | $this->document->find('body')->append((new Toolbar())->__toString()); |
||
| 383 | } |
||
| 384 | |||
| 385 | /** |
||
| 386 | * Injecting Progressive Web Application (PWA) Manifest |
||
| 387 | */ |
||
| 388 | $this->document->linkNodes->createElement([ |
||
| 389 | 'rel' => 'manifest', |
||
| 390 | 'href' => '/manifest.json', |
||
| 391 | ]); |
||
| 392 | |||
| 393 | $htmlOutput = $this->document->saveHTML(); |
||
| 394 | |||
| 395 | // Uglify Output |
||
| 396 | if ($this->config->output['uglify'] === true) { |
||
| 397 | $htmlOutput = preg_replace( |
||
| 398 | [ |
||
| 399 | '/\>[^\S ]+/s', // strip whitespaces after tags, except space |
||
| 400 | '/[^\S ]+\</s', // strip whitespaces before tags, except space |
||
| 401 | '/(\s)+/s', // shorten multiple whitespace sequences |
||
| 402 | '/<!--(.|\s)*?-->/', // Remove HTML comments |
||
| 403 | '/<!--(.*)-->/Uis', |
||
| 404 | "/[[:blank:]]+/", |
||
| 405 | ], |
||
| 406 | [ |
||
| 407 | '>', |
||
| 408 | '<', |
||
| 409 | '\\1', |
||
| 410 | '', |
||
| 411 | '', |
||
| 412 | ' ', |
||
| 413 | ], |
||
| 414 | str_replace(["\n", "\r", "\t"], '', $htmlOutput)); |
||
| 415 | } |
||
| 416 | |||
| 417 | // Beautify Output |
||
| 418 | if ($this->config->output['beautify'] === true) { |
||
| 419 | $beautifier = new Html\Dom\Beautifier(); |
||
| 420 | $htmlOutput = $beautifier->format($htmlOutput); |
||
| 421 | } |
||
| 422 | |||
| 423 | if(profiler() !== false) { |
||
| 424 | profiler()->watch('Ending View Rendering'); |
||
| 425 | } |
||
| 426 | |||
| 427 | return $htmlOutput; |
||
| 428 | } |
||
| 430 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.