app/Conditions/QueryFields/IntegerField.php
Avoid using static access to class '\App\Purifier' in method 'operatorA'. Open
Open
$value = \App\Purifier::decodeHtml($this->value);
- 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 variables with short names like $ev. Configured minimum length is 3. Open
Open
$ev = explode($exo, $value);
- 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
Spaces must be used to indent lines; tabs are not allowed Open
Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* Auto operator, it allows you to use formulas: >10 <40, >1, <7.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
foreach (static::$extendedOperators as $exo) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @var string[] List of extended operators
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function operatorA(): array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$condition[] = [$exo, $this->getColumnName(), (int) $ev[1]];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
if (false !== strpos($value, $exo)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$ev = explode($exo, $value);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$conditionFound = true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
use \App\Conditions\QueryTraits\Comparison;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public static $extendedOperators = ['>=', '<=', '<', '>'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
use \App\Conditions\QueryTraits\ComparisonField;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$value = str_replace($exo . (int) $ev[1], '', $value);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @return array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$value = \App\Purifier::decodeHtml($this->value);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$conditionFound = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$condition = ['and'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function getOperator(): string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
if (!$conditionFound) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function operatorNy(): array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
return 'a' === $this->operator ? 'e' : $this->operator;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function operatorY(): array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
return [$this->getColumnName() => null];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @return array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
return parent::operatorE();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
return $condition;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* Is empty operator.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @return array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
return ['not', [$this->getColumnName() => null]];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* Is not empty operator.
- Exclude checks