DocumentationCommands
extends AbstractCommands
in package
Provides commands to generate Toolkit documentation.
Table of Contents
Properties
- $branch : string
- The documentation branch.
- $docsDir : string
- The documentation directory.
- $push : bool
- Whether to push the documentation.
- $repo : string
- The repository where the documentation is.
- $tmpDir : string
- A temporary directory.
- $token : string
- The GitHub token.
Methods
- getConfigurationFile() : mixed
- Path to YAML configuration file containing command defaults.
- getJson() : array<string|int, mixed>
- Returns the JSON parsed content.
- getWorkingDir() : string
- Returns the current working directory.
- isWebsiteInstalled() : bool
- Check if the website is installed.
- toolkitGenerateCommandsList() : mixed
- Generate the list of commands in the commands.rst file.
- toolkitGenerateDocumentation() : mixed
- Generate the documentation.
- getBin() : string
- Validate and return the path to given bin.
- getBinPath() : string
- Return the path to given bin.
- getConfigValue() : mixed
- {@inheritdoc}
- getNodeBin() : string
- Validate and return the path to given bin from node packages.
- getNodeBinPath() : string
- Return the path to given bin from node packages.
- isSimulating() : bool
- Check if current command is being executed with option simulate.
- taskExecute() : mixed
- Execute a command.
- taskProcess() : mixed
- Process the file.
- taskReplaceBlock() : mixed
- Replace block in a file.
- backupRelevantFiles() : mixed
- Backup all *.rst files.
- cleanDir() : mixed
- Clean up given directory.
- cleanUpRstFiles() : mixed
- Clean up documentation to keep only .html files.
- downloadPhpDocPhar() : bool
- Ensure that the phpDoc phar file exists.
- gitAddCommitPush() : mixed
- Git add commit and push to the documentation branch.
- gitClone() : array<string|int, mixed>
- Clone the documentation branch (hide output to avoid expose token).
Properties
$branch
The documentation branch.
private
string
$branch
$docsDir
The documentation directory.
private
string
$docsDir
$push
Whether to push the documentation.
private
bool
$push
$repo
The repository where the documentation is.
private
string
$repo
$tmpDir
A temporary directory.
private
string
$tmpDir
$token
The GitHub token.
private
string
$token
Methods
getConfigurationFile()
Path to YAML configuration file containing command defaults.
public
getConfigurationFile() : mixed
getJson()
Returns the JSON parsed content.
public
getJson(string $filename[, mixed $throwException = true ]) : array<string|int, mixed>
Parameters
- $filename : string
- $throwException : mixed = true
Return values
array<string|int, mixed>getWorkingDir()
Returns the current working directory.
public
getWorkingDir() : string
Return values
string —The current working directory.
isWebsiteInstalled()
Check if the website is installed.
public
isWebsiteInstalled() : bool
Return values
booltoolkitGenerateCommandsList()
Generate the list of commands in the commands.rst file.
public
toolkitGenerateCommandsList(ConsoleIO $io) : mixed
Parameters
- $io : ConsoleIO
Tags
toolkitGenerateDocumentation()
Generate the documentation.
public
toolkitGenerateDocumentation(ConsoleIO $io[, array<string|int, mixed> $options = ['token' => InputOption::VALUE_REQUIRED, 'repo' => InputOption::VALUE_REQUIRED, 'docs-dir' => InputOption::VALUE_REQUIRED, 'tmp-dir' => InputOption::VALUE_REQUIRED, 'branch' => InputOption::VALUE_REQUIRED, 'push' => InputOption::VALUE_NONE] ]) : mixed
Parameters
- $io : ConsoleIO
- $options : array<string|int, mixed> = ['token' => InputOption::VALUE_REQUIRED, 'repo' => InputOption::VALUE_REQUIRED, 'docs-dir' => InputOption::VALUE_REQUIRED, 'tmp-dir' => InputOption::VALUE_REQUIRED, 'branch' => InputOption::VALUE_REQUIRED, 'push' => InputOption::VALUE_NONE]
Tags
getBin()
Validate and return the path to given bin.
protected
getBin(string $name) : string
Parameters
- $name : string
-
The bin to look for.
Tags
Return values
string —The bin path.
getBinPath()
Return the path to given bin.
protected
getBinPath(string $name) : string
Parameters
- $name : string
Return values
string —The path to given binary.
getConfigValue()
{@inheritdoc}
protected
getConfigValue(mixed $key[, mixed $default = null ]) : mixed
Parameters
- $key : mixed
- $default : mixed = null
getNodeBin()
Validate and return the path to given bin from node packages.
protected
getNodeBin(string $name) : string
Parameters
- $name : string
-
The bin to look for.
Tags
Return values
string —The bin path.
getNodeBinPath()
Return the path to given bin from node packages.
protected
getNodeBinPath(string $name) : string
Parameters
- $name : string
Return values
string —The path to given binary.
isSimulating()
Check if current command is being executed with option simulate.
protected
isSimulating() : bool
Return values
bool —True if using --simulate, false otherwise.
taskExecute()
Execute a command.
protected
taskExecute(array<string|int, mixed> $tasks) : mixed
Parameters
- $tasks : array<string|int, mixed>
-
An array with tasks to execute.
taskProcess()
Process the file.
protected
taskProcess(string $source[, string $destination = '' ]) : mixed
Parameters
- $source : string
-
The source file to process.
- $destination : string = ''
-
The destination file.
taskReplaceBlock()
Replace block in a file.
protected
taskReplaceBlock([string $filename = '' ]) : mixed
Parameters
- $filename : string = ''
-
The file to process.
backupRelevantFiles()
Backup all *.rst files.
private
backupRelevantFiles() : mixed
cleanDir()
Clean up given directory.
private
cleanDir(string $directory[, bool $includeHidden = true ]) : mixed
Parameters
- $directory : string
-
The directory to clean.
- $includeHidden : bool = true
-
If true, all hidden files will be removed.
cleanUpRstFiles()
Clean up documentation to keep only .html files.
private
cleanUpRstFiles() : mixed
downloadPhpDocPhar()
Ensure that the phpDoc phar file exists.
private
downloadPhpDocPhar() : bool
Return values
boolgitAddCommitPush()
Git add commit and push to the documentation branch.
private
gitAddCommitPush() : mixed
gitClone()
Clone the documentation branch (hide output to avoid expose token).
private
gitClone() : array<string|int, mixed>