for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Cerbero\EloquentInspector;
use Cerbero\EloquentInspector\Components\Properties;
use Cerbero\EloquentInspector\Components\Relationships;
use Cerbero\EloquentInspector\Components\UseStatements;
/**
* The Eloquent inspector.
*
*/
class Inspector
{
* The inspector instances.
* @var array
protected static $instances = [];
* The `use` statements cache.
protected $useStatements;
* The properties cache.
protected $properties;
* The relationships cache.
protected $relationships;
* Instantiate the class.
* @param string $model
protected function __construct(protected string $model)
}
* Statically instantiate the class
* @return static
public static function inspect(string $model): static
return static::$instances[$model] ??= new static($model);
* Retrieve the `use` statements
* @return array
public function getUseStatements(): array
return $this->useStatements ??= UseStatements::of($this->model)->get();
* Retrieve the properties
public function getProperties(): array
return $this->properties ??= Properties::of($this->model)->get();
* Retrieve the relationships
public function getRelationships(): array
return $this->relationships ??= Relationships::of($this->model)->get();