PHP Class F2m2\Apidocs\Commands\ApiDocsGenerator

Show file Open project: f2m2/apidocs

Protected Properties

Property Type Description
$dotPrefix
$headers array The table headers for the command.
$prefix
$router
$routes Illuminate\Routing\RouteCollection An array of all the registered routes.
$storagePath

Public Methods

Method Description
__construct ( Router $router ) : void Create a new route command instance.
make ( string $prefix ) : void Generates the API Documentation based upon a prefix

Protected Methods

Method Description
copyAndSaveTemplate ( $type, $filepath ) : void Copies template type from filepath to target
filterRoute ( array $route ) : array | null Filter the route by URI and / or name.
generateDirectoryStructure ( ) : void Generates the directory structure for the API documentation
generateHTMLCode ( $endpoints ) : void Generates the HTML Code from the templates and saves them
getEndpointMethods ( $endpoints ) : array Returns functions for the endpoints
getEndpoints ( ) : array Returns an array of endpoints
getMethodPatterns ( string $uri, string $method ) : array Get the pattern filters for a given URI and method.
getPatternFilters ( Illuminate\Routing\Route $route ) : array Get all of the pattern filters matching the route.
getRouteInformation ( Illuminate\Routing\Route $route ) : array Get the route information for a given route.
getRoutes ( ) : array Compile the routes into a displayable format.
normalizeSectionName ( $name ) : string Retuns the last part of the section name
updateAndSaveDefaultLayoutTemplate ( string $content ) : void Saves the default layout with HTML content
updatePrefixAndSaveTemplate ( $type, $filepath ) : void Retrieves the content from the template and saves it to a new file
viewPathForType ( $viewType ) : array Returns the path for the view based upon View Type

Private Methods

Method Description
convertToSnakeCase ( string $input ) : string Converts a CamelCase String to Snake Case
createContentForTemplate ( array $endpoints = [] ) : void Generates the content for the templates
generateAssetsDirectory ( ) : void Generates the assets directory by copying the files from the template directory to a public diretory

Method Details

__construct() public method

Create a new route command instance.
public __construct ( Router $router ) : void
$router Illuminate\Routing\Router
return void

copyAndSaveTemplate() protected method

Copies template type from filepath to target
protected copyAndSaveTemplate ( $type, $filepath ) : void
return void

filterRoute() protected method

Filter the route by URI and / or name.
protected filterRoute ( array $route ) : array | null
$route array
return array | null

generateDirectoryStructure() protected method

Generates the directory structure for the API documentation
protected generateDirectoryStructure ( ) : void
return void

generateHTMLCode() protected method

Generates the HTML Code from the templates and saves them
protected generateHTMLCode ( $endpoints ) : void
$endpoints
return void

getEndpointMethods() protected method

Returns functions for the endpoints
protected getEndpointMethods ( $endpoints ) : array
$endpoints
return array

getEndpoints() protected method

Returns an array of endpoints
protected getEndpoints ( ) : array
return array

getMethodPatterns() protected method

Get the pattern filters for a given URI and method.
protected getMethodPatterns ( string $uri, string $method ) : array
$uri string
$method string
return array

getPatternFilters() protected method

Get all of the pattern filters matching the route.
protected getPatternFilters ( Illuminate\Routing\Route $route ) : array
$route Illuminate\Routing\Route
return array

getRouteInformation() protected method

Get the route information for a given route.
protected getRouteInformation ( Illuminate\Routing\Route $route ) : array
$route Illuminate\Routing\Route
return array

getRoutes() protected method

Compile the routes into a displayable format.
protected getRoutes ( ) : array
return array

make() public method

Generates the API Documentation based upon a prefix
public make ( string $prefix ) : void
$prefix string
return void

normalizeSectionName() protected method

Retuns the last part of the section name
protected normalizeSectionName ( $name ) : string
return string

updateAndSaveDefaultLayoutTemplate() protected method

Saves the default layout with HTML content
protected updateAndSaveDefaultLayoutTemplate ( string $content ) : void
$content string
return void

updatePrefixAndSaveTemplate() protected method

Retrieves the content from the template and saves it to a new file
protected updatePrefixAndSaveTemplate ( $type, $filepath ) : void
return void

viewPathForType() protected method

Returns the path for the view based upon View Type
protected viewPathForType ( $viewType ) : array
$viewType
return array

Property Details

$dotPrefix protected property

protected $dotPrefix

$headers protected property

The table headers for the command.
protected array $headers
return array

$prefix protected property

protected $prefix

$router protected property

protected $router

$routes protected property

An array of all the registered routes.
protected RouteCollection,Illuminate\Routing $routes
return Illuminate\Routing\RouteCollection

$storagePath protected property

protected $storagePath