for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
class EmailAddress extends Varchar
{
private static $casting = array(
'HiddenEmailAddress' => 'HTMLText',
);
/**
* Obfuscate all matching emails
*
* @return string
*/
public function HiddenEmailAddress()
$originalString = $this->value;
$encodedString = '';
$nowCodeString = '';
$nowCodeString
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
$myVar = 'Value'; $higher = false; if (rand(1, 6) > 3) { $higher = true; } else { $higher = false; }
Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.
$myVar
$higher
$originalLength = strlen($this->value);
for ($i = 0; $i < $originalLength; ++$i) {
$encodeMode = rand(1, 2); // Switch encoding odd/even
switch ($encodeMode) {
case 1: // Decimal code
$nowCodeString = '&#'.ord($originalString[$i]).';';
break;
case 2: // Hexadecimal code
$nowCodeString = '&#x'.dechex(ord($originalString[$i])).';';
default:
return 'ERROR: wrong encoding mode.';
}
$encodedString .= $nowCodeString;
return $encodedString;
public function BreakAtSymbol()
return str_replace("@", "@<wbr>", $this->value);
* @see DBField::scaffoldFormField()
* @param string $title (optional)
$title
string|null
This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.
@param
It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.
* @param array $params (optional)
$params
array|null
* @return EmailField | NullableField
public function scaffoldFormField($title = null, $params = null)
if (!$this->nullifyEmpty) {
return NullableField::create(EmailField::create($this->name, $title));
} else {
return EmailField::create($this->name, $title);