Showing 33 of 33 total issues
File Component.php
has 798 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace BootPress\Page;
use Symfony\Component\HttpFoundation\Cookie;
Component
has 39 functions (exceeds 20 allowed). Consider refactoring. Open
class Component
{
/**
* A Dependency Injection object that you can access at ``$page->global``. If you access it and this static property is null, we will set up a [Pimple\Container](http://pimple.sensiolabs.org/) object for you.
*
Function url
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
public function url($action = '', $url = '', $key = '', $value = null)
{
if (empty($action)) {
return htmlspecialchars($this->url['full']);
} elseif ($action == 'set') {
- 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 process
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
protected function process($section, $param, $code = 0, $type = '')
{
// Used in $this->send(), $this->display(), $this->styles(), and $this->scripts()
if (!isset($this->filters[$section])) {
return $param;
- 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 folder
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public function folder($dir, $path, $file = 'index.php')
{
$dir = $this->dir($dir);
if (strpos($dir, $this->dir['page']) === 0 && is_dir($dir)) {
$folder = substr($dir, strlen($this->dir['page']));
- 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 isolated
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function isolated(array $url = array(), Request $request = null)
{
extract(array_merge(array(
'dir' => null,
'base' => null,
Function isolated
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public static function isolated(array $url = array(), Request $request = null)
{
extract(array_merge(array(
'dir' => null,
'base' => null,
- 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 url
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function url($action = '', $url = '', $key = '', $value = null)
{
if (empty($action)) {
return htmlspecialchars($this->url['full']);
} elseif ($action == 'set') {
Function redirect
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
protected function redirect()
{
$redirect = false;
$file = $this->file('301.txt');
if (is_file($file)) {
- 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 folder
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function folder($dir, $path, $file = 'index.php')
{
$dir = $this->dir($dir);
if (strpos($dir, $this->dir['page']) === 0 && is_dir($dir)) {
$folder = substr($dir, strlen($this->dir['page']));
Method display
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function display($content)
{
$html = array();
if (preg_match('/<\s*!doctype\s.*>/i', $content, $match)) {
$content = mb_substr(mb_strstr($content, $match[0]), mb_strlen($match[0]));
Function started
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private function started()
{
if (is_null(self::$started)) {
self::$started = (session_status() === PHP_SESSION_ACTIVE) ? true : session_start();
if (self::$started) {
- 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 link
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function link($link, $prepend = false)
{
$link = (array) $link;
if ($prepend !== false) {
$link = array_reverse($link); // so they are added in the correct order
- 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 filter
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function filter($section, callable $function, array $params = array('this'), $order = 10)
{
if ($section == 'response') {
foreach ($params as $key => $value) {
if (empty($value) || $value == 'this') {
- 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 metadata
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function metadata($head = null)
{
// Used in $this->display()
$metadata = array();
if (empty($head) || !preg_match('/<\s*meta\s(?=[^>]*?\b(charset)\s*=)/i', $head)) {
Function metadata
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected function metadata($head = null)
{
// Used in $this->display()
$metadata = array();
if (empty($head) || !preg_match('/<\s*meta\s(?=[^>]*?\b(charset)\s*=)/i', $head)) {
- 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 remove
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function remove($key)
{
if ($this->resumable() && $this->started()) {
$unset = &$_SESSION;
foreach (func_get_args() as $key) {
- 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 link
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function link($link, $prepend = false)
{
$link = (array) $link;
if ($prepend !== false) {
$link = array_reverse($link); // so they are added in the correct order
Function html
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public static function html(array $url = array(), Request $request = null, $overthrow = false)
{
if ($overthrow || null === static::$instance) {
$page = static::isolated($url, $request);
if ($page->url['format'] == 'html' && isset($url['base']) && is_string($url['base'])) {
- 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 commonDir
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function commonDir(array $files)
{
$files = array_values($files);
$cut = 0;
$count = count($files);
- 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"