for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace hidev\components;
class Composer
{
public function __construct(string $dir)
$this->dir = ($dir === getcwd() ? '' : $dir);
dir
}
public function autoload()
$path = $this->getPath('vendor/autoload.php');
if (!file_exists($path)) {
$this->run('update');
require $path;
public function dump()
$this->run('dump-autoload');
public function run(string $command, array $args = [])
$args
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
public function run(string $command, /** @scrutinizer ignore-unused */ array $args = [])
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
sys::passthru("{$this->getCmd()} $command");
public function getCmd(): string
return 'composer' . ($this->dir ? " -d $dir" : '');
$dir
public function getPath(string $file): string
if (strncmp($file, '/', 1) === 0) {
return $file;
return $this->dir ? $this->dir . DIRECTORY_SEPARATOR . $file : $file;