for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Tuum\View;
class Locator implements LocatorInterface
{
/**
* @var string[]
*/
private $dirs = [];
* @param string $root
public function __construct($root = null)
$root
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.
$this->dirs = [];
$roots = func_get_args();
foreach ($roots as $root) {
$this->addRoot($root);
}
public function addRoot($root)
if (substr($root, -1) !== '/') {
$root .= '/';
$this->dirs = array_merge([$root], $this->dirs);
* @param string $file
* @return bool|string
public function locate($file)
$file = substr($file,0,1) ==='/' ? substr($file,1) : $file;
foreach ($this->dirs as $system) {
$location = $system . $file;
if (file_exists($location)) {
return $location;
return false;
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.