Handles the generation of API documentation for the project.
Description
This class MUST NOT be extended and SHALL utilize phpDocumentor to accomplish its task.
'wiki'
'Generates API documentation in Markdown format.'
'This command generates API documentation in Markdown format using phpDocumentor. ' . 'It accepts an optional `--target` option to specify the output directory and `--init` to initialize the wiki submodule.'
Interfaces
Defines the logger contract consumed by reusable command result helpers.
Properties
Methods
Creates a new WikiCommand instance.
Adds the standard JSON output options to the current command.
Configures the command instance.
Executes the generation of the documentation files in Markdown format.
Determines whether JSON output was requested.
Determines whether pretty JSON output was requested.
Logs a failed command result and returns the failure exit code.
Resolves the current repository remote origin URL.
Adds the repository wiki as a Git submodule when the target path is missing.
Logs an informational command message at notice level.
Logs a successful command result and returns the success exit code.
private
ComposerJsonInterface
$composer
private
FilesystemInterface
$filesystem
private
GitClientInterface
$gitClient
private
LoggerInterface
$logger
private
ProcessBuilderInterface
$processBuilder
private
ProcessQueueInterface
$processQueue
Creates a new WikiCommand instance.
public
__construct(ProcessBuilderInterface
$processBuilder, ProcessQueueInterface
$processQueue, ComposerJsonInterface
$composer, FilesystemInterface
$filesystem, GitClientInterface
$gitClient, LoggerInterface
$logger) : mixed
Parameters
Description
the composer.json accessor
Description
the filesystem used to inspect the wiki target
$logger
:
LoggerInterface
Description
the output-aware logger
Adds the standard JSON output options to the current command.
protected
addJsonOption() : static
Return values
Configures the command instance.
protected
configure() : void
Description
The method MUST set up the name and description. It MAY accept an optional --target option
pointing to an alternative configuration target path.
Executes the generation of the documentation files in Markdown format.
protected
execute(InputInterface
$input, OutputInterface
$output) : int
Description
This method MUST compile arguments based on PSR-4 namespaces to feed into phpDocumentor.
It SHOULD provide feedback on generation progress, and SHALL return self::SUCCESS on success.
Parameters
$input
:
InputInterface
Description
the input details for the command
$output
:
OutputInterface
Description
the output mechanism for logging
Return values
Description
the final execution status code
Determines whether JSON output was requested.
protected
isJsonOutput(InputInterface
$input) : bool
Description
The pretty-json flag SHALL imply JSON output.
Parameters
$input
:
InputInterface
Return values
Determines whether pretty JSON output was requested.
protected
isPrettyJsonOutput(InputInterface
$input) : bool
Parameters
$input
:
InputInterface
Return values
Logs a failed command result and returns the failure exit code.
private
failure(
string
$message, InputInterface
$input[,
array<string, mixed>
$context = []][,
string|null
$file = null][,
int|null
$line = null]) : int
Parameters
$message
:
string
Description
the failure message
$input
:
InputInterface
Description
the originating command input
$context
:
array<string, mixed>
=
[]
Description
optional extra log context
$file
:
string|null
=
null
Description
the related file path when known
$line
:
int|null
=
null
Description
the related line when known
Return values
Resolves the current repository remote origin URL.
private
getGitRepositoryUrl() : string
Return values
Description
the Git remote origin URL
Adds the repository wiki as a Git submodule when the target path is missing.
private
initializeWikiSubmodule(InputInterface
$input,
string
$target, OutputInterface
$output) : int
Parameters
$input
:
InputInterface
$target
:
string
Description
the configured wiki target path
$output
:
OutputInterface
Description
the output used for process feedback
Return values
Description
the command status code
Logs an informational command message at notice level.
private
notice(
string
$message, InputInterface
$input[,
array<string, mixed>
$context = []]) : void
Parameters
$message
:
string
Description
the notice message
$input
:
InputInterface
Description
the originating command input
$context
:
array<string, mixed>
=
[]
Description
optional extra log context
Logs a successful command result and returns the success exit code.
private
success(
string
$message, InputInterface
$input[,
array<string, mixed>
$context = []][,
string
$logLevel = LogLevel::INFO]) : int
Parameters
$message
:
string
Description
the success message
$input
:
InputInterface
Description
the originating command input
$context
:
array<string, mixed>
=
[]
Description
optional extra log context
$logLevel
:
string
=
LogLevel::INFO
Description
the PSR-3 log level used for the successful result