for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Finder\Spider\Traits;
use Support\Helps\DebugHelper;
/**
* Outputs events information to the console.
*
* @see TriggerableInterface
*/
trait ExtensionManagerTrait
{
protected $file = false;
protected function setFile($file)
if (is_string($file)) {
$this->stringPath = true;
stringPath
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
class MyClass { } $x = new MyClass(); $x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:
class MyClass { public $foo; } $x = new MyClass(); $x->foo = true;
}
$this->file = $file;
public function getFile()
return $this->file;
public function getContents()
return $this->getFile()->getContents();
* Lógica
protected function run()
DebugHelper::debug('Run ExtensionManager '.$this->getFile());
return $this->identificar();
protected function identificar()
if (!isset(static::$identificadores)) {
return true;
if (empty(static::$identificadores)) {
foreach (static::$identificadores as $identificador) {
$identificadorInstance = new $identificador($this);
$identificadorInstance
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
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: