Showing 127 of 127 total issues
File Photo.php
has 514 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace CameraLife\Models;
/**
* Class Photo provides a front end to working with photos
Identical blocks of code found in 2 locations. Consider refactoring. Open
public function handlePost($get, $post, $files, $cookies)
{
if (Models\User::currentUser($cookies)->authorizationLevel < 5) {
throw new \Exception('You are not authorized to view this page');
}
- 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 238.
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
public function handlePost($get, $post, $files, $cookies)
{
if (Models\User::currentUser($cookies)->authorizationLevel < 5) {
throw new \Exception('You are not authorized to view this page');
}
- 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 238.
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 doUpgrade
has 177 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function doUpgrade()
{
//Database::beginTransaction();
$sql = '
CREATE TABLE "albums" (
Function loadEXIF
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
private function loadEXIF($file)
{
$exif = @exif_read_data($file, 'IFD0', true);
if ($exif === 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
Method setupTables
has 137 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function setupTables()
{
empty(self::$pdoConnection) && self::connect();
$prefix = self::$prefix;
Function listFiles
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
public function listFiles($path = '/', $recursive = true)
{
$fullpath = $this->baseDir . $path;
// FEATURE // add " NOCL" to the end of a folder to exclude it
- 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 render
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
public function render()
{
echo "<h2>Settings for " . $this->moduleName . "</h2>\n";
if (isset($module->about)) {
echo "<p class=\"lead\">" . $module->about . "</p>\n";
- 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 loadEXIF
has 98 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function loadEXIF($file)
{
$exif = @exif_read_data($file, 'IFD0', true);
if ($exif === false) {
return;
Method handleGet
has 95 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handleGet($get, $post, $files, $cookies)
{
// todo, get PREV and NEXT links from photo and use meta prev/next in HTML theme header
$this->htmlBareHeader($cookies);
Method checkPrerequesites
has 93 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function checkPrerequesites()
{
global $_SERVER;
$prerequesitesAreMet = true;
Similar blocks of code found in 2 locations. Consider refactoring. Open
protected function renderNavbar($cookies = array())
{
$navbarView = new Views\NavbarView;
$navbarView->openGraphObject = $this;
$navbarView->currentUser = Models\User::currentUser($cookies);
- 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 156.
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
protected function htmlBareHeader($cookies = array())
{
$view = new Views\HeaderView;
$view->openGraphObject = $this;
$view->currentUser = Models\User::currentUser($cookies);
- 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 156.
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 render
has 89 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function render()
{
if ($this->photo->get('status') != 0) {
echo '<p class="alert alert-danger lead"><strong>Notice:</strong> This photo is not publicly viewable</p>';
}
Photo
has 29 functions (exceeds 20 allowed). Consider refactoring. Open
class Photo extends IndexedModel
{
public $record;
public $image;
Method render
has 87 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function render()
{
if (!count($this->openGraphsForTop)) {
?>
</div>
Identical blocks of code found in 2 locations. Consider refactoring. Open
switch ($view->activeSection) {
case 'newest-folders':
$search->sort = 'newest';
foreach ($search->getFolders() as $folder) {
$view->openGraphsForTop[] = new FolderController($folder->id);
- 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 146.
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
switch ($view->activeSection) {
case 'newest-folders':
$search->sort = 'newest';
foreach ($search->getFolders() as $folder) {
$view->openGraphsForTop[] = new FolderController($folder->id);
- 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 146.
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 render
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function render()
{
echo <<<EOL
<!-- CAMERALIFE PHONE HOME Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-52764-13"></script>
File Database.php
has 295 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace CameraLife\Models;
/**
* PDO wrapper implementation of the database class