class ControllerGenerator (View source)

Properties

protected Filesystem $files

The filesystem instance.

protected array $defaults

The default resource controller methods.

Methods

void
__construct(Filesystem $files)

Create a new controller generator instance.

void
make(string $controller, string $path, array $options = array())

Create a new resourceful controller file.

void
writeFile(string $stub, string $controller, string $path)

Write the completed stub to disk.

void
makeDirectory(string $controller, string $path)

Create the directory for the controller.

string
getDirectory(string $controller)

Get the directory the controller should live in.

string
getController(string $controller)

Get the controller class stub.

string
replaceNamespace(array $segments, string $stub)

Replace the namespace on the controller.

string
addMethods(string $stub, array $options)

Add the method stubs to the controller.

array
getMethodStubs(array $options)

Get all of the method stubs for the given options.

array
getMethods(array $options)

Get the applicable methods based on the options.

Details

void __construct(Filesystem $files)

Create a new controller generator instance.

Parameters

Filesystem $files

Return Value

void

void make(string $controller, string $path, array $options = array())

Create a new resourceful controller file.

Parameters

string $controller
string $path
array $options

Return Value

void

protected void writeFile(string $stub, string $controller, string $path)

Write the completed stub to disk.

Parameters

string $stub
string $controller
string $path

Return Value

void

protected void makeDirectory(string $controller, string $path)

Create the directory for the controller.

Parameters

string $controller
string $path

Return Value

void

protected string getDirectory(string $controller)

Get the directory the controller should live in.

Parameters

string $controller

Return Value

string

protected string getController(string $controller)

Get the controller class stub.

Parameters

string $controller

Return Value

string

protected string replaceNamespace(array $segments, string $stub)

Replace the namespace on the controller.

Parameters

array $segments
string $stub

Return Value

string

protected string addMethods(string $stub, array $options)

Add the method stubs to the controller.

Parameters

string $stub
array $options

Return Value

string

protected array getMethodStubs(array $options)

Get all of the method stubs for the given options.

Parameters

array $options

Return Value

array

protected array getMethods(array $options)

Get the applicable methods based on the options.

Parameters

array $options

Return Value

array