Method getTwig
has 239 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getTwig(array $options = array())
{
if (is_null($this->twig)) {
$page = Page::html();
foreach (array('content', 'plugins', 'themes') as $dir) {
File Theme.php
has 509 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace BootPress\Blog\Twig;
use BootPress\Page\Component as Page;
Function getFiles
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
private function getFiles($name, $default = null)
{
$files = array();
if (!empty($name)) {
$page = Page::html();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method renderTwig
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function renderTwig($file, array $vars = array())
{
$page = Page::html();
if (is_array($file)) {
$vars = (isset($file['vars']) && is_array($file['vars'])) ? $file['vars'] : array();
Function renderTwig
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function renderTwig($file, array $vars = array())
{
$page = Page::html();
if (is_array($file)) {
$vars = (isset($file['vars']) && is_array($file['vars'])) ? $file['vars'] : array();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method getFiles
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getFiles($name, $default = null)
{
$files = array();
if (!empty($name)) {
$page = Page::html();
Function this
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function this(\Twig_Template $twig, $key = null, $value = null)
{
$name = $twig->getTemplateName();
if (!isset($this->plugin[$name])) {
$this->plugin[$name] = array();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function wringer
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private static function wringer($data)
{
if (is_object($data)) {
if ($data instanceof \BootPress\Blog\Twig\Object) {
$data = $data->properties + $data->methods;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function asset
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function asset($path, \Twig_Template $twig = null)
{
if (is_string($path)) {
if ($this->asset && preg_match('/^'.implode('', array(
'(?!((f|ht)tps?:)?\/\/)',
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function layout
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function layout($html)
{
$page = Page::html();
$theme = $page->theme;
if ($theme === false) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid too many return
statements within this method. Open
return $this->twig;
Avoid too many return
statements within this method. Open
return $this->renderTwig(array_pop($index), $vars);
Function getTwig
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getTwig(array $options = array())
{
if (is_null($this->twig)) {
$page = Page::html();
foreach (array('content', 'plugins', 'themes') as $dir) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"