for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Webfactor\Laravel\Generators\Services;
use Illuminate\Filesystem\Filesystem;
use Webfactor\Laravel\Generators\Commands\MakeEntity;
use Webfactor\Laravel\Generators\Contracts\ServiceAbstract;
use Webfactor\Laravel\Generators\Contracts\ServiceInterface;
class RouteService extends ServiceAbstract implements ServiceInterface
{
protected $relativeToBasePath = 'routes';
private $adminFile;
public function call()
$this->adminFile = $this->getFilePath();
if ($this->filesystem->exists($this->adminFile)) {
$this->writeFile();
}
$this->addLatestFileToIdeStack();
private function getRouteName(): string
return strtolower($this->command->entity);
private function getControllerName(): string
return ucfirst($this->command->entity) . 'CrudController';
/**
* Build the class with the given name.
*
* @param string $name
$name
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter $italy is not defined by the method finale(...).
$italy
finale(...)
/** * @param array $germany * @param array $island * @param array $italy */ function finale($germany, $island) { return "2:1"; }
The most likely cause is that the parameter was removed, but the annotation was not.
* @return string
string|null
This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.
@return
*/
private function writeFile()
$this->filesystem->append($this->adminFile, $this->getRouteString());
private function getFilePath()
return base_path('routes') . '/admin.php';
private function getRouteString()
return "\r\n" . 'CRUD::resource(\'' . $this->getRouteName() . '\', \'' . $this->getControllerName() . '\');';
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.