Function purifyByType
has a Cognitive Complexity of 71 (exceeds 5 allowed). Consider refactoring. Open
public static function purifyByType($input, $type, $convert = false)
{
if (\is_array($input)) {
$value = [];
foreach ($input as $k => $v) {
- 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
File Purifier.php
has 426 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Purifier file.
*
* @package App
Method purifyByType
has 145 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function purifyByType($input, $type, $convert = false)
{
if (\is_array($input)) {
$value = [];
foreach ($input as $k => $v) {
Method getHtmlConfig
has 95 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getHtmlConfig(array $options = [])
{
$config = \HTMLPurifier_Config::createDefault();
$config->set('Core.Encoding', static::$defaultCharset);
$config->set('Cache.SerializerPermissions', 0775);
The class Purifier has an overall complexity of 120 which is very high. The configured complexity threshold is 50. Open
class Purifier
{
/** @var string Purify type date in user format. */
public const DATE_USER_FORMAT = 'DateInUserFormat';
- Exclude checks
Function purify
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public static function purify($input, $loop = true)
{
if (empty($input)) {
return $input;
}
- 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 purify
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function purify($input, $loop = true)
{
if (empty($input)) {
return $input;
}
Method purifyHtml
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function purifyHtml(string $input, $loop = true): string
{
if (empty($input)) {
return $input;
}
Function purifyHtml
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function purifyHtml(string $input, $loop = true): string
{
if (empty($input)) {
return $input;
}
- 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 purifyTextParser
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function purifyTextParser($input, $loop = true): string
{
if (empty($input)) {
return $input;
}
- 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
The method purifyByType() has 148 lines of code. Current threshold is set to 100. Avoid really long methods. Open
public static function purifyByType($input, $type, $convert = false)
{
if (\is_array($input)) {
$value = [];
foreach ($input as $k => $v) {
- Exclude checks
The method getHtmlConfig() has 100 lines of code. Current threshold is set to 100. Avoid really long methods. Open
public static function getHtmlConfig(array $options = [])
{
$config = \HTMLPurifier_Config::createDefault();
$config->set('Core.Encoding', static::$defaultCharset);
$config->set('Cache.SerializerPermissions', 0775);
- Exclude checks
The method purifyByType() has a Cyclomatic Complexity of 76. The configured cyclomatic complexity threshold is 10. Open
public static function purifyByType($input, $type, $convert = false)
{
if (\is_array($input)) {
$value = [];
foreach ($input as $k => $v) {
- 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 purify() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10. Open
public static function purify($input, $loop = true)
{
if (empty($input)) {
return $input;
}
- 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
Reduce the number of returns of this function 4, down to the maximum allowed 3. Open
public static function purifyByType($input, $type, $convert = false)
- Read upRead up
- Exclude checks
Having too many return statements in a function increases the function's essential complexity because the flow of execution is broken each time a return statement is encountered. This makes it harder to read and understand the logic of the function.
Noncompliant Code Example
With the default threshold of 3:
function myFunction(){ // Noncompliant as there are 4 return statements if (condition1) { return true; } else { if (condition2) { return false; } else { return true; } } return false; }
Refactor this function to reduce its Cognitive Complexity from 19 to the 15 allowed. Open
public static function purify($input, $loop = true)
- Read upRead up
- Exclude checks
Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.
See
Refactor this function to reduce its Cognitive Complexity from 119 to the 15 allowed. Open
public static function purifyByType($input, $type, $convert = false)
- Read upRead up
- Exclude checks
Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.
See
Missing class import via use statement (line '405', column '13'). Open
throw new \App\Exceptions\IllegalValue('ERR_NOT_ALLOWED_VALUE||' . $input, 406);
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '141', column '39'). Open
static::$purifyInstanceCache = new \HTMLPurifier($config);
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '228', column '49'). Open
static::$purifyTextParserInstanceCache = new \HTMLPurifier($config);
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '189', column '43'). Open
static::$purifyHtmlInstanceCache = new \HTMLPurifier($config);
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
The method purifyByType has a boolean flag argument $convert, which is a certain sign of a Single Responsibility Principle violation. Open
public static function purifyByType($input, $type, $convert = 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
The method purifyHtml has a boolean flag argument $loop, which is a certain sign of a Single Responsibility Principle violation. Open
public static function purifyHtml(string $input, $loop = true): string
- 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
The method purifyTextParser has a boolean flag argument $loop, which is a certain sign of a Single Responsibility Principle violation. Open
public static function purifyTextParser($input, $loop = true): string
- 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
The method purifySql has a boolean flag argument $skipEmpty, which is a certain sign of a Single Responsibility Principle violation. Open
public static function purifySql($input, $skipEmpty = true)
- 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
The method purify has a boolean flag argument $loop, which is a certain sign of a Single Responsibility Principle violation. Open
public static function purify($input, $loop = true)
- 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
Missing class import via use statement (line '566', column '15'). Open
throw new \App\Exceptions\IllegalValue('ERR_NOT_ALLOWED_VALUE||' . $input, 406);
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Avoid assigning values to variables in if clauses and the like (line '385', column '7'). Open
public static function getHtmlConfig(array $options = [])
{
$config = \HTMLPurifier_Config::createDefault();
$config->set('Core.Encoding', static::$defaultCharset);
$config->set('Cache.SerializerPermissions', 0775);
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
Avoid assigning values to variables in if clauses and the like (line '492', column '21'). Open
public static function purifyByType($input, $type, $convert = false)
{
if (\is_array($input)) {
$value = [];
foreach ($input as $k => $v) {
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
Avoid using static access to class '\HTMLPurifier_Config' in method 'purify'. Open
$config = \HTMLPurifier_Config::createDefault();
- 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 '\HTMLPurifier_Config' in method 'getHtmlConfig'. Open
$config = \HTMLPurifier_Config::createDefault();
- 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 '\App\Log' in method 'purifyHtmlEventAttributes'. Open
\App\Log::error('purifyHtmlEventAttributes: ' . $value, 'IllegalValue');
- 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 assigning values to variables in if clauses and the like (line '514', column '21'). Open
public static function purifyByType($input, $type, $convert = false)
{
if (\is_array($input)) {
$value = [];
foreach ($input as $k => $v) {
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
Avoid using static access to class 'App\Cache' in method 'purify'. Open
if (Cache::has('purify', $cacheKey)) {
- 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 assigning values to variables in if clauses and the like (line '321', column '7'). Open
public static function getHtmlConfig(array $options = [])
{
$config = \HTMLPurifier_Config::createDefault();
$config->set('Core.Encoding', static::$defaultCharset);
$config->set('Cache.SerializerPermissions', 0775);
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
Avoid using static access to class 'App\Cache' in method 'purifyHtml'. Open
Cache::save('purifyHtml', $cacheKey, $value, Cache::SHORT);
- 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 '\App\Log' in method 'purifyHtmlEventAttributes'. Open
\App\Log::error('purifyHtmlEventAttributes: ' . $value, 'IllegalValue');
- 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 purifyByType uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$value = null;
switch ($type) {
case 'Standard': // only word
case 1:
- 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 'App\Validator' in method 'purifyByType'. Open
$value = Validator::alnum($input) ? $input : null;
- 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 'App\Cache' in method 'purifyHtml'. Open
if (Cache::has('purifyHtml', $cacheKey)) {
- 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 'App\Validator' in method 'purifyByType'. Open
$value = Validator::standard($input) ? $input : null;
- 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 'App\Cache' in method 'purifyTextParser'. Open
if (Cache::has('purifyTextParser', $cacheKey)) {
- 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 'App\Cache' in method 'purifyTextParser'. Open
Cache::save('purifyTextParser', $cacheKey, $value, Cache::SHORT);
- 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 'App\Validator' in method 'purifySql'. Open
if ((empty($input) && $skipEmpty) || Validator::sql($input)) {
- 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 'App\Cache' in method 'purifyTextParser'. Open
return Cache::get('purifyTextParser', $cacheKey);
- 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 'App\Cache' in method 'purify'. Open
return Cache::get('purify', $cacheKey);
- 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 'App\Cache' in method 'purifyHtml'. Open
return Cache::get('purifyHtml', $cacheKey);
- 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 '\App\Log' in method 'purifyHtmlEventAttributes'. Open
\App\Log::error('purifyHtmlEventAttributes: ' . $value, 'IllegalValue');
- 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 assigning values to variables in if clauses and the like (line '509', column '21'). Open
public static function purifyByType($input, $type, $convert = false)
{
if (\is_array($input)) {
$value = [];
foreach ($input as $k => $v) {
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
Avoid using static access to class 'App\Cache' in method 'purify'. Open
Cache::save('purify', $cacheKey, $value, Cache::SHORT);
- 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 '\App\Log' in method 'purifySql'. Open
\App\Log::error('purifySql: ' . $input, 'IllegalValue');
- 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 'App\Validator' in method 'purifyByType'. Open
$value = Validator::dateInUserFormat($input) ? ($convert ? Fields\Date::formatToDB($input) : $input) : null;
- 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 'App\Validator' in method 'purifyByType'. Open
$value = Validator::email($input) ? $input : null;
- 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 'App\Fields\Date' in method 'purifyByType'. Open
$value = Validator::dateInUserFormat($input) ? ($convert ? Fields\Date::formatToDB($input) : $input) : null;
- 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 'App\Fields\Double' in method 'purifyByType'. Open
$dbFormat = Fields\Double::formatToDb($input);
- 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 'App\Validator' in method 'purifyByType'. Open
$value = Validator::url($input) ? $input : null;
- 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 'App\Validator' in method 'purifyByType'. Open
$value = $input && Validator::sql($input) ? $input : null;
- 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 'App\Validator' in method 'purifyByType'. Open
if (Validator::{$type}($input)) {
- 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 'App\Validator' in method 'purifyByType'. Open
$value = Validator::path($input) && Validator::path(static::purify($input)) ? $input : null;
- 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 'App\Validator' in method 'purifyByType'. Open
$value = Validator::timeInUserFormat($input) ? ($convert ? Fields\Time::formatToDB($input) : $input) : null;
- 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 'App\Fields\Double' in method 'purifyByType'. Open
if (is_numeric($dbFormat) && Fields\Double::formatToDisplay($dbFormat, false) === Fields\Double::truncateZeros($input)) {
- 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 '\App\Log' in method 'purifyByType'. Open
\App\Log::error('purifyByType: ' . $input, 'IllegalValue');
- 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 'App\Fields\Time' in method 'purifyByType'. Open
$value = Validator::timeInUserFormat($input) ? ($convert ? Fields\Time::formatToDB($input) : $input) : null;
- 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 'App\Fields\Double' in method 'purifyByType'. Open
$input = Fields\Double::formatToDb($rawInput = $input);
- 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 'App\Fields\Double' in method 'purifyByType'. Open
if (is_numeric($dbFormat) && Fields\Double::formatToDisplay($dbFormat, false) === Fields\Double::truncateZeros($input)) {
- 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 'App\Validator' in method 'purifyByType'. Open
if (!Validator::dateInUserFormat($i)) {
- 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 'App\Fields\Date' in method 'purifyByType'. Open
[$y, $m, $d] = Fields\Date::explode($i, $dateFormat);
- 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 '\DateTimeField' in method 'purifyByType'. Open
$v[] = \DateTimeField::convertToDBFormat($i);
- 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 'App\Validator' in method 'purifyByType'. Open
$value = Validator::dateTimeInIsoFormat($input) ? date('Y-m-d H:i:s', strtotime($input)) : null;
- 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 purifyByType uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$value = self::purify($input);
}
- 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 'App\Fields\Double' in method 'purifyByType'. Open
if (is_numeric($input) && Fields\Double::formatToDisplay($input, false) === Fields\Double::truncateZeros($rawInput)) {
- 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 'App\Fields\Double' in method 'purifyByType'. Open
if (is_numeric($input) && Fields\Double::formatToDisplay($input, false) === Fields\Double::truncateZeros($rawInput)) {
- 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 'App\Validator' in method 'purifyByType'. Open
$value = Validator::path($input) && Validator::path(static::purify($input)) ? $input : null;
- 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
Define a constant instead of duplicating this literal "width" 3 times. Open
'width' => 'Length',
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "IllegalValue" 5 times. Open
\App\Log::error('purifyHtmlEventAttributes: ' . $value, 'IllegalValue');
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "Inline" 14 times. Open
$def->addElement('figcaption', 'Inline', 'Flow', 'Common');
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "Length" 6 times. Open
'width' => 'Length',
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "purifyHtml" 3 times. Open
if (Cache::has('purifyHtml', $cacheKey)) {
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "height" 4 times. Open
'height' => 'Length',
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "purifyHtmlEventAttributes: " 3 times. Open
\App\Log::error('purifyHtmlEventAttributes: ' . $value, 'IllegalValue');
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "Block" 15 times. Open
$def->addElement('section', 'Block', 'Flow', 'Common');
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "purify" 3 times. Open
if (Cache::has('purify', $cacheKey)) {
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "Common" 22 times. Open
$def->addElement('section', 'Block', 'Flow', 'Common');
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "border" 3 times. Open
$def->addAttribute('td', 'border', 'Text');
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "purifyTextParser" 3 times. Open
if (Cache::has('purifyTextParser', $cacheKey)) {
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Property \App\Purifier::$purifyInstanceCache
has undeclared type \HTMLPurifier
Open
private static $purifyInstanceCache = false;
- Exclude checks
Property \App\Purifier::$purifyTextParserInstanceCache
has undeclared type \HTMLPurifier
Open
private static $purifyTextParserInstanceCache = false;
- Exclude checks
Call to method createDefault
from undeclared class \HTMLPurifier_Config
Open
$config = \HTMLPurifier_Config::createDefault();
- Exclude checks
Property \App\Purifier::$purifyHtmlInstanceCache
has undeclared type \HTMLPurifier
Open
private static $purifyHtmlInstanceCache = false;
- Exclude checks
Call to method purify
from undeclared class \HTMLPurifier
Open
$value = static::$purifyHtmlInstanceCache->purify($input);
- Exclude checks
Call to method __construct
from undeclared class \HTMLPurifier
Open
static::$purifyHtmlInstanceCache = new \HTMLPurifier($config);
- Exclude checks
Call to method purify
from undeclared class \HTMLPurifier
Open
$value = static::$purifyTextParserInstanceCache->purify($input);
- Exclude checks
Call to method alnum
from undeclared class \App\Validator
(Did you mean class \Tests\App\Validator) Open
$value = Validator::alnum($input) ? $input : null;
- Exclude checks
Call to method timeInUserFormat
from undeclared class \App\Validator
(Did you mean class \Tests\App\Validator) Open
$value = Validator::timeInUserFormat($input) ? ($convert ? Fields\Time::formatToDB($input) : $input) : null;
- Exclude checks
Call to method __construct
from undeclared class \HTMLPurifier
Open
static::$purifyInstanceCache = new \HTMLPurifier($config);
- Exclude checks
Call to method email
from undeclared class \App\Validator
(Did you mean class \Tests\App\Validator) Open
$value = Validator::email($input) ? $input : null;
- Exclude checks
Saw an @param annotation for encode,
but it was not found in the param list of function encodeHtml(string $string) : string
Open
* @param bool $encode
- Exclude checks
Call to method error
from undeclared class \App\Log
Open
\App\Log::error('purifySql: ' . $input, 'IllegalValue');
- Exclude checks
Call to method standard
from undeclared class \App\Validator
(Did you mean class \Tests\App\Validator) Open
$value = Validator::standard($input) ? $input : null;
- Exclude checks
Call to method dateInUserFormat
from undeclared class \App\Validator
(Did you mean class \Tests\App\Validator) Open
$value = Validator::dateInUserFormat($input) ? ($convert ? Fields\Date::formatToDB($input) : $input) : null;
- Exclude checks
Call to method getCurrentUserModel
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
$dateFormat = User::getCurrentUserModel()->getDetail('date_format');
- Exclude checks
Call to method dateInUserFormat
from undeclared class \App\Validator
(Did you mean class \Tests\App\Validator) Open
if (!Validator::dateInUserFormat($i)) {
- Exclude checks
Call to method sql
from undeclared class \App\Validator
(Did you mean class \Tests\App\Validator) Open
if ((empty($input) && $skipEmpty) || Validator::sql($input)) {
- Exclude checks
Call to method createDefault
from undeclared class \HTMLPurifier_Config
Open
$config = \HTMLPurifier_Config::createDefault();
- Exclude checks
Call to method path
from undeclared class \App\Validator
(Did you mean class \Tests\App\Validator) Open
$value = Validator::path($input) && Validator::path(static::purify($input)) ? $input : null;
- Exclude checks
Call to method purify
from undeclared class \HTMLPurifier
Open
$value = static::$purifyInstanceCache->purify(static::decodeHtml($input));
- Exclude checks
Call to method error
from undeclared class \App\Log
Open
\App\Log::error('purifyHtmlEventAttributes: ' . $value, 'IllegalValue');
- Exclude checks
Invalid offset "directives"
of array type array{}
Open
foreach ($options['directives'] ?? [] as $key => $value) {
- Exclude checks
Argument 1 (value)
is float
but \App\Fields\Double::formatToDisplay()
takes null|string
defined at /code/app/Fields/Double.php:55
Open
if (is_numeric($dbFormat) && Fields\Double::formatToDisplay($dbFormat, false) === Fields\Double::truncateZeros($input)) {
- Exclude checks
Call to method __construct
from undeclared class \HTMLPurifier
Open
static::$purifyTextParserInstanceCache = new \HTMLPurifier($config);
- Exclude checks
Call to method dateTimeInIsoFormat
from undeclared class \App\Validator
(Did you mean class \Tests\App\Validator) Open
$value = Validator::dateTimeInIsoFormat($input) ? date('Y-m-d H:i:s', strtotime($input)) : null;
- Exclude checks
Argument 1 (value)
is float
but \App\Fields\Double::formatToDisplay()
takes null|string
defined at /code/app/Fields/Double.php:55
Open
if (is_numeric($input) && Fields\Double::formatToDisplay($input, false) === Fields\Double::truncateZeros($rawInput)) {
- Exclude checks
Call to method url
from undeclared class \App\Validator
(Did you mean class \Tests\App\Validator) Open
$value = Validator::url($input) ? $input : null;
- Exclude checks
Call to method sql
from undeclared class \App\Validator
(Did you mean class \Tests\App\Validator) Open
$value = $input && Validator::sql($input) ? $input : null;
- Exclude checks
Call to method error
from undeclared class \App\Log
Open
\App\Log::error('purifyHtmlEventAttributes: ' . $value, 'IllegalValue');
- Exclude checks
Call to method error
from undeclared class \App\Log
Open
\App\Log::error('purifyHtmlEventAttributes: ' . $value, 'IllegalValue');
- Exclude checks
Return type of getHtmlConfig()
is undeclared type \HTMLPurifier_Config
Open
public static function getHtmlConfig(array $options = [])
- Exclude checks
Call to method error
from undeclared class \App\Log
Open
\App\Log::error('purifyByType: ' . $input, 'IllegalValue');
- Exclude checks
Avoid excessively long variable names like $removeUnnecessaryCode. Keep variable name length under 20. Open
private static $removeUnnecessaryCode = [
'href="javascript:window.history.back();"',
'href="javascript:void(0);"',
];
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $purifyHtmlInstanceCache. Keep variable name length under 20. Open
private static $purifyHtmlInstanceCache = false;
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $purifyTextParserInstanceCache. Keep variable name length under 20. Open
private static $purifyTextParserInstanceCache = false;
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 18 and the first side effect is on line 610. Open
<?php
- Exclude checks
Avoid variables with short names like $y. Configured minimum length is 3. Open
[$y, $m, $d] = Fields\Date::explode($i, $dateFormat);
- 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 $m. Configured minimum length is 3. Open
[$y, $m, $d] = Fields\Date::explode($i, $dateFormat);
- 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 $d. Configured minimum length is 3. Open
[$y, $m, $d] = Fields\Date::explode($i, $dateFormat);
- 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
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Default charset.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'onclick|ondblclick|ondrag|ondragend|ondragenter|ondragleave|ondragover|ondragstart|ondrop|onmousedown|onmousemove|onmouseout|onmouseover|onbeforepaste|onresizestart|onactivate|' .
- Exclude checks
Line exceeds 120 characters; contains 179 characters Open
'onpropertychange|onfilterchange|onstart|onfinish|onbounce|onrowsinserted|onrowsdelete|onrowexit|onrowenter|ondatasetcomplete|ondatasetchanged|ondataavailable|oncellchange|' .
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param bool $loop Purify values in the loop
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$config = \HTMLPurifier_Config::createDefault();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::purifyHtmlEventAttributes($input);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($loop) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
while ($last !== $value) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param bool $loop Purify values in the loop
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (static::$purifyHtmlInstanceCache) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($loop) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var string Purify type date in user format. */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public const BOOL = 'Bool';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var bool|\HTMLPurifier
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private static $purifyInstanceCache = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$config->set('Core.Encoding', static::$defaultCharset);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$config->set('HTML.Allowed', '');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\is_array($input)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Purify HTML (Cleanup) malicious snippets of code from the input.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$purifyHtmlInstanceCache = new \HTMLPurifier($config);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param bool $loop Purify values in the loop
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public const DATE_USER_FORMAT = 'DateInUserFormat';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var string Purify type integer. */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public const STANDARD = 'Standard';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var string Purify type Alnum 2 (A-Za-z0-9\/\+\-). */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var string Purify type email. */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public const EMAIL = 'Email';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Cache for Html purify instance.
- Exclude checks
Line exceeds 120 characters; contains 184 characters Open
'onclick|ondblclick|ondrag|ondragend|ondragenter|ondragleave|ondragover|ondragstart|ondrop|onmousedown|onmousemove|onmouseout|onmouseover|onbeforepaste|onresizestart|onactivate|' .
- Exclude checks
Line exceeds 120 characters; contains 181 characters Open
'onmouseup|onmousewheel|onscroll|onwheel|oncopy|oncut|onpaste|onload|onselectionchange|onabort|onselectstart|ondragdrop|onmouseleave|onmouseenter|onunload|onresize|onmessage|' .
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (static::$purifyInstanceCache) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $input;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!static::$purifyHtmlInstanceCache) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public const URL = 'Url';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public const ALNUM2 = 'AlnumType2';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public const HTML_TEXT_PARSER = 'HtmlTextParser';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$last = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($input)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// Initialize the instance if it has not yet done
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$last = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$last = $value;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var string Purify type number. */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Purify (Cleanup) malicious snippets of code from the input.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (Cache::has('purify', $cacheKey)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = static::purify($value, false);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Cache::save('purify', $cacheKey, $value, Cache::SHORT);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::purifyHtmlEventAttributes(static::decodeHtml($value));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $value;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $input
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public const ALNUM = 'Alnum';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private static $htmlEventAttributes = 'onerror|onblur|onchange|oncontextmenu|onfocus|oninput|oninvalid|onreset|onsearch|onselect|onsubmit|onkeydown|onkeypress|onkeyup|' .
- Exclude checks
Line exceeds 120 characters; contains 174 characters Open
private static $htmlEventAttributes = 'onerror|onblur|onchange|oncontextmenu|onfocus|oninput|oninvalid|onreset|onsearch|onselect|onsubmit|onkeydown|onkeypress|onkeyup|' .
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'onbeforeupdate|onafterupdate|onerrorupdate|onhelp|onbeforeprint|onafterprint|oncontrolselect|onfocusout|onfocusin|ondeactivate|onbeforeeditfocus|onbeforedeactivate|onbeforeactivate|' .
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'href="javascript:void(0);"',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function purifyHtml(string $input, $loop = true): string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
while ($last !== $value) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $defaultCharset;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'onresizeend|onmovestart|onmoveend|onmove|onbeforecopy|onbeforecut|onbeforeunload|onhashchange|onoffline|ononline|onreadystatechange|onstop|onlosecapture';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var string[]
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($input as $k => $v) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$input = str_replace(["\r\n"], "\n", $input);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var string Purify type text. */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var bool|\HTMLPurifier Cache for Html template purify instance. */
- Exclude checks
Line exceeds 120 characters; contains 189 characters Open
'onbeforeupdate|onafterupdate|onerrorupdate|onhelp|onbeforeprint|onafterprint|oncontrolselect|onfocusout|onfocusin|ondeactivate|onbeforeeditfocus|onbeforedeactivate|onbeforeactivate|' .
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $input
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!static::$purifyInstanceCache) {
- Exclude checks
Line exceeds 120 characters; contains 131 characters Open
$config->set('Cache.SerializerPath', ROOT_DIRECTORY . \DIRECTORY_SEPARATOR . 'cache' . \DIRECTORY_SEPARATOR . 'vtlib');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var string Purify type url. */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var string Purify type Alnum. */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public const DIGITS = 'Digits';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'onpropertychange|onfilterchange|onstart|onfinish|onbounce|onrowsinserted|onrowsdelete|onrowexit|onrowenter|ondatasetcomplete|ondatasetchanged|ondataavailable|oncellchange|' .
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private static $removeUnnecessaryCode = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $input;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public const INTEGER = 'Integer';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var string Purify type sql. */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public const SQL = 'Sql';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public const HTML = 'Html';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// Composite type
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$input = str_replace(["\r\n"], "\n", $input);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$cacheKey = md5($input);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = static::$purifyHtmlInstanceCache->purify($input);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public const TEXT = 'Text';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public const NUMBER = 'Number';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var string Purify type Path. */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var bool|\HTMLPurifier
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($input)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!\is_array($input)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$cacheKey = md5($input);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return Cache::get('purify', $cacheKey);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$config = static::getHtmlConfig();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = static::purifyHtml($value, false);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Cache::save('purifyHtml', $cacheKey, $value, Cache::SHORT);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var string Purify type html. */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private static $purifyHtmlInstanceCache = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'onmouseup|onmousewheel|onscroll|onwheel|oncopy|oncut|onpaste|onload|onselectionchange|onabort|onselectstart|ondragdrop|onmouseleave|onmouseenter|onunload|onresize|onmessage|' .
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$config->set('Cache.SerializerPath', ROOT_DIRECTORY . \DIRECTORY_SEPARATOR . 'cache' . \DIRECTORY_SEPARATOR . 'vtlib');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif (\is_string($input)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (Cache::has('purifyHtml', $cacheKey)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var string Purify type boolean. */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var string Purify type AlnumExtended. */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public const ALNUM_EXTENDED = 'AlnumExtended';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private static $purifyTextParserInstanceCache = false;
- Exclude checks
Line exceeds 120 characters; contains 159 characters Open
'onresizeend|onmovestart|onmoveend|onmove|onbeforecopy|onbeforecut|onbeforeunload|onhashchange|onoffline|ononline|onreadystatechange|onstop|onlosecapture';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = static::$purifyInstanceCache->purify(static::decodeHtml($input));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $value;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return Cache::get('purifyHtml', $cacheKey);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var string Purify type standard. */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Html events attributes.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'href="javascript:window.history.back();"',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// Initialize the instance if it has not yet done
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = static::removeUnnecessaryCode($value);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Purify HTML (Cleanup) malicious snippets of code from text parser.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$purifyTextParserInstanceCache = new \HTMLPurifier($config);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::purifyHtmlEventAttributes($value);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function purifyHtmlEventAttributes(string $value): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (preg_match('#(<[^><]+?[\x00-\x20"\'])([^a-z_\\-]on\\w*|xmlns)(\\s*=\\s*[^><]*)([><]*)#i', $value, $matches)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (preg_match('#<([^><]+?)javascript:[\w\.]+\(([>]*)#i', $value, $matches)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'mailto' => true,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$def->addElement('figure', 'Block', 'Optional: (figcaption, Flow) | (Flow, figcaption) | Flow', 'Common');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'preload' => 'Enum#auto,metadata,none',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'src' => 'URI',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var string Purify type Digits. */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public const PATH = 'Path';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Remove unnecessary code list.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = $input;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$config->set('Cache.SerializerPermissions', 0775);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value[$k] = static::purify($v);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$last = $value;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (preg_match('#<([^><]+?)(' . static::$htmlEventAttributes . ')(\\s*=\\s*[^><]*)([>]*)#i', $value, $matches)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$config->set('Cache.SerializerPath', ROOT_DIRECTORY . \DIRECTORY_SEPARATOR . 'cache' . \DIRECTORY_SEPARATOR . 'vtlib');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'ftp' => true,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'type' => 'Text',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$def->addElement('audio', 'Block', 'Optional: (source, Flow) | (Flow, source) | Flow', 'Common', [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$def->addElement('source', 'Block', 'Flow', 'Common', [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'href' => 'URI',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'width' => 'Length',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var string Purify type HTML text parser */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Cache for purify instance.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function purify($input, $loop = true)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$purifyInstanceCache = new \HTMLPurifier($config);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $input
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = $input;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = preg_replace("/(^[\r\n]*|[\r\n]+)[\\s\t]*[\r\n]+/", "\n", $value);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
throw new Exceptions\IllegalValue('ERR_NOT_ALLOWED_VALUE|2|' . print_r($matches, true) . "||$value", 406);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach (self::$removeUnnecessaryCode as $code) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return \HTMLPurifier_Config
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$def->addElement('link', 'Block', 'Flow', 'Common', [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'type' => 'Text',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function purifyTextParser($input, $loop = true): string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::error('purifyHtmlEventAttributes: ' . $value, 'IllegalValue');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'src' => 'URI',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'controls' => 'Bool',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'src' => 'URI',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$cacheKey = md5($input);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$last = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $value;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$config->set('Cache.SerializerPermissions', 0775);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$config->set('CSS.MaxImgLength', null);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'tel' => true,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$def->addElement('nav', 'Block', 'Flow', 'Common');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'type' => 'Text',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($loop) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Cache::save('purifyTextParser', $cacheKey, $value, Cache::SHORT);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::error('purifyHtmlEventAttributes: ' . $value, 'IllegalValue');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'http' => true,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'nntp' => true,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'controls' => 'Bool',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$def->addElement('yetiforce', 'Inline', 'Inline', 'Common', [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$def->addElement('s', 'Inline', 'Inline', 'Common');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$last = $value;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getHtmlConfig(array $options = [])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$config->set('CSS.Proprietary', true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$def->addElement('article', 'Block', 'Flow', 'Common');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!static::$purifyTextParserInstanceCache) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (false !== stripos($value, $code)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'height' => 'Length',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($input)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return Cache::get('purifyTextParser', $cacheKey);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = static::removeUnnecessaryCode($value);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
throw new Exceptions\IllegalValue('ERR_NOT_ALLOWED_VALUE|1|' . print_r($matches, true) . "||$value", 406);
- Exclude checks
Line exceeds 120 characters; contains 121 characters Open
if (preg_match('#<([^><]+?)(' . static::$htmlEventAttributes . ')(\\s*=\\s*[^><]*)([>]*)#i', $value, $matches)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::error('purifyHtmlEventAttributes: ' . $value, 'IllegalValue');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = str_ireplace($code, '', $value);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$config->set('CSS.Trusted', true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$config->set('HTML.SafeEmbed', true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$def->addElement('footer', 'Block', 'Flow', 'Common');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'attachment-id' => 'Length',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Remove unnecessary code.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $value
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$config->set('HTML.Doctype', 'HTML 4.01 Transitional');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($def = $config->getHTMLDefinition(true)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$def->addElement('address', 'Block', 'Flow', 'Common');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'height' => 'Length',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'poster' => 'URI',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'type' => 'Text',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'crm-id' => 'Length',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $input;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = static::$purifyTextParserInstanceCache->purify($input);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $value
- Exclude checks
Line exceeds 120 characters; contains 122 characters Open
if (preg_match('#(<[^><]+?[\x00-\x20"\'])([^a-z_\\-]on\\w*|xmlns)(\\s*=\\s*[^><]*)([><]*)#i', $value, $matches)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$config = static::getHtmlConfig(['directives' => ['HTML.AllowedCommentsRegexp' => '/^(\s+{% |{% )[\s\S]+( %}| %}\s+)$/u']]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
while ($last !== $value) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = static::purifyTextParser($value, false);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$config = \HTMLPurifier_Config::createDefault();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$config->set('Core.Encoding', static::$defaultCharset);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$config->set('URI.AllowedSchemes', [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$def->addElement('hgroup', 'Block', 'Required: h1 | h2 | h3 | h4 | h5 | h6', 'Common');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'width' => 'Length',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Line exceeds 120 characters; contains 127 characters Open
$config->set('Cache.SerializerPath', ROOT_DIRECTORY . \DIRECTORY_SEPARATOR . 'cache' . \DIRECTORY_SEPARATOR . 'vtlib');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$config->set('Core.RemoveInvalidImg', true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$config->set('HTML.TargetBlank', true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$def->addElement('aside', 'Block', 'Flow', 'Common');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'type' => 'Text',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'preload' => 'Enum#auto,metadata,none',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* To purify malicious html event attributes.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
throw new Exceptions\IllegalValue('ERR_NOT_ALLOWED_VALUE|3|' . print_r($matches, true) . "||$value", 406);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function removeUnnecessaryCode(string $value): string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get html config.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $options
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'https' => true,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$config->set($key, $value);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$def->addElement('header', 'Block', 'Flow', 'Common');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = preg_replace("/(^[\r\n]*|[\r\n]+)[\\s\t]*[\r\n]+/", "\n", $value);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$config->set('CSS.AllowTricky', true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$config->set('HTML.DefinitionRev', 1);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$def->addElement('section', 'Block', 'Flow', 'Common');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$def->addElement('figcaption', 'Inline', 'Flow', 'Common');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'rel' => 'Text',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$def->addElement('var', 'Inline', 'Inline', 'Common');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$def->addAttribute('tr', 'width', 'Text');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($uriDef = $config->getURIDefinition()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return bool|string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function purifySql($input, $skipEmpty = true)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 2:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'AlnumType2':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (checkdate((int) $m, (int) $d, (int) $y) && is_numeric($y) && is_numeric($m) && is_numeric($d)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$v[] = \DateTimeField::convertToDBFormat($i);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'NumberInUserFormat': // number in user format
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = preg_match('/^[\s0-9+\-()]+$/', $input) ? $input : null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (Cache::has('purifyTextParser', $cacheKey)) {
- Exclude checks
Line exceeds 120 characters; contains 136 characters Open
$config = static::getHtmlConfig(['directives' => ['HTML.AllowedCommentsRegexp' => '/^(\s+{% |{% )[\s\S]+( %}| %}\s+)$/u']]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $value;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$config->set('HTML.SafeIframe', true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$config->set('URI.SafeIframeRegexp', '%^(http:|https:)?//(www\.youtube(?:-nocookie)?\.com/embed/|player\.vimeo\.com/video/)%');
- Exclude checks
Line exceeds 120 characters; contains 135 characters Open
$config->set('URI.SafeIframeRegexp', '%^(http:|https:)?//(www\.youtube(?:-nocookie)?\.com/embed/|player\.vimeo\.com/video/)%');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$config->set('Attr.EnableID', true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'news' => true,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'data' => true,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($options['directives'] ?? [] as $key => $value) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$def->addElement('video', 'Block', 'Optional: (source, Flow) | (Flow, source) | Flow', 'Common', [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $input
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $convert
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'DateInUserFormat': // date in user format
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'TimeInUserFormat':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = Validator::timeInUserFormat($input) ? ($convert ? Fields\Time::formatToDB($input) : $input) : null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = $input;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = Validator::email($input) ? $input : null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$def->addElement('sub', 'Inline', 'Inline', 'Common');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$def->addElement('wbr', 'Inline', 'Empty', 'Core');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$uriDef->addFilter(new Extension\HTMLPurifier\Domain(), $config);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $config;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $type Data type that is only acceptable
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = Validator::dateTimeInIsoFormat($input) ? date('Y-m-d H:i:s', strtotime($input)) : null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$def->addElement('mark', 'Inline', 'Inline', 'Common');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$def->addElement('del', 'Block', 'Flow', 'Common', ['cite' => 'URI', 'datetime' => 'CDATA']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$def->addAttribute('a', 'data-id', 'Text');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'Standard': // only word
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'Alnum': // word and int
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = preg_match('/^[\sA-Za-z0-9\,\_\.\=\-]+$/', $input) ? $input : null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = Validator::dateInUserFormat($input) ? ($convert ? Fields\Date::formatToDB($input) : $input) : null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($v) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'Double':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$def->addAttribute('table', 'height', 'Text');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!Validator::dateInUserFormat($i)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'Bool':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'Number':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'Phone':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$def->addAttribute('th', 'border', 'Text');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Purify by data type.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$v = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = $input;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'Email':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
switch ($type) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach (explode(',', $input) as $i) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$def->addAttribute('img', 'data-mce-json', 'Text');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// Others
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = preg_match('/^[\sA-Za-z0-9\/\+\-]+$/', $input) ? $input : null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'DateTimeInIsoFormat': // date in base format yyyy-mm-dd
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$input) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// TinyMCE
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$def->addAttribute('img', 'data-mce-src', 'Text');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to return the valid SQl input.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* 1 - only words
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = $input;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbFormat = Fields\Double::formatToDb($input);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (false !== ($input = filter_var($input, FILTER_VALIDATE_INT))) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$def->addAttribute('tr', 'height', 'Text');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::error('purifySql: ' . $input, 'IllegalValue');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = Validator::standard($input) ? $input : null;
- Exclude checks
Line exceeds 120 characters; contains 128 characters Open
$value = Validator::dateInUserFormat($input) ? ($convert ? Fields\Date::formatToDB($input) : $input) : null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = $v;
- Exclude checks
Line exceeds 120 characters; contains 141 characters Open
if (is_numeric($dbFormat) && Fields\Double::formatToDisplay($dbFormat, false) === Fields\Double::truncateZeros($input)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Standard - only words
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Line exceeds 120 characters; contains 128 characters Open
$value = Validator::timeInUserFormat($input) ? ($convert ? Fields\Time::formatToDB($input) : $input) : null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'DateRangeUserFormat': // date range user format
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$v = [];
- Exclude checks
Line exceeds 120 characters; contains 124 characters Open
if (checkdate((int) $m, (int) $d, (int) $y) && is_numeric($y) && is_numeric($m) && is_numeric($d)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$def->addAttribute('td', 'border', 'Text');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param bool $skipEmpty Skip the check if string is empty
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($input as $k => $v) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value[$k] = static::purifyByType($v, $type);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (is_numeric($input) && Fields\Double::formatToDisplay($input, false) === Fields\Double::truncateZeros($rawInput)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'Html':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'Integer': // Integer
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$def->addAttribute('a', 'data-module', 'Text');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $input
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $input;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$input = Fields\Double::formatToDb($rawInput = $input);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = self::purifyHtml($input);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$def->addAttribute('iframe', 'allowfullscreen', 'Bool');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dateFormat = User::getCurrentUserModel()->getDetail('date_format');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
[$y, $m, $d] = Fields\Date::explode($i, $dateFormat);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = $input;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$def->addElement('ins', 'Block', 'Flow', 'Common', ['cite' => 'URI', 'datetime' => 'CDATA']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$def->addAttribute('tr', 'border', 'Text');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ((empty($input) && $skipEmpty) || Validator::sql($input)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Type list:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function purifyByType($input, $type, $convert = false)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\is_array($input)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$input) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = self::bool($input);
- Exclude checks
Line exceeds 120 characters; contains 138 characters Open
if (is_numeric($input) && Fields\Double::formatToDisplay($input, false) === Fields\Double::truncateZeros($rawInput)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (is_numeric($dbFormat) && Fields\Double::formatToDisplay($dbFormat, false) === Fields\Double::truncateZeros($input)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$def->addElement('sup', 'Inline', 'Inline', 'Common');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
throw new \App\Exceptions\IllegalValue('ERR_NOT_ALLOWED_VALUE||' . $input, 406);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Alnum - word and int
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* 2 - word and int
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return mixed
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 1:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = Validator::alnum($input) ? $input : null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'AlnumExtended':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (false !== ($input = filter_var($input, FILTER_VALIDATE_FLOAT))) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Line exceeds 120 characters; contains 124 characters Open
if (is_numeric($input) && (int) $input >= 0 && (int) $input <= 3000 && 4 === \strlen((string) $input)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'Url':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'ClassName':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'Text':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (Validator::{$type}($input)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = (string) $input;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$input = ltrim(rtrim(trim($input), '>'), '<');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (method_exists('App\Validator', $type)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $value;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to convert the given string to html.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = $input;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function bool($value)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function encodeHtml($string)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = Validator::url($input) ? $input : null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = self::purify($input);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return bool|null
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Line exceeds 120 characters; contains 133 characters Open
if (false !== ($input = filter_var($input, FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => '/^[0-9]+$/']]))) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (is_numeric($input) && (int) $input >= 0 && (int) $input <= 3000 && 4 === \strlen((string) $input)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'Version':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
default:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::error('purifyByType: ' . $input, 'IllegalValue');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = $input && Validator::sql($input) ? $input : null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = self::purifyTextParser($input);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (null === $value) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
throw new \App\Exceptions\IllegalValue('ERR_NOT_ALLOWED_VALUE||' . $input, 406);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case self::SQL:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = self::purify($input);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $string !== null ? htmlspecialchars($string, ENT_QUOTES, static::$defaultCharset) : '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $string !== null ? html_entity_decode($string, ENT_QUOTES, static::$defaultCharset) : '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = Validator::path($input) && Validator::path(static::purify($input)) ? $input : null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = preg_match('/^[a-z\\\_]+$/i', $input) ? $input : null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case self::HTML_TEXT_PARSER:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function decodeHtml($string)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (false !== ($input = filter_var($input, FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => '/^[0-9]+$/']]))) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = preg_match('/^(#[0-9a-fA-F]{6})$/', $input) ? $input : null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return filter_var($value, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'MailId':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = $input;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = preg_match('/^[\.0-9]+$/', $input) ? $input : null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case self::PATH:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$input) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = $input === strip_tags($input) ? $input : null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param bool $encode
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to decode html.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'Color': // colors
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int|string $value
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'Digits': // Digits - eg. 000523
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'Year': // 2018 etc
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to convert the given value to bool.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks