getAlbumPhotoPage accesses the super-global variable $GLOBALS. Open
public function getAlbumPhotoPage($catId, $start, $sortby, $orderby)
{
$criteria = new CriteriaCompo();
$criteria->add(new Criteria('cat_id', $catId));
$criteria->add(new Criteria('photo_approved', 1));
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
makeFileName accesses the super-global variable $GLOBALS. Open
public function makeFileName($fileName)
{
//DNPROSSI
//$fileName = preg_replace("/[^a-zA-Z0-9()_\.-]/", "-", $fileName);
$fileName = \preg_replace("/[^a-zA-Z0-9_\.-]/", '-', $fileName);
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
postPhotoTraitement accesses the super-global variable $_POST. Open
public function postPhotoTraitement($file, $checkMd5 = false)
{
// require_once XOOPS_ROOT_PATH.'/modules/extgallery/class/photoUploader.php';
$catHandler = Extgallery\Helper::getInstance()->getHandler('PublicCategory');
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
getAlbumPhotoAdminPage accesses the super-global variable $GLOBALS. Open
public function getAlbumPhotoAdminPage($catId, $start)
{
$criteria = new CriteriaCompo();
$criteria->add(new Criteria('cat_id', $catId));
$criteria->add(new Criteria('photo_approved', 1));
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
postPhotoTraitement accesses the super-global variable $_POST. Open
public function postPhotoTraitement($file, $checkMd5 = false)
{
// require_once XOOPS_ROOT_PATH.'/modules/extgallery/class/photoUploader.php';
$catHandler = Extgallery\Helper::getInstance()->getHandler('PublicCategory');
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
getSlideshowAlbumPhoto accesses the super-global variable $GLOBALS. Open
public function getSlideshowAlbumPhoto($catId)
{
$criteria = new CriteriaCompo();
$criteria->add(new Criteria('cat_id', $catId));
$criteria->add(new Criteria('photo_approved', 1));
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
getAlbumPhotoPage accesses the super-global variable $GLOBALS. Open
public function getAlbumPhotoPage($catId, $start, $sortby, $orderby)
{
$criteria = new CriteriaCompo();
$criteria->add(new Criteria('cat_id', $catId));
$criteria->add(new Criteria('photo_approved', 1));
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
postPhotoTraitement accesses the super-global variable $_POST. Open
public function postPhotoTraitement($file, $checkMd5 = false)
{
// require_once XOOPS_ROOT_PATH.'/modules/extgallery/class/photoUploader.php';
$catHandler = Extgallery\Helper::getInstance()->getHandler('PublicCategory');
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
postPhotoTraitement accesses the super-global variable $_POST. Open
public function postPhotoTraitement($file, $checkMd5 = false)
{
// require_once XOOPS_ROOT_PATH.'/modules/extgallery/class/photoUploader.php';
$catHandler = Extgallery\Helper::getInstance()->getHandler('PublicCategory');
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
addLocalPhoto accesses the super-global variable $GLOBALS. Open
public function addLocalPhoto(
$catId,
$dirtyPhotoName,
$photoTitle = '',
$photoDesc = '',
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
addLocalPhoto accesses the super-global variable $GLOBALS. Open
public function addLocalPhoto(
$catId,
$dirtyPhotoName,
$photoTitle = '',
$photoDesc = '',
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
_makeWatermark accesses the super-global variable $GLOBALS. Open
public function _makeWatermark($imageTransform)
{
if (!\function_exists('imagettfbbox')) {
return;
}
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
getAlbumPhotoAdminPage accesses the super-global variable $GLOBALS. Open
public function getAlbumPhotoAdminPage($catId, $start)
{
$criteria = new CriteriaCompo();
$criteria->add(new Criteria('cat_id', $catId));
$criteria->add(new Criteria('photo_approved', 1));
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
makeFileName accesses the super-global variable $GLOBALS. Open
public function makeFileName($fileName)
{
//DNPROSSI
//$fileName = preg_replace("/[^a-zA-Z0-9()_\.-]/", "-", $fileName);
$fileName = \preg_replace("/[^a-zA-Z0-9_\.-]/", '-', $fileName);
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
addLocalPhoto accesses the super-global variable $GLOBALS. Open
public function addLocalPhoto(
$catId,
$dirtyPhotoName,
$photoTitle = '',
$photoDesc = '',
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
File PhotoHandler.php
has 659 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace XoopsModules\Extgallery;
/**
PhotoHandler
has 48 functions (exceeds 20 allowed). Consider refactoring. Open
class PhotoHandler extends Extgallery\PersistableObjectHandler
{
public $photoUploader = null;
/**
The class PhotoHandler has an overall complexity of 119 which is very high. The configured complexity threshold is 50. Open
class PhotoHandler extends Extgallery\PersistableObjectHandler
{
public $photoUploader = null;
/**
- Exclude checks
The class PhotoHandler has 23 public methods. Consider refactoring PhotoHandler to keep number of public methods under 10. Open
class PhotoHandler extends Extgallery\PersistableObjectHandler
{
public $photoUploader = null;
/**
- Read upRead up
- Exclude checks
TooManyPublicMethods
Since: 0.1
A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.
By default it ignores methods starting with 'get' or 'set'.
Example
Source https://phpmd.org/rules/codesize.html#toomanypublicmethods
Method postPhotoTraitement
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function postPhotoTraitement($file, $checkMd5 = false)
{
// require_once XOOPS_ROOT_PATH.'/modules/extgallery/class/photoUploader.php';
$catHandler = Extgallery\Helper::getInstance()->getHandler('PublicCategory');
Method _makeWatermark
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _makeWatermark($imageTransform)
{
if (!\function_exists('imagettfbbox')) {
return;
}
Method addLocalPhoto
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function addLocalPhoto(
$catId,
$dirtyPhotoName,
$photoTitle = '',
$photoDesc = '',
Function postPhotoTraitement
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function postPhotoTraitement($file, $checkMd5 = false)
{
// require_once XOOPS_ROOT_PATH.'/modules/extgallery/class/photoUploader.php';
$catHandler = Extgallery\Helper::getInstance()->getHandler('PublicCategory');
- 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 _largePhotoTreatment
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function _largePhotoTreatment($photoName)
{
/** @var Extgallery\Helper $helper */
$helper = Extgallery\Helper::getInstance();
- 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 getSearchedPhoto
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getSearchedPhoto($queryArray, $condition, $limit, $start, $userId)
{
$criteria = new CriteriaCompo();
if ($userId > 0) {
$criteria->add(new Criteria('uid', $userId));
Function _mediumPhotoTreatment
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function _mediumPhotoTreatment($photoName, $filePath = null, $mediumFilePath = null)
{
/** @var Extgallery\Helper $helper */
$helper = Extgallery\Helper::getInstance();
- 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 _mediumPhotoTreatment
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _mediumPhotoTreatment($photoName, $filePath = null, $mediumFilePath = null)
{
/** @var Extgallery\Helper $helper */
$helper = Extgallery\Helper::getInstance();
The class PhotoHandler has 49 public methods and attributes. Consider reducing the number of public items to less than 45. Open
class PhotoHandler extends Extgallery\PersistableObjectHandler
{
public $photoUploader = null;
/**
- Read upRead up
- Exclude checks
ExcessivePublicCount
Since: 0.1
A large number of public methods and attributes declared in a class can indicate the class may need to be broken up as increased effort will be required to thoroughly test it.
Example
public class Foo {
public $value;
public $something;
public $var;
// [... more more public attributes ...]
public function doWork() {}
public function doMoreWork() {}
public function doWorkAgain() {}
// [... more more public methods ...]
}
Source https://phpmd.org/rules/codesize.html#excessivepubliccount
Function _makeWatermark
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function _makeWatermark($imageTransform)
{
if (!\function_exists('imagettfbbox')) {
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 getSearchedPhoto
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function getSearchedPhoto($queryArray, $condition, $limit, $start, $userId)
{
$criteria = new CriteriaCompo();
if ($userId > 0) {
$criteria->add(new Criteria('uid', $userId));
- 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 addLocalPhoto
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
$catId,
$dirtyPhotoName,
$photoTitle = '',
$photoDesc = '',
$photoExtra = '',
Method getSearchedPhoto
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function getSearchedPhoto($queryArray, $condition, $limit, $start, $userId)
Avoid too many return
statements within this method. Open
return 1;
The method postPhotoTraitement() has 113 lines of code. Current threshold is set to 100. Avoid really long methods. Open
public function postPhotoTraitement($file, $checkMd5 = false)
{
// require_once XOOPS_ROOT_PATH.'/modules/extgallery/class/photoUploader.php';
$catHandler = Extgallery\Helper::getInstance()->getHandler('PublicCategory');
- Exclude checks
The class PhotoHandler has 1106 lines of code. Current threshold is 1000. Avoid really long classes. Open
class PhotoHandler extends Extgallery\PersistableObjectHandler
{
public $photoUploader = null;
/**
- Exclude checks
The method postPhotoTraitement() has an NPath complexity of 720. The configured NPath complexity threshold is 200. Open
public function postPhotoTraitement($file, $checkMd5 = false)
{
// require_once XOOPS_ROOT_PATH.'/modules/extgallery/class/photoUploader.php';
$catHandler = Extgallery\Helper::getInstance()->getHandler('PublicCategory');
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The method postPhotoTraitement() has a Cyclomatic Complexity of 13. The configured cyclomatic complexity threshold is 10. Open
public function postPhotoTraitement($file, $checkMd5 = false)
{
// require_once XOOPS_ROOT_PATH.'/modules/extgallery/class/photoUploader.php';
$catHandler = Extgallery\Helper::getInstance()->getHandler('PublicCategory');
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
The method _makeWatermark() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10. Open
public function _makeWatermark($imageTransform)
{
if (!\function_exists('imagettfbbox')) {
return;
}
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
The method _mediumPhotoTreatment() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10. Open
public function _mediumPhotoTreatment($photoName, $filePath = null, $mediumFilePath = null)
{
/** @var Extgallery\Helper $helper */
$helper = Extgallery\Helper::getInstance();
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
The method postPhotoTraitement has a boolean flag argument $checkMd5, which is a certain sign of a Single Responsibility Principle violation. Open
public function postPhotoTraitement($file, $checkMd5 = false)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
Avoid using static access to class '\XoopsModules\Extgallery\Helper' in method '_makeThumb'. Open
$helper = Extgallery\Helper::getInstance();
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Xmf\Request' in method 'postPhotoTraitement'. Open
if (Request::hasVar('photo_extra', 'POST')) {
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\XoopsModules\Extgallery\PublicPermHandler' in method 'addLocalPhoto'. Open
$permHandler = Extgallery\PublicPermHandler::getInstance();
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Xmf\Request' in method 'postPhotoTraitement'. Open
$catId = Request::getInt('cat_id', 0, 'POST');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Xmf\Request' in method 'postPhotoTraitement'. Open
$jufinal = Request::getInt('jufinal', 1, 'POST');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
The method _getImageDimension uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$imageTransform->load($this->getUploadPhotoPath() . 'medium/' . $photoName);
$ret['width'] = $imageTransform->getImageWidth();
$ret['height'] = $imageTransform->getImageHeight();
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class '\Xmf\Request' in method 'postPhotoTraitement'. Open
if (Request::hasVar('photo_title', 'POST')) {
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\XoopsModules\Extgallery\Helper' in method 'getAutoDescription'. Open
$helper = Extgallery\Helper::getInstance();
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Xmf\Request' in method 'postPhotoTraitement'. Open
$jupart = Request::getInt('jupart', 0, 'POST');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\XoopsModules\Extgallery\Helper' in method '_makeWatermark'. Open
$helper = Extgallery\Helper::getInstance();
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\XoopsModules\Extgallery\Helper' in method '_largePhotoTreatment'. Open
$helper = Extgallery\Helper::getInstance();
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\XoopsModules\Extgallery\Helper' in method 'addLocalPhoto'. Open
$helper = Extgallery\Helper::getInstance();
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
The method getSearchedPhoto uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$title = $photo->getVar('photo_desc');
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class '\XoopsModules\Extgallery\Helper' in method '_getImageDimension'. Open
$helper = Extgallery\Helper::getInstance();
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Xmf\Request' in method 'postPhotoTraitement'. Open
if (Request::hasVar('photo_desc', 'POST')) {
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Xmf\Request' in method 'postPhotoTraitement'. Open
if (Request::hasVar('tag', 'POST')) {
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
The method postPhotoTraitement uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
// We got a chunk, so we don't add photo to database
if ($jupart && !$jufinal) {
return 5;
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method _mediumPhotoTreatment uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$borderSize = 0;
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class '\XoopsModules\Extgallery\Helper' in method '_makeBorder'. Open
$helper = Extgallery\Helper::getInstance();
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
The method getCatPhoto uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$criteria = new Criteria('cat_id', '(0)', 'IN');
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class '\XoopsModules\Extgallery\Helper' in method '_mediumPhotoTreatment'. Open
$helper = Extgallery\Helper::getInstance();
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
The method deleteFile() contains an exit expression. Open
exit('deleteFile() method must be defined on sub classes');
- Read upRead up
- Exclude checks
ExitExpression
Since: 0.2
An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.
Example
class Foo {
public function bar($param) {
if ($param === 42) {
exit(23);
}
}
}
Source https://phpmd.org/rules/design.html#exitexpression
The method getUploadPhotoPath() contains an exit expression. Open
exit('getUploadPhotoPath() method must be defined on sub classes');
- Read upRead up
- Exclude checks
ExitExpression
Since: 0.2
An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.
Example
class Foo {
public function bar($param) {
if ($param === 42) {
exit(23);
}
}
}
Source https://phpmd.org/rules/design.html#exitexpression
Avoid unused parameters such as '$checkMd5'. Open
public function postPhotoTraitement($file, $checkMd5 = false)
- Read upRead up
- Exclude checks
UnusedFormalParameter
Since: 0.2
Avoid passing parameters to methods or constructors and then not using those parameters.
Example
class Foo
{
private function bar($howdy)
{
// $howdy is not used
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter
Avoid unused local variables such as '$catHandler'. Open
$catHandler = Extgallery\Helper::getInstance()->getHandler('PublicCategory');
- Read upRead up
- Exclude checks
UnusedLocalVariable
Since: 0.2
Detects when a local variable is declared and/or assigned, but not used.
Example
class Foo {
public function doSomething()
{
$i = 5; // Unused
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable
The method getAllSize() contains an exit expression. Open
exit('getAllSize() method must be defined on sub classes');
- Read upRead up
- Exclude checks
ExitExpression
Since: 0.2
An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.
Example
class Foo {
public function bar($param) {
if ($param === 42) {
exit(23);
}
}
}
Source https://phpmd.org/rules/design.html#exitexpression
Similar blocks of code found in 4 locations. Consider refactoring. Open
public function getAlbumPrevPhoto($catId, $photoId)
{
$catHandler = Extgallery\Helper::getInstance()->getHandler('PublicCategory');
$criteria = new CriteriaCompo();
- 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 148.
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 4 locations. Consider refactoring. Open
public function getAlbumNextPhoto($catId, $photoId)
{
$catHandler = Extgallery\Helper::getInstance()->getHandler('PublicCategory');
$criteria = new CriteriaCompo();
- 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 148.
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
public function getAlbumCurrentPhotoPlace($catId, $photoId)
{
$catHandler = Extgallery\Helper::getInstance()->getHandler('PublicCategory');
$criteria = new CriteriaCompo();
- 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 139.
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 4 locations. Consider refactoring. Open
public function getLastPhoto($param)
{
$catHandler = Extgallery\Helper::getInstance()->getHandler('PublicCategory');
$criteria = new CriteriaCompo();
- 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 123.
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 4 locations. Consider refactoring. Open
public function getTopViewPhoto($param)
{
$catHandler = Extgallery\Helper::getInstance()->getHandler('PublicCategory');
$criteria = new CriteriaCompo();
- 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 123.
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 4 locations. Consider refactoring. Open
public function getTopRatedPhoto($param)
{
$catHandler = Extgallery\Helper::getInstance()->getHandler('PublicCategory');
$criteria = new CriteriaCompo();
- 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 123.
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 4 locations. Consider refactoring. Open
public function getTopEcardPhoto($param)
{
$catHandler = Extgallery\Helper::getInstance()->getHandler('PublicCategory');
$criteria = new CriteriaCompo();
- 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 123.
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
Avoid variables with short names like $y. Configured minimum length is 3. Open
$y = 0;
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $in. Configured minimum length is 3. Open
$in = '(' . $data[0];
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $db. Configured minimum length is 3. Open
public function __construct(XoopsDatabase $db, $type)
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $in. Configured minimum length is 3. Open
$in = '(' . $cats[0]->getVar('cat_id');
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $x. Configured minimum length is 3. Open
$x = 0;
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Method name "_makeBorder" should not be prefixed with an underscore to indicate visibility Open
public function _makeBorder($imageTransform)
- Exclude checks
Method name "_makeWatermark" should not be prefixed with an underscore to indicate visibility Open
public function _makeWatermark($imageTransform)
- Exclude checks
Method name "_haveLargePhoto" should not be prefixed with an underscore to indicate visibility Open
public function _haveLargePhoto($photoName)
- Exclude checks
Method name "_getImageDimension" should not be prefixed with an underscore to indicate visibility Open
public function _getImageDimension($photoName)
- Exclude checks
Method name "_mediumPhotoTreatment" should not be prefixed with an underscore to indicate visibility Open
public function _mediumPhotoTreatment($photoName, $filePath = null, $mediumFilePath = null)
- Exclude checks
There must be one blank line after the last USE statement; 11 found; Open
use function md5;
- Exclude checks
Method name "_largePhotoTreatment" should not be prefixed with an underscore to indicate visibility Open
public function _largePhotoTreatment($photoName)
- Exclude checks
Method name "_makeThumb" should not be prefixed with an underscore to indicate visibility Open
public function _makeThumb($photoName)
- Exclude checks
The 'getPhoto()' method which returns a boolean should be named 'is...()' or 'has...()' Open
public function getPhoto($photoId)
{
$criteria = new CriteriaCompo();
$criteria->add(new Criteria('photo_id', $photoId));
$criteria->add(new Criteria('photo_approved', 1));
- Read upRead up
- Exclude checks
BooleanGetMethodName
Since: 0.2
Looks for methods named 'getX()' with 'boolean' as the return type. The convention is to name these methods 'isX()' or 'hasX()'.
Example
class Foo {
/**
* @return boolean
*/
public function getFoo() {} // bad
/**
* @return bool
*/
public function isFoo(); // ok
/**
* @return boolean
*/
public function getFoo($bar); // ok, unless checkParameterizedMethods=true
}
Source https://phpmd.org/rules/naming.html#booleangetmethodname
Line exceeds 120 characters; contains 143 characters Open
$photoStatus = $this->addLocalPhoto($catId, $this->photoUploader->getSavedFileName(), $photoTitle, $photoDesc, $photoExtra, $photoTag);
- Exclude checks
Line exceeds 120 characters; contains 126 characters Open
$tagHandler = \XoopsModules\Tag\Helper::getInstance()->getHandler('Tag'); // xoops_getModuleHandler('tag', 'tag');
- Exclude checks
Line exceeds 120 characters; contains 140 characters Open
$text = (0 == $helper->getConfig('watermark_type')) ? $GLOBALS['xoopsUser']->getVar('uname') : $helper->getConfig('watermark_text');
- Exclude checks
Line exceeds 120 characters; contains 160 characters Open
$sql = 'SELECT photo_id FROM ' . $this->db->prefix('extgallery_publicphoto') . ' ' . $criteria->renderWhere() . ' ORDER BY photo_weight, photo_id ASC;';
- Exclude checks
Line exceeds 120 characters; contains 130 characters Open
$imageTransform->fit($helper->getConfig('medium_width') - $borderSize, $helper->getConfig('medium_heigth') - $borderSize);
- Exclude checks
Line exceeds 120 characters; contains 137 characters Open
// $allowedMimeTypes = array('jpg/jpeg', 'image/bmp', 'image/gif', 'image/jpeg', 'image/jpg', 'image/x-png', 'image/png');
- Exclude checks
The method _makeWatermark is not named in camelCase. Open
public function _makeWatermark($imageTransform)
{
if (!\function_exists('imagettfbbox')) {
return;
}
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}
Source
The method _mediumPhotoTreatment is not named in camelCase. Open
public function _mediumPhotoTreatment($photoName, $filePath = null, $mediumFilePath = null)
{
/** @var Extgallery\Helper $helper */
$helper = Extgallery\Helper::getInstance();
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}
Source
The method _getImageDimension is not named in camelCase. Open
public function _getImageDimension($photoName)
{
/** @var Extgallery\Helper $helper */
$helper = Extgallery\Helper::getInstance();
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}
Source
The method _haveLargePhoto is not named in camelCase. Open
public function _haveLargePhoto($photoName)
{
return \file_exists($this->getUploadPhotoPath() . 'large/large_' . $photoName);
}
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}
Source
The method _largePhotoTreatment is not named in camelCase. Open
public function _largePhotoTreatment($photoName)
{
/** @var Extgallery\Helper $helper */
$helper = Extgallery\Helper::getInstance();
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}
Source
The method _makeBorder is not named in camelCase. Open
public function _makeBorder($imageTransform)
{
/** @var Extgallery\Helper $helper */
$helper = Extgallery\Helper::getInstance();
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}
Source
The method _makeThumb is not named in camelCase. Open
public function _makeThumb($photoName)
{
/** @var Extgallery\Helper $helper */
$helper = Extgallery\Helper::getInstance();
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}