DedupeCommand
extends Command
in package
Console command: deduplicate lines in a sorted file.
Tags
Table of Contents
- closeOutputFile() : void
- Close a file handle.
- configure() : void
- Configure the command.
- execute() : int
- Run the command.
- getInput() : string
- Fetch a single line of input from the user.
- openOutputFile() : resource
- Open a file for writing.
- writeToOutputFile() : void
- Write a line to an output file.
Methods
closeOutputFile()
Close a file handle.
protected
closeOutputFile(resource $handle) : void
Parameters
- $handle : resource
-
Handle from openOutputFile()
Return values
void —configure()
Configure the command.
protected
configure() : void
Return values
void —execute()
Run the command.
protected
execute(InputInterface $input, OutputInterface $output) : int
Parameters
- $input : InputInterface
-
Input object
- $output : OutputInterface
-
Output object
Return values
int —0 for success
getInput()
Fetch a single line of input from the user.
protected
getInput(InputInterface $input, OutputInterface $output, string $prompt) : string
Parameters
- $input : InputInterface
-
Input object
- $output : OutputInterface
-
Output object
- $prompt : string
-
Prompt to display to the user.
Return values
string —User-entered response.
openOutputFile()
Open a file for writing.
protected
openOutputFile(string $filename) : resource
Parameters
- $filename : string
-
File to open
Return values
resource —writeToOutputFile()
Write a line to an output file.
protected
writeToOutputFile(resource $handle, string $text) : void
Parameters
- $handle : resource
-
File handle
- $text : string
-
Text to write