Showing 51 of 53 total issues
Function query
has a Cognitive Complexity of 146 (exceeds 5 allowed). Consider refactoring. Open
public function query($type, $params = null)
{
$posts = array();
if (is_array($type)) { // listings
$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
File Blog.php
has 942 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace BootPress\Blog;
use BootPress\Page\Component as Page;
Method query
has 371 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function query($type, $params = null)
{
$posts = array();
if (is_array($type)) { // listings
$vars = array();
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 config
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
public function config($key = null)
{
$args = func_get_args(); // In PHP7, func_get_args() are changed by the time we use them, so we call it now
if (is_null($this->config)) {
$file = $this->folder.'config.yml';
- 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 getId
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
private function getId($table, $value)
{
if (is_null($this->ids)) {
$this->ids = array(
'updated' => 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 info
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function info($ids)
{
$page = Page::html();
$single = (is_array($ids)) ? false : true;
if (empty($ids)) {
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
Function file
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public function file($path)
{
$blog = $this->db->row('SELECT id, path, updated, search, content FROM blog WHERE path = ?', $path, 'assoc');
if (!$current = $this->blogInfo($path)) { // delete
if ($blog) {
- 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 info
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public function info($ids)
{
$page = Page::html();
$single = (is_array($ids)) ? false : true;
if (empty($ids)) {
- 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 __construct
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct($folder = 'blog')
{
$page = Page::html();
// $this->folder
Method updateConfig
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function updateConfig()
{
if ($this->getId('updated', 'anything') === false) {
return;
}
Function blogInfo
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
private function blogInfo($path)
{
$page = Page::html();
$dir = $this->folder.'content/';
if (preg_match('/[^'.$page->url['chars'].'\/]/', $path)) {
- 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 getId
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getId($table, $value)
{
if (is_null($this->ids)) {
$this->ids = array(
'updated' => array(
Method file
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function file($path)
{
$blog = $this->db->row('SELECT id, path, updated, search, content FROM blog WHERE path = ?', $path, 'assoc');
if (!$current = $this->blogInfo($path)) { // delete
if ($blog) {
Function updateDatabase
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
private function updateDatabase()
{
set_time_limit(0);
$blog = $this->db->insert('blog', array('page', 'path', 'title', 'featured', 'published', 'updated', 'author_id', 'category_id', 'search', 'content'));
$tagged = $this->db->insert('tagged', array('blog_id', 'tag_id'));
- 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 blogInfo
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function blogInfo($path)
{
$page = Page::html();
$dir = $this->folder.'content/';
if (preg_match('/[^'.$page->url['chars'].'\/]/', $path)) {
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();
Method config
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function config($key = null)
{
$args = func_get_args(); // In PHP7, func_get_args() are changed by the time we use them, so we call it now
if (is_null($this->config)) {
$file = $this->folder.'config.yml';