Showing 16,700 of 16,700 total issues
File Users.php
has 396 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace BootPress\Admin\Pages;
use BootPress\Admin\Component as Admin;
File Component.php
has 392 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace BootPress\Auth;
use BootPress\Page\Component as Page;
Method robots
has 131 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function robots()
{
extract(Admin::params('bp', 'blog', 'website', 'page'));
$page->title = 'Robot Analytics at '.$website;
$html = '';
Method __construct
has 128 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct(array $options = array())
{
extract(array_merge(array(
'db' => null,
'basic' => null,
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 visitors
has 127 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function visitors()
{
extract(Admin::params('bp', 'website', 'page', 'path', 'admin'));
$page->title = 'Visitors at '.$website;
$html = '';
Function save
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
public static function save(array $files, array $remove = array())
{
$page = Page::html();
if (($retrieve = $page->post('retrieve')) && isset($files[$retrieve])) {
exit(is_file($files[$retrieve]) ? file_get_contents($files[$retrieve]) : '');
- 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 update
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
public function update($user_id, array $user = array())
{
$update = array();
foreach ($user as $key => $value) {
switch ($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
Similar blocks of code found in 2 locations. Consider refactoring. Open
'crc-32' => str_pad(dechex(ord($dir['crc-32'][3])), 2, '0', STR_PAD_LEFT).
str_pad(dechex(ord($dir['crc-32'][2])), 2, '0', STR_PAD_LEFT).
str_pad(dechex(ord($dir['crc-32'][1])), 2, '0', STR_PAD_LEFT).
str_pad(dechex(ord($dir['crc-32'][0])), 2, '0', STR_PAD_LEFT),
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 181.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
'crc-32' => str_pad(dechex(ord($file['crc-32'][3])), 2, '0', STR_PAD_LEFT).
str_pad(dechex(ord($file['crc-32'][2])), 2, '0', STR_PAD_LEFT).
str_pad(dechex(ord($file['crc-32'][1])), 2, '0', STR_PAD_LEFT).
str_pad(dechex(ord($file['crc-32'][0])), 2, '0', STR_PAD_LEFT),
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 181.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method theme
has 118 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function theme($folder)
{
extract(Admin::params('bp', 'page', 'blog'));
if ($page->get('delete') == 'theme') {
list($dirs, $files) = Files::iterate($folder, 'recursive');
Method __construct
has 115 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct(array $enable = array(), array $messages = array())
{
if (self::$debugbar) {
return;
}
Function robots
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
private function robots()
{
extract(Admin::params('bp', 'blog', 'website', 'page'));
$page->title = 'Robot Analytics at '.$website;
$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
Method image
has 114 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function image($path, $eject = '')
{
$html = '';
$imagick = (extension_loaded('imagick') && class_exists('Imagick')) ? true : false;
$types = array('jpg', 'gif', 'png');
Method file
has 107 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function file($field, array $options = array())
{
$page = Page::html();
// View
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(
File Component.php
has 340 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace BootPress\Unzip;
use BootPress\Page\Component as Page;
Function iterate
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
public static function iterate($path, $recursive = false, $types = null)
{
$dirs = $files = array();
if (is_dir($path)) {
$cut = strlen($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 server
has 97 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function server()
{
extract(Admin::params('bp', 'website', 'page'));
$page->title = 'Server Analytics at '.$website;
$page->link(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');