for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Transphporm;
class FilePath {
private $baseDir;
private $cwd;
$cwd
This check marks private properties in classes that are never used. Those properties can be removed.
public function __construct(&$baseDir, $customBase = null) {
$this->baseDir = &$baseDir;
if ($customBase === null) $this->customBase = getcwd();
customBase
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;
else $this->customBase = rtrim($customBase, '/');
}
public function getFilePath($filePath = "") {
if (isset($filePath[0]) && $filePath[0] == "/") return $this->customBase . $filePath;
else return $this->baseDir . $filePath;
This check marks private properties in classes that are never used. Those properties can be removed.