File Component.php
has 626 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace BootPress\Analytics;
use BootPress\Page\Component as Page;
Method log
has 146 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function log()
{
// Get initial values
$page = Page::html();
$log = array(); // csv lines
Function log
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
public static function log()
{
// Get initial values
$page = Page::html();
$log = array(); // csv lines
- 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 location
has 106 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function location($timezone, $hemisphere = '')
{
static $timezones = array(
'UM12' => 'Baker / Howland Islands',
'UM11' => array(
Method process
has 94 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function process()
{
$page = Page::html();
$file = $page->file('analytics.csv');
$temp = $page->file('analytics-temp.csv');
Function exec
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
private static function exec($action, $table, $values = null)
{
$action = strtolower($action);
if (!isset(self::$stmt[$action][$table])) {
switch ($action) {
- 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 23 (exceeds 5 allowed). Consider refactoring. Open
public static function process()
{
$page = Page::html();
$file = $page->file('analytics.csv');
$temp = $page->file('analytics-temp.csv');
- 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 database
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function database()
{
$page = Page::html();
$db = new SQLite($page->file('Analytics.db'));
if ($db->created || version_compare(self::VERSION, $db->settings('version'), '>')) {
Method exec
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function exec($action, $table, $values = null)
{
$action = strtolower($action);
if (!isset(self::$stmt[$action][$table])) {
switch ($action) {
Function id
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private static function id($table, $value, array $insert = array())
{
settype($value, 'string');
if (isset(self::$ids[$table][$value])) {
return self::$ids[$table][$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"
Further reading
Method id
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function id($table, $value, array $insert = array())
{
settype($value, 'string');
if (isset(self::$ids[$table][$value])) {
return self::$ids[$table][$value];
Function sessionCookie
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private static function sessionCookie()
{
$page = Page::html();
$now = microtime(true);
$time = floor($now);
- 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
Blank line found at start of control structure Open
} elseif (in_array($page->url['format'], array('html', 'pdf', 'txt', 'xml', 'rdf', 'rss', 'atom'))) {
- Exclude checks
Blank line found at start of control structure Open
if ($page->request->isXmlHttpRequest()) {
- Exclude checks
Expected 0 spaces after opening bracket; newline found Open
if (
- Exclude checks