Showing 51 of 53 total issues
Method updateDatabase
has 41 lines of code (exceeds 25 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'));
Method archives
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function archives($params, array $vars = array())
{
$page = Page::html();
list($path, $Y, $m, $d) = array_pad(array_values($params), 4, '');
if (!empty($d)) {
Method listings
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function listings($params, array $vars = array())
{
$page = Page::html();
extract($params); // 'path'?, 'category'? and 'search'?
if (isset($category)) {
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
Function listings
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private function listings($params, array $vars = array())
{
$page = Page::html();
extract($params); // 'path'?, 'category'? and 'search'?
if (isset($category)) {
- 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();
Method page
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function page()
{
$page = Page::html();
$listings = $this->config('blog', 'listings');
if ($page->url['format'] != 'html') {
Function parseArrayExpression
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function parseArrayExpression()
{
$stream = $this->parser->getStream();
$stream->expect(Twig_Token::PUNCTUATION_TYPE, '[', 'An array element was expected');
- 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 page
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function page()
{
$page = Page::html();
$listings = $this->config('blog', 'listings');
if ($page->url['format'] != '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 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 updateConfig
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function updateConfig()
{
if ($this->getId('updated', 'anything') === false) {
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 blog
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function blog($params, array $vars = array())
{
$page = Page::html();
extract($params); // 'id' and 'path'
$page->enforce($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
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 __construct
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function __construct($folder = 'blog')
{
$page = Page::html();
// $this->folder
- 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->db->value(array(
'SELECT COUNT(*) FROM tagged AS t',
'INNER JOIN blog AS b ON t.blog_id = b.id',
'INNER JOIN tags ON t.tag_id = tags.id',
'WHERE b.featured <= 0 AND b.published < 0 AND tags.path = ?',
Avoid too many return
statements within this method. Open
return $posts;
Avoid too many return
statements within this method. Open
return $this->db->value(array(
'SELECT COUNT(*) FROM blog',
'WHERE featured <= 0 AND published < 0',
), $vars);
Avoid too many return
statements within this method. Open
return;