Showing 55 of 55 total issues
Method cleanCache
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function cleanCache()
{
$config = Config::getInstance();
if ($config->appConfigs['file_cache_time_between_cleans'] < 0) {
return;
Function run
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function run()
{
$config = Config::getInstance();
if ($this->isURL) {
if (!$config->appConfigs['allow_external']) {
- 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 tryServerCache
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function tryServerCache()
{
$config = Config::getInstance();
Logger::info('Trying server cache');
if (file_exists($this->cachefile)) {
Method serveExternalImage
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function serveExternalImage()
{
if (!preg_match('/^https?:\/\/[a-zA-Z0-9\-\.]+/i', $this->src)) {
$this->error('Invalid URL supplied.');
Consider simplifying this complex logical expression. Open
if ($imgType == 'png' && OPTIPNG_ENABLED && OPTIPNG_PATH && @is_file(OPTIPNG_PATH)) {
$exec = OPTIPNG_PATH;
Logger::debug("optipng'ing $tempfile");
$presize = filesize($tempfile);
$out = `$exec -o1 $tempfile`; //you can use up to -o7 but it really slows things down
Function calcDocRoot
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function calcDocRoot()
{
$docRoot = @$_SERVER['DOCUMENT_ROOT'];
if (defined('LOCAL_FILE_BASE_DIRECTORY')) {
$docRoot = LOCAL_FILE_BASE_DIRECTORY;
- 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 setCacheDirectory
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function setCacheDirectory()
{
$config = Config::getInstance();
if ($config->appConfigs['file_cache_directory']) {
if (!is_dir($config->appConfigs['file_cache_directory'])) {
- 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 serveWebshot
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected function serveWebshot()
{
Logger::notice('Starting serveWebshot');
$instr = 'Please follow the instructions at http://code.google.com/p/timthumb/ to set your server up for taking website screenshots.';
if (!is_file(WEBSHOT_CUTYCAPT)) {
- 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 $real;
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return LogLevel::ERROR;
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
case 5: return LogLevel::WARNING;
Avoid too many return
statements within this method. Open
return $this->error('Could not get a lock for writing.');
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
case 6: return LogLevel::NOTICE;
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
case 8: return LogLevel::DEBUG;
Avoid too many return
statements within this method. Open
return true;
Avoid too many return
statements within this method. Open
return true;