Showing 16 of 16 total issues
Function links
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public function links($pad = 3)
{
if ($this->get === false || $this->total === 1) {
return '';
}
- 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 pager
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public function pager($previous = 'Previous', $next = 'Next')
{
$links = '';
if (!empty($previous)) {
if (is_array($previous)) {
- 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 html
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function html($type = 'bootstrap', array $options = array())
{
if ($type == 'links' && !empty($this->links)) {
$this->links = array_merge($this->links, $options);
} elseif ($type == 'pager' && !empty($this->pager)) {
File Component.php
has 267 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace BootPress\Pagination;
use BootPress\Page\Component as Page;
Method links
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function links($pad = 3)
{
if ($this->get === false || $this->total === 1) {
return '';
}
Function __get
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function __get($name)
{
switch ($name) {
case 'pager':
case 'links':
- 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 __get
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __get($name)
{
switch ($name) {
case 'pager':
case 'links':
Function html
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function html($type = 'bootstrap', array $options = array())
{
if ($type == 'links' && !empty($this->links)) {
$this->links = array_merge($this->links, $options);
} elseif ($type == 'pager' && !empty($this->pager)) {
- 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 set
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function set($page = 'page', $limit = 10, $url = null)
{
if (is_null($url)) {
$url = $this->page->url();
}
- 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->get) ? $this->current : 1;
Avoid too many return
statements within this method. Open
return ($this->get) ? $this->total : 1;
Avoid too many return
statements within this method. Open
return ($this->get && $this->current > 1) ? $this->page($this->current - 1) : null;
Avoid too many return
statements within this method. Open
return ($this->get && $this->current < $this->total) ? $this->page($this->current + 1) : null;
Avoid too many return
statements within this method. Open
return ($this->get && $this->current == $this->total) ? true : false;
Avoid too many return
statements within this method. Open
return;
Function format
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function format($string, $value, $url = null)
{
if (is_string($string)) {
if (is_null($url) && is_numeric($value)) {
$url = $value;
- 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"