code
stringlengths
31
1.39M
docstring
stringlengths
23
16.8k
func_name
stringlengths
1
126
language
stringclasses
1 value
repo
stringlengths
7
63
path
stringlengths
7
166
url
stringlengths
50
220
license
stringclasses
7 values
public function clearLineAfter() : self { $this->output->write("\x1b[K"); return $this; }
Clears all the output from the current line after the current position.
clearLineAfter
php
deptrac/deptrac
vendor/symfony/console/Cursor.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Cursor.php
MIT
public function clearOutput() : static { $this->output->write("\x1b[0J"); return $this; }
Clears all the output from the cursors' current position to the end of the screen. @return $this
clearOutput
php
deptrac/deptrac
vendor/symfony/console/Cursor.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Cursor.php
MIT
public function clearScreen() : static { $this->output->write("\x1b[2J"); return $this; }
Clears the entire screen. @return $this
clearScreen
php
deptrac/deptrac
vendor/symfony/console/Cursor.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Cursor.php
MIT
public function getCurrentPosition() : array { static $isTtySupported; if (!($isTtySupported ??= '/' === \DIRECTORY_SEPARATOR && \stream_isatty(\STDOUT))) { return [1, 1]; } $sttyMode = \shell_exec('stty -g'); \shell_exec('stty -icanon -echo'); @\fwrite($this->input, "\x1b[6n"); $code = \trim(\fread($this->input, 1024)); \shell_exec(\sprintf('stty %s', $sttyMode)); \sscanf($code, "\x1b[%d;%dR", $row, $col); return [$col, $row]; }
Returns the current cursor position as x,y coordinates.
getCurrentPosition
php
deptrac/deptrac
vendor/symfony/console/Cursor.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Cursor.php
MIT
public static function getColorMode() : AnsiColorMode { // Use Cache from previous run (or user forced mode) if (null !== self::$colorMode) { return self::$colorMode; } // Try with $COLORTERM first if (\is_string($colorterm = \getenv('COLORTERM'))) { $colorterm = \strtolower($colorterm); if (\str_contains($colorterm, 'truecolor')) { self::setColorMode(AnsiColorMode::Ansi24); return self::$colorMode; } if (\str_contains($colorterm, '256color')) { self::setColorMode(AnsiColorMode::Ansi8); return self::$colorMode; } } // Try with $TERM if (\is_string($term = \getenv('TERM'))) { $term = \strtolower($term); if (\str_contains($term, 'truecolor')) { self::setColorMode(AnsiColorMode::Ansi24); return self::$colorMode; } if (\str_contains($term, '256color')) { self::setColorMode(AnsiColorMode::Ansi8); return self::$colorMode; } } self::setColorMode(self::DEFAULT_COLOR_MODE); return self::$colorMode; }
About Ansi color types: https://en.wikipedia.org/wiki/ANSI_escape_code#Colors For more information about true color support with terminals https://github.com/termstandard/colors/.
getColorMode
php
deptrac/deptrac
vendor/symfony/console/Terminal.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Terminal.php
MIT
private static function hasVt100Support() : bool { return \function_exists('sapi_windows_vt100_support') && \sapi_windows_vt100_support(\fopen('php://stdout', 'w')); }
Returns whether STDOUT has vt100 support (some Windows 10+ configurations).
hasVt100Support
php
deptrac/deptrac
vendor/symfony/console/Terminal.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Terminal.php
MIT
private static function initDimensionsUsingStty() : void { if ($sttyString = self::getSttyColumns()) { if (\preg_match('/rows.(\\d+);.columns.(\\d+);/is', $sttyString, $matches)) { // extract [w, h] from "rows h; columns w;" self::$width = (int) $matches[2]; self::$height = (int) $matches[1]; } elseif (\preg_match('/;.(\\d+).rows;.(\\d+).columns/is', $sttyString, $matches)) { // extract [w, h] from "; h rows; w columns" self::$width = (int) $matches[2]; self::$height = (int) $matches[1]; } } }
Initializes dimensions using the output of an stty columns line.
initDimensionsUsingStty
php
deptrac/deptrac
vendor/symfony/console/Terminal.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Terminal.php
MIT
private static function getConsoleMode() : ?array { $info = self::readFromProcess('mode CON'); if (null === $info || !\preg_match('/--------+\\r?\\n.+?(\\d+)\\r?\\n.+?(\\d+)\\r?\\n/', $info, $matches)) { return null; } return [(int) $matches[2], (int) $matches[1]]; }
Runs and parses mode CON if it's available, suppressing any error output. @return int[]|null An array composed of the width and the height or null if it could not be parsed
getConsoleMode
php
deptrac/deptrac
vendor/symfony/console/Terminal.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Terminal.php
MIT
private static function getSttyColumns() : ?string { return self::readFromProcess(['stty', '-a']); }
Runs and parses stty -a if it's available, suppressing any error output.
getSttyColumns
php
deptrac/deptrac
vendor/symfony/console/Terminal.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Terminal.php
MIT
public function error(string $message, ?string $file = null, ?int $line = null, ?int $col = null) : void { $this->log('error', $message, $file, $line, $col); }
Output an error using the Github annotations format. @see https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#setting-an-error-message
error
php
deptrac/deptrac
vendor/symfony/console/CI/GithubActionReporter.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/CI/GithubActionReporter.php
MIT
public function warning(string $message, ?string $file = null, ?int $line = null, ?int $col = null) : void { $this->log('warning', $message, $file, $line, $col); }
Output a warning using the Github annotations format. @see https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#setting-a-warning-message
warning
php
deptrac/deptrac
vendor/symfony/console/CI/GithubActionReporter.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/CI/GithubActionReporter.php
MIT
public function debug(string $message, ?string $file = null, ?int $line = null, ?int $col = null) : void { $this->log('debug', $message, $file, $line, $col); }
Output a debug log using the Github annotations format. @see https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#setting-a-debug-message
debug
php
deptrac/deptrac
vendor/symfony/console/CI/GithubActionReporter.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/CI/GithubActionReporter.php
MIT
public function __construct(?string $name = null) { $this->definition = new InputDefinition(); if (null === $name && null !== ($name = static::getDefaultName())) { $aliases = \explode('|', $name); if ('' === ($name = \array_shift($aliases))) { $this->setHidden(\true); $name = \array_shift($aliases); } $this->setAliases($aliases); } if (null !== $name) { $this->setName($name); } if ('' === $this->description) { $this->setDescription(static::getDefaultDescription() ?? ''); } $this->configure(); }
@param string|null $name The name of the command; passing null means it must be set in configure() @throws LogicException When the command name is empty
__construct
php
deptrac/deptrac
vendor/symfony/console/Command/Command.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Command/Command.php
MIT
public function ignoreValidationErrors() { $this->ignoreValidationErrors = \true; }
Ignores validation errors. This is mainly useful for the help command. @return void
ignoreValidationErrors
php
deptrac/deptrac
vendor/symfony/console/Command/Command.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Command/Command.php
MIT
public function getApplication() : ?Application { return $this->application; }
Gets the application instance for this command.
getApplication
php
deptrac/deptrac
vendor/symfony/console/Command/Command.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Command/Command.php
MIT
public function isEnabled() { return \true; }
Checks whether the command is enabled or not in the current environment. Override this to check for x or y and return false if the command cannot run properly under the current conditions. @return bool
isEnabled
php
deptrac/deptrac
vendor/symfony/console/Command/Command.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Command/Command.php
MIT
protected function execute(InputInterface $input, OutputInterface $output) { throw new LogicException('You must override the execute() method in the concrete command class.'); }
Executes the current command. This method is not abstract because you can use this class as a concrete class. In this case, instead of defining the execute() method, you set the code to execute by passing a Closure to the setCode() method. @return int 0 if everything went fine, or an exit code @throws LogicException When this abstract method is not implemented @see setCode()
execute
php
deptrac/deptrac
vendor/symfony/console/Command/Command.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Command/Command.php
MIT
public function run(InputInterface $input, OutputInterface $output) : int { // add the application arguments and options $this->mergeApplicationDefinition(); // bind the input against the command specific arguments/options try { $input->bind($this->getDefinition()); } catch (ExceptionInterface $e) { if (!$this->ignoreValidationErrors) { throw $e; } } $this->initialize($input, $output); if (null !== $this->processTitle) { if (\function_exists('cli_set_process_title')) { if (!@\cli_set_process_title($this->processTitle)) { if ('Darwin' === \PHP_OS) { $output->writeln('<comment>Running "cli_set_process_title" as an unprivileged user is not supported on MacOS.</comment>', OutputInterface::VERBOSITY_VERY_VERBOSE); } else { \cli_set_process_title($this->processTitle); } } } elseif (\function_exists('setproctitle')) { \setproctitle($this->processTitle); } elseif (OutputInterface::VERBOSITY_VERY_VERBOSE === $output->getVerbosity()) { $output->writeln('<comment>Install the proctitle PECL to be able to change the process title.</comment>'); } } if ($input->isInteractive()) { $this->interact($input, $output); } // The command name argument is often omitted when a command is executed directly with its run() method. // It would fail the validation if we didn't make sure the command argument is present, // since it's required by the application. if ($input->hasArgument('command') && null === $input->getArgument('command')) { $input->setArgument('command', $this->getName()); } $input->validate(); if ($this->code) { $statusCode = ($this->code)($input, $output); } else { $statusCode = $this->execute($input, $output); if (!\is_int($statusCode)) { throw new \TypeError(\sprintf('Return value of "%s::execute()" must be of the type int, "%s" returned.', static::class, \get_debug_type($statusCode))); } } return \is_numeric($statusCode) ? (int) $statusCode : 0; }
Runs the command. The code to execute is either defined directly with the setCode() method or by overriding the execute() method in a sub-class. @return int The command exit code @throws ExceptionInterface When input binding fails. Bypass this by calling {@link ignoreValidationErrors()}. @see setCode() @see execute()
run
php
deptrac/deptrac
vendor/symfony/console/Command/Command.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Command/Command.php
MIT
public function complete(CompletionInput $input, CompletionSuggestions $suggestions) : void { $definition = $this->getDefinition(); if (CompletionInput::TYPE_OPTION_VALUE === $input->getCompletionType() && $definition->hasOption($input->getCompletionName())) { $definition->getOption($input->getCompletionName())->complete($input, $suggestions); } elseif (CompletionInput::TYPE_ARGUMENT_VALUE === $input->getCompletionType() && $definition->hasArgument($input->getCompletionName())) { $definition->getArgument($input->getCompletionName())->complete($input, $suggestions); } }
Adds suggestions to $suggestions for the current completion input (e.g. option or argument).
complete
php
deptrac/deptrac
vendor/symfony/console/Command/Command.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Command/Command.php
MIT
public function setCode(callable $code) : static { if ($code instanceof \Closure) { $r = new \ReflectionFunction($code); if (null === $r->getClosureThis()) { \set_error_handler(static function () { }); try { if ($c = \Closure::bind($code, $this)) { $code = $c; } } finally { \restore_error_handler(); } } } else { $code = $code(...); } $this->code = $code; return $this; }
Sets the code to execute when running this command. If this method is used, it overrides the code defined in the execute() method. @param callable $code A callable(InputInterface $input, OutputInterface $output) @return $this @throws InvalidArgumentException @see execute()
setCode
php
deptrac/deptrac
vendor/symfony/console/Command/Command.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Command/Command.php
MIT
public function mergeApplicationDefinition(bool $mergeArgs = \true) : void { if (null === $this->application) { return; } $this->fullDefinition = new InputDefinition(); $this->fullDefinition->setOptions($this->definition->getOptions()); $this->fullDefinition->addOptions($this->application->getDefinition()->getOptions()); if ($mergeArgs) { $this->fullDefinition->setArguments($this->application->getDefinition()->getArguments()); $this->fullDefinition->addArguments($this->definition->getArguments()); } else { $this->fullDefinition->setArguments($this->definition->getArguments()); } }
Merges the application definition with the command definition. This method is not part of public API and should not be used directly. @param bool $mergeArgs Whether to merge or not the Application definition arguments to Command definition arguments @internal
mergeApplicationDefinition
php
deptrac/deptrac
vendor/symfony/console/Command/Command.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Command/Command.php
MIT
public function setDefinition(array|InputDefinition $definition) : static { if ($definition instanceof InputDefinition) { $this->definition = $definition; } else { $this->definition->setDefinition($definition); } $this->fullDefinition = null; return $this; }
Sets an array of argument and option instances. @return $this
setDefinition
php
deptrac/deptrac
vendor/symfony/console/Command/Command.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Command/Command.php
MIT
public function getDefinition() : InputDefinition { return $this->fullDefinition ?? $this->getNativeDefinition(); }
Gets the InputDefinition attached to this Command.
getDefinition
php
deptrac/deptrac
vendor/symfony/console/Command/Command.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Command/Command.php
MIT
public function getNativeDefinition() : InputDefinition { return $this->definition ?? throw new LogicException(\sprintf('Command class "%s" is not correctly initialized. You probably forgot to call the parent constructor.', static::class)); }
Gets the InputDefinition to be used to create representations of this Command. Can be overridden to provide the original command representation when it would otherwise be changed by merging with the application InputDefinition. This method is not part of public API and should not be used directly.
getNativeDefinition
php
deptrac/deptrac
vendor/symfony/console/Command/Command.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Command/Command.php
MIT
public function addArgument(string $name, ?int $mode = null, string $description = '', mixed $default = null) : static { $suggestedValues = 5 <= \func_num_args() ? \func_get_arg(4) : []; if (!\is_array($suggestedValues) && !$suggestedValues instanceof \Closure) { throw new \TypeError(\sprintf('Argument 5 passed to "%s()" must be array or \\Closure, "%s" given.', __METHOD__, \get_debug_type($suggestedValues))); } $this->definition->addArgument(new InputArgument($name, $mode, $description, $default, $suggestedValues)); $this->fullDefinition?->addArgument(new InputArgument($name, $mode, $description, $default, $suggestedValues)); return $this; }
Adds an argument. @param $mode The argument mode: InputArgument::REQUIRED or InputArgument::OPTIONAL @param $default The default value (for InputArgument::OPTIONAL mode only) @param array|\Closure(CompletionInput,CompletionSuggestions):list<string|Suggestion> $suggestedValues The values used for input completion @return $this @throws InvalidArgumentException When argument mode is not valid
addArgument
php
deptrac/deptrac
vendor/symfony/console/Command/Command.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Command/Command.php
MIT
public function setName(string $name) : static { $this->validateName($name); $this->name = $name; return $this; }
Sets the name of the command. This method can set both the namespace and the name if you separate them by a colon (:) $command->setName('foo:bar'); @return $this @throws InvalidArgumentException When the name is invalid
setName
php
deptrac/deptrac
vendor/symfony/console/Command/Command.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Command/Command.php
MIT
public function setProcessTitle(string $title) : static { $this->processTitle = $title; return $this; }
Sets the process title of the command. This feature should be used only when creating a long process command, like a daemon. @return $this
setProcessTitle
php
deptrac/deptrac
vendor/symfony/console/Command/Command.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Command/Command.php
MIT
public function setHidden(bool $hidden = \true) : static { $this->hidden = $hidden; return $this; }
@param bool $hidden Whether or not the command should be hidden from the list of commands @return $this
setHidden
php
deptrac/deptrac
vendor/symfony/console/Command/Command.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Command/Command.php
MIT
public function isHidden() : bool { return $this->hidden; }
@return bool whether the command should be publicly shown or not
isHidden
php
deptrac/deptrac
vendor/symfony/console/Command/Command.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Command/Command.php
MIT
public function setDescription(string $description) : static { $this->description = $description; return $this; }
Sets the description for the command. @return $this
setDescription
php
deptrac/deptrac
vendor/symfony/console/Command/Command.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Command/Command.php
MIT
public function getDescription() : string { return $this->description; }
Returns the description for the command.
getDescription
php
deptrac/deptrac
vendor/symfony/console/Command/Command.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Command/Command.php
MIT
public function setHelp(string $help) : static { $this->help = $help; return $this; }
Sets the help for the command. @return $this
setHelp
php
deptrac/deptrac
vendor/symfony/console/Command/Command.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Command/Command.php
MIT
public function getHelp() : string { return $this->help; }
Returns the help for the command.
getHelp
php
deptrac/deptrac
vendor/symfony/console/Command/Command.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Command/Command.php
MIT
public function getProcessedHelp() : string { $name = $this->name; $isSingleCommand = $this->application?->isSingleCommand(); $placeholders = ['%command.name%', '%command.full_name%']; $replacements = [$name, $isSingleCommand ? $_SERVER['PHP_SELF'] : $_SERVER['PHP_SELF'] . ' ' . $name]; return \str_replace($placeholders, $replacements, $this->getHelp() ?: $this->getDescription()); }
Returns the processed help for the command replacing the %command.name% and %command.full_name% patterns with the real values dynamically.
getProcessedHelp
php
deptrac/deptrac
vendor/symfony/console/Command/Command.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Command/Command.php
MIT
public function setAliases(iterable $aliases) : static { $list = []; foreach ($aliases as $alias) { $this->validateName($alias); $list[] = $alias; } $this->aliases = \is_array($aliases) ? $aliases : $list; return $this; }
Sets the aliases for the command. @param string[] $aliases An array of aliases for the command @return $this @throws InvalidArgumentException When an alias is invalid
setAliases
php
deptrac/deptrac
vendor/symfony/console/Command/Command.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Command/Command.php
MIT
public function getAliases() : array { return $this->aliases; }
Returns the aliases for the command.
getAliases
php
deptrac/deptrac
vendor/symfony/console/Command/Command.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Command/Command.php
MIT
public function getSynopsis(bool $short = \false) : string { $key = $short ? 'short' : 'long'; if (!isset($this->synopsis[$key])) { $this->synopsis[$key] = \trim(\sprintf('%s %s', $this->name, $this->definition->getSynopsis($short))); } return $this->synopsis[$key]; }
Returns the synopsis for the command. @param bool $short Whether to show the short version of the synopsis (with options folded) or not
getSynopsis
php
deptrac/deptrac
vendor/symfony/console/Command/Command.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Command/Command.php
MIT
public function addUsage(string $usage) : static { if (!\str_starts_with($usage, $this->name)) { $usage = \sprintf('%s %s', $this->name, $usage); } $this->usages[] = $usage; return $this; }
Add a command usage example, it'll be prefixed with the command name. @return $this
addUsage
php
deptrac/deptrac
vendor/symfony/console/Command/Command.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Command/Command.php
MIT
public function getUsages() : array { return $this->usages; }
Returns alternative usages of the command.
getUsages
php
deptrac/deptrac
vendor/symfony/console/Command/Command.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Command/Command.php
MIT
public function getHelper(string $name) : mixed { if (null === $this->helperSet) { throw new LogicException(\sprintf('Cannot retrieve helper "%s" because there is no HelperSet defined. Did you forget to add your command to the application or to set the application on the command using the setApplication() method? You can also set the HelperSet directly using the setHelperSet() method.', $name)); } return $this->helperSet->get($name); }
Gets a helper instance by name. @return HelperInterface @throws LogicException if no HelperSet is defined @throws InvalidArgumentException if the helper is not defined
getHelper
php
deptrac/deptrac
vendor/symfony/console/Command/Command.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Command/Command.php
MIT
private function validateName(string $name) : void { if (!\preg_match('/^[^\\:]++(\\:[^\\:]++)*$/', $name)) { throw new InvalidArgumentException(\sprintf('Command name "%s" is invalid.', $name)); } }
Validates a command name. It must be non-empty and parts can optionally be separated by ":". @throws InvalidArgumentException When the name is invalid
validateName
php
deptrac/deptrac
vendor/symfony/console/Command/Command.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Command/Command.php
MIT
public function __construct(array $completionOutputs = []) { // must be set before the parent constructor, as the property value is used in configure() $this->completionOutputs = $completionOutputs + ['bash' => BashCompletionOutput::class, 'fish' => FishCompletionOutput::class, 'zsh' => ZshCompletionOutput::class]; parent::__construct(); }
@param array<string, class-string<CompletionOutputInterface>> $completionOutputs A list of additional completion outputs, with shell name as key and FQCN as value
__construct
php
deptrac/deptrac
vendor/symfony/console/Command/CompleteCommand.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Command/CompleteCommand.php
MIT
public function addArgument(string $name, ?int $mode = null, string $description = '', mixed $default = null) : static { $suggestedValues = 5 <= \func_num_args() ? \func_get_arg(4) : []; $this->getCommand()->addArgument($name, $mode, $description, $default, $suggestedValues); return $this; }
@param array|\Closure(CompletionInput,CompletionSuggestions):list<string|Suggestion> $suggestedValues The values used for input completion
addArgument
php
deptrac/deptrac
vendor/symfony/console/Command/LazyCommand.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Command/LazyCommand.php
MIT
public function addOption(string $name, string|array|null $shortcut = null, ?int $mode = null, string $description = '', mixed $default = null) : static { $suggestedValues = 6 <= \func_num_args() ? \func_get_arg(5) : []; $this->getCommand()->addOption($name, $shortcut, $mode, $description, $default, $suggestedValues); return $this; }
@param array|\Closure(CompletionInput,CompletionSuggestions):list<string|Suggestion> $suggestedValues The values used for input completion
addOption
php
deptrac/deptrac
vendor/symfony/console/Command/LazyCommand.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Command/LazyCommand.php
MIT
private function release() : void { if ($this->lock) { $this->lock->release(); $this->lock = null; } }
Releases the command lock if there is one.
release
php
deptrac/deptrac
vendor/symfony/console/Command/LockableTrait.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Command/LockableTrait.php
MIT
public function ignoreValidationErrors() : void { $this->ignoreValidation = \true; $this->command->ignoreValidationErrors(); parent::ignoreValidationErrors(); }
{@inheritdoc} Calling parent method is required to be used in {@see parent::run()}.
ignoreValidationErrors
php
deptrac/deptrac
vendor/symfony/console/Command/TraceableCommand.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Command/TraceableCommand.php
MIT
public function setCode(callable $code) : static { $this->command->setCode($code); return parent::setCode(function (InputInterface $input, OutputInterface $output) use($code) : int { $event = $this->stopwatch->start($this->getName() . '.code'); $this->exitCode = $code($input, $output); $event->stop(); return $this->exitCode; }); }
{@inheritdoc} Calling parent method is required to be used in {@see parent::run()}.
setCode
php
deptrac/deptrac
vendor/symfony/console/Command/TraceableCommand.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Command/TraceableCommand.php
MIT
public function setProcessTitle(string $title) : static { $this->command->setProcessTitle($title); return parent::setProcessTitle($title); }
{@inheritdoc} Calling parent method is required to be used in {@see parent::run()}.
setProcessTitle
php
deptrac/deptrac
vendor/symfony/console/Command/TraceableCommand.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Command/TraceableCommand.php
MIT
public function __construct(ContainerInterface $container, array $commandMap) { $this->container = $container; $this->commandMap = $commandMap; }
@param array $commandMap An array with command names as keys and service ids as values
__construct
php
deptrac/deptrac
vendor/symfony/console/CommandLoader/ContainerCommandLoader.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/CommandLoader/ContainerCommandLoader.php
MIT
public function __construct(array $factories) { $this->factories = $factories; }
@param callable[] $factories Indexed by command names
__construct
php
deptrac/deptrac
vendor/symfony/console/CommandLoader/FactoryCommandLoader.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/CommandLoader/FactoryCommandLoader.php
MIT
public static function fromString(string $inputStr, int $currentIndex) : self { \preg_match_all('/(?<=^|\\s)([\'"]?)(.+?)(?<!\\\\)\\1(?=$|\\s)/', $inputStr, $tokens); return self::fromTokens($tokens[0], $currentIndex); }
Converts a terminal string into tokens. This is required for shell completions without COMP_WORDS support.
fromString
php
deptrac/deptrac
vendor/symfony/console/Completion/CompletionInput.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Completion/CompletionInput.php
MIT
public static function fromTokens(array $tokens, int $currentIndex) : self { $input = new self($tokens); $input->tokens = $tokens; $input->currentIndex = $currentIndex; return $input; }
Create an input based on an COMP_WORDS token list. @param string[] $tokens the set of split tokens (e.g. COMP_WORDS or argv) @param int $currentIndex the index of the cursor (e.g. COMP_CWORD)
fromTokens
php
deptrac/deptrac
vendor/symfony/console/Completion/CompletionInput.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Completion/CompletionInput.php
MIT
public function getCompletionType() : string { return $this->completionType; }
Returns the type of completion required. TYPE_ARGUMENT_VALUE when completing the value of an input argument TYPE_OPTION_VALUE when completing the value of an input option TYPE_OPTION_NAME when completing the name of an input option TYPE_NONE when nothing should be completed TYPE_OPTION_NAME and TYPE_NONE are already implemented by the Console component. @return self::TYPE_*
getCompletionType
php
deptrac/deptrac
vendor/symfony/console/Completion/CompletionInput.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Completion/CompletionInput.php
MIT
public function getCompletionName() : ?string { return $this->completionName; }
The name of the input option or argument when completing a value. @return string|null returns null when completing an option name
getCompletionName
php
deptrac/deptrac
vendor/symfony/console/Completion/CompletionInput.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Completion/CompletionInput.php
MIT
public function getCompletionValue() : string { return $this->completionValue; }
The value already typed by the user (or empty string).
getCompletionValue
php
deptrac/deptrac
vendor/symfony/console/Completion/CompletionInput.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Completion/CompletionInput.php
MIT
private function getRelevantToken() : string { return $this->tokens[$this->isCursorFree() ? $this->currentIndex - 1 : $this->currentIndex]; }
The token of the cursor, or the last token if the cursor is at the end of the input.
getRelevantToken
php
deptrac/deptrac
vendor/symfony/console/Completion/CompletionInput.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Completion/CompletionInput.php
MIT
private function isCursorFree() : bool { $nrOfTokens = \count($this->tokens); if ($this->currentIndex > $nrOfTokens) { throw new \LogicException('Current index is invalid, it must be the number of input tokens or one more.'); } return $this->currentIndex >= $nrOfTokens; }
Whether the cursor is "free" (i.e. at the end of the input preceded by a space).
isCursorFree
php
deptrac/deptrac
vendor/symfony/console/Completion/CompletionInput.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Completion/CompletionInput.php
MIT
public function suggestValue(string|Suggestion $value) : static { $this->valueSuggestions[] = !$value instanceof Suggestion ? new Suggestion($value) : $value; return $this; }
Add a suggested value for an input option or argument. @return $this
suggestValue
php
deptrac/deptrac
vendor/symfony/console/Completion/CompletionSuggestions.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Completion/CompletionSuggestions.php
MIT
public function suggestValues(array $values) : static { foreach ($values as $value) { $this->suggestValue($value); } return $this; }
Add multiple suggested values at once for an input option or argument. @param list<string|Suggestion> $values @return $this
suggestValues
php
deptrac/deptrac
vendor/symfony/console/Completion/CompletionSuggestions.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Completion/CompletionSuggestions.php
MIT
public function suggestOption(InputOption $option) : static { $this->optionSuggestions[] = $option; return $this; }
Add a suggestion for an input option name. @return $this
suggestOption
php
deptrac/deptrac
vendor/symfony/console/Completion/CompletionSuggestions.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Completion/CompletionSuggestions.php
MIT
public function suggestOptions(array $options) : static { foreach ($options as $option) { $this->suggestOption($option); } return $this; }
Add multiple suggestions for input option names at once. @param InputOption[] $options @return $this
suggestOptions
php
deptrac/deptrac
vendor/symfony/console/Completion/CompletionSuggestions.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Completion/CompletionSuggestions.php
MIT
public function getCommand() : array { $class = $this->data['command']->getType(); $r = new \ReflectionMethod($class, 'execute'); if (Command::class !== $r->getDeclaringClass()) { return ['executor' => $class . '::' . $r->name, 'file' => $r->getFileName(), 'line' => $r->getStartLine()]; } $r = new \ReflectionClass($class); return ['class' => $class, 'file' => $r->getFileName(), 'line' => $r->getStartLine()]; }
@return array{ class?: class-string, executor?: string, file: string, line: int, }
getCommand
php
deptrac/deptrac
vendor/symfony/console/DataCollector/CommandDataCollector.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/DataCollector/CommandDataCollector.php
MIT
protected function write(string $content, bool $decorated = \true) : void { parent::write($content, $decorated); }
Override parent method to set $decorated = true.
write
php
deptrac/deptrac
vendor/symfony/console/Descriptor/ReStructuredTextDescriptor.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Descriptor/ReStructuredTextDescriptor.php
MIT
private function getCommandAliasesText(Command $command) : string { $text = ''; $aliases = $command->getAliases(); if ($aliases) { $text = '[' . \implode('|', $aliases) . '] '; } return $text; }
Formats command aliases to show them in the command description.
getCommandAliasesText
php
deptrac/deptrac
vendor/symfony/console/Descriptor/TextDescriptor.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Descriptor/TextDescriptor.php
MIT
private function formatDefaultValue(mixed $default) : string { if (\INF === $default) { return 'INF'; } if (\is_string($default)) { $default = OutputFormatter::escape($default); } elseif (\is_array($default)) { foreach ($default as $key => $value) { if (\is_string($value)) { $default[$key] = OutputFormatter::escape($value); } } } return \str_replace('\\\\', '\\', \json_encode($default, \JSON_UNESCAPED_SLASHES | \JSON_UNESCAPED_UNICODE)); }
Formats input option/argument default value.
formatDefaultValue
php
deptrac/deptrac
vendor/symfony/console/Descriptor/TextDescriptor.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Descriptor/TextDescriptor.php
MIT
private function appendDocument(\DOMNode $parentNode, \DOMNode $importedParent) : void { foreach ($importedParent->childNodes as $childNode) { $parentNode->appendChild($parentNode->ownerDocument->importNode($childNode, \true)); } }
Appends document children to parent node.
appendDocument
php
deptrac/deptrac
vendor/symfony/console/Descriptor/XmlDescriptor.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Descriptor/XmlDescriptor.php
MIT
public function disableCommand() : bool { return $this->commandShouldRun = \false; }
Disables the command, so it won't be run.
disableCommand
php
deptrac/deptrac
vendor/symfony/console/Event/ConsoleCommandEvent.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Event/ConsoleCommandEvent.php
MIT
public function commandShouldRun() : bool { return $this->commandShouldRun; }
Returns true if the command is runnable, false otherwise.
commandShouldRun
php
deptrac/deptrac
vendor/symfony/console/Event/ConsoleCommandEvent.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Event/ConsoleCommandEvent.php
MIT
public function getCommand() : ?Command { return $this->command; }
Gets the command that is executed.
getCommand
php
deptrac/deptrac
vendor/symfony/console/Event/ConsoleEvent.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Event/ConsoleEvent.php
MIT
public function __construct(string $message, array $alternatives = [], int $code = 0, ?\Throwable $previous = null) { parent::__construct($message, $code, $previous); $this->alternatives = $alternatives; }
@param string $message Exception message to throw @param string[] $alternatives List of similar defined names @param int $code Exception code @param \Throwable|null $previous Previous exception used for the exception chaining
__construct
php
deptrac/deptrac
vendor/symfony/console/Exception/CommandNotFoundException.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Exception/CommandNotFoundException.php
MIT
public static function escape(string $text) : string { $text = \preg_replace('/([^\\\\]|^)([<>])/', '$1\\\\$2', $text); return self::escapeTrailingBackslash($text); }
Escapes "<" and ">" special chars in given text.
escape
php
deptrac/deptrac
vendor/symfony/console/Formatter/OutputFormatter.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Formatter/OutputFormatter.php
MIT
public static function escapeTrailingBackslash(string $text) : string { if (\str_ends_with($text, '\\')) { $len = \strlen($text); $text = \rtrim($text, '\\'); $text = \str_replace("\x00", '', $text); $text .= \str_repeat("\x00", $len - \strlen($text)); } return $text; }
Escapes trailing "\" in given text. @internal
escapeTrailingBackslash
php
deptrac/deptrac
vendor/symfony/console/Formatter/OutputFormatter.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Formatter/OutputFormatter.php
MIT
public function __construct(bool $decorated = \false, array $styles = []) { $this->decorated = $decorated; $this->setStyle('error', new OutputFormatterStyle('white', 'red')); $this->setStyle('info', new OutputFormatterStyle('green')); $this->setStyle('comment', new OutputFormatterStyle('yellow')); $this->setStyle('question', new OutputFormatterStyle('black', 'cyan')); foreach ($styles as $name => $style) { $this->setStyle($name, $style); } $this->styleStack = new OutputFormatterStyleStack(); }
Initializes console output formatter. @param OutputFormatterStyleInterface[] $styles Array of "name => FormatterStyle" instances
__construct
php
deptrac/deptrac
vendor/symfony/console/Formatter/OutputFormatter.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Formatter/OutputFormatter.php
MIT
private function createStyleFromString(string $string) : ?OutputFormatterStyleInterface { if (isset($this->styles[$string])) { return $this->styles[$string]; } if (!\preg_match_all('/([^=]+)=([^;]+)(;|$)/', $string, $matches, \PREG_SET_ORDER)) { return null; } $style = new OutputFormatterStyle(); foreach ($matches as $match) { \array_shift($match); $match[0] = \strtolower($match[0]); if ('fg' == $match[0]) { $style->setForeground(\strtolower($match[1])); } elseif ('bg' == $match[0]) { $style->setBackground(\strtolower($match[1])); } elseif ('href' === $match[0]) { $url = \preg_replace('{\\\\([<>])}', '$1', $match[1]); $style->setHref($url); } elseif ('options' === $match[0]) { \preg_match_all('([^,;]+)', \strtolower($match[1]), $options); $options = \array_shift($options); foreach ($options as $option) { $style->setOption($option); } } else { return null; } } return $style; }
Tries to create new style instance from string.
createStyleFromString
php
deptrac/deptrac
vendor/symfony/console/Formatter/OutputFormatter.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Formatter/OutputFormatter.php
MIT
private function applyCurrentStyle(string $text, string $current, int $width, int &$currentLineLength) : string { if ('' === $text) { return ''; } if (!$width) { return $this->isDecorated() ? $this->styleStack->getCurrent()->apply($text) : $text; } if (!$currentLineLength && '' !== $current) { $text = \ltrim($text); } if ($currentLineLength) { $prefix = \substr($text, 0, $i = $width - $currentLineLength) . "\n"; $text = \substr($text, $i); } else { $prefix = ''; } \preg_match('~(\\n)$~', $text, $matches); $text = $prefix . $this->addLineBreaks($text, $width); $text = \rtrim($text, "\n") . ($matches[1] ?? ''); if (!$currentLineLength && '' !== $current && !\str_ends_with($current, "\n")) { $text = "\n" . $text; } $lines = \explode("\n", $text); foreach ($lines as $line) { $currentLineLength += \strlen($line); if ($width <= $currentLineLength) { $currentLineLength = 0; } } if ($this->isDecorated()) { foreach ($lines as $i => $line) { $lines[$i] = $this->styleStack->getCurrent()->apply($line); } } return \implode("\n", $lines); }
Applies current style from stack to text, if must be applied.
applyCurrentStyle
php
deptrac/deptrac
vendor/symfony/console/Formatter/OutputFormatter.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Formatter/OutputFormatter.php
MIT
public function __construct(?string $foreground = null, ?string $background = null, array $options = []) { $this->color = new Color($this->foreground = $foreground ?: '', $this->background = $background ?: '', $this->options = $options); }
Initializes output formatter style. @param string|null $foreground The style foreground color name @param string|null $background The style background color name
__construct
php
deptrac/deptrac
vendor/symfony/console/Formatter/OutputFormatterStyle.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Formatter/OutputFormatterStyle.php
MIT
public function reset() { $this->styles = []; }
Resets stack (ie. empty internal arrays). @return void
reset
php
deptrac/deptrac
vendor/symfony/console/Formatter/OutputFormatterStyleStack.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Formatter/OutputFormatterStyleStack.php
MIT
public function push(OutputFormatterStyleInterface $style) { $this->styles[] = $style; }
Pushes a style in the stack. @return void
push
php
deptrac/deptrac
vendor/symfony/console/Formatter/OutputFormatterStyleStack.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Formatter/OutputFormatterStyleStack.php
MIT
public function pop(?OutputFormatterStyleInterface $style = null) : OutputFormatterStyleInterface { if (!$this->styles) { return $this->emptyStyle; } if (null === $style) { return \array_pop($this->styles); } foreach (\array_reverse($this->styles, \true) as $index => $stackedStyle) { if ($style->apply('') === $stackedStyle->apply('')) { $this->styles = \array_slice($this->styles, 0, $index); return $stackedStyle; } } throw new InvalidArgumentException('Incorrectly nested style tag found.'); }
Pops a style from the stack. @throws InvalidArgumentException When style tags incorrectly nested
pop
php
deptrac/deptrac
vendor/symfony/console/Formatter/OutputFormatterStyleStack.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Formatter/OutputFormatterStyleStack.php
MIT
public function getCurrent() : OutputFormatterStyleInterface { if (!$this->styles) { return $this->emptyStyle; } return $this->styles[\count($this->styles) - 1]; }
Computes current style with stacks top codes.
getCurrent
php
deptrac/deptrac
vendor/symfony/console/Formatter/OutputFormatterStyleStack.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Formatter/OutputFormatterStyleStack.php
MIT
public function describe(OutputInterface $output, ?object $object, array $options = []) { $options = \array_merge(['raw_text' => \false, 'format' => 'txt'], $options); if (!isset($this->descriptors[$options['format']])) { throw new InvalidArgumentException(\sprintf('Unsupported format "%s".', $options['format'])); } $descriptor = $this->descriptors[$options['format']]; $descriptor->describe($output, $object, $options); }
Describes an object if supported. Available options are: * format: string, the output format name * raw_text: boolean, sets output type as raw @return void @throws InvalidArgumentException when the given format is not supported
describe
php
deptrac/deptrac
vendor/symfony/console/Helper/DescriptorHelper.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Helper/DescriptorHelper.php
MIT
public function formatBlock(string|array $messages, string $style, bool $large = \false) : string { if (!\is_array($messages)) { $messages = [$messages]; } $len = 0; $lines = []; foreach ($messages as $message) { $message = OutputFormatter::escape($message); $lines[] = \sprintf($large ? ' %s ' : ' %s ', $message); $len = \max(self::width($message) + ($large ? 4 : 2), $len); } $messages = $large ? [\str_repeat(' ', $len)] : []; for ($i = 0; isset($lines[$i]); ++$i) { $messages[] = $lines[$i] . \str_repeat(' ', $len - self::width($lines[$i])); } if ($large) { $messages[] = \str_repeat(' ', $len); } for ($i = 0; isset($messages[$i]); ++$i) { $messages[$i] = \sprintf('<%s>%s</%s>', $style, $messages[$i], $style); } return \implode("\n", $messages); }
Formats a message as a block of text.
formatBlock
php
deptrac/deptrac
vendor/symfony/console/Helper/FormatterHelper.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Helper/FormatterHelper.php
MIT
public function truncate(string $message, int $length, string $suffix = '...') : string { $computedLength = $length - self::width($suffix); if ($computedLength > self::width($message)) { return $message; } return self::substr($message, 0, $length) . $suffix; }
Truncates a message to the given length.
truncate
php
deptrac/deptrac
vendor/symfony/console/Helper/FormatterHelper.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Helper/FormatterHelper.php
MIT
public static function width(?string $string) : int { $string ??= ''; if (\preg_match('//u', $string)) { return (new UnicodeString($string))->width(\false); } if (\false === ($encoding = \mb_detect_encoding($string, null, \true))) { return \strlen($string); } return \mb_strwidth($string, $encoding); }
Returns the width of a string, using mb_strwidth if it is available. The width is how many characters positions the string will use.
width
php
deptrac/deptrac
vendor/symfony/console/Helper/Helper.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Helper/Helper.php
MIT
public static function length(?string $string) : int { $string ??= ''; if (\preg_match('//u', $string)) { return (new UnicodeString($string))->length(); } if (\false === ($encoding = \mb_detect_encoding($string, null, \true))) { return \strlen($string); } return \mb_strlen($string, $encoding); }
Returns the length of a string, using mb_strlen if it is available. The length is related to how many bytes the string will use.
length
php
deptrac/deptrac
vendor/symfony/console/Helper/Helper.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Helper/Helper.php
MIT
public static function substr(?string $string, int $from, ?int $length = null) : string { $string ??= ''; if (\false === ($encoding = \mb_detect_encoding($string, null, \true))) { return \substr($string, $from, $length); } return \mb_substr($string, $from, $length, $encoding); }
Returns the subset of a string, using mb_substr if it is available.
substr
php
deptrac/deptrac
vendor/symfony/console/Helper/Helper.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Helper/Helper.php
MIT
public function has(string $name) : bool { return isset($this->helpers[$name]); }
Returns true if the helper if defined.
has
php
deptrac/deptrac
vendor/symfony/console/Helper/HelperSet.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Helper/HelperSet.php
MIT
public function get(string $name) : HelperInterface { if (!$this->has($name)) { throw new InvalidArgumentException(\sprintf('The helper "%s" is not defined.', $name)); } return $this->helpers[$name]; }
Gets a helper value. @throws InvalidArgumentException if the helper is not defined
get
php
deptrac/deptrac
vendor/symfony/console/Helper/HelperSet.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Helper/HelperSet.php
MIT
public function run(OutputInterface $output, array|Process $cmd, ?string $error = null, ?callable $callback = null, int $verbosity = OutputInterface::VERBOSITY_VERY_VERBOSE) : Process { if (!\class_exists(Process::class)) { throw new \LogicException('The ProcessHelper cannot be run as the Process component is not installed. Try running "compose require symfony/process".'); } if ($output instanceof ConsoleOutputInterface) { $output = $output->getErrorOutput(); } $formatter = $this->getHelperSet()->get('debug_formatter'); if ($cmd instanceof Process) { $cmd = [$cmd]; } if (\is_string($cmd[0] ?? null)) { $process = new Process($cmd); $cmd = []; } elseif (($cmd[0] ?? null) instanceof Process) { $process = $cmd[0]; unset($cmd[0]); } else { throw new \InvalidArgumentException(\sprintf('Invalid command provided to "%s()": the command should be an array whose first element is either the path to the binary to run or a "Process" object.', __METHOD__)); } if ($verbosity <= $output->getVerbosity()) { $output->write($formatter->start(\spl_object_hash($process), $this->escapeString($process->getCommandLine()))); } if ($output->isDebug()) { $callback = $this->wrapCallback($output, $process, $callback); } $process->run($callback, $cmd); if ($verbosity <= $output->getVerbosity()) { $message = $process->isSuccessful() ? 'Command ran successfully' : \sprintf('%s Command did not run successfully', $process->getExitCode()); $output->write($formatter->stop(\spl_object_hash($process), $message, $process->isSuccessful())); } if (!$process->isSuccessful() && null !== $error) { $output->writeln(\sprintf('<error>%s</error>', $this->escapeString($error))); } return $process; }
Runs an external process. @param array|Process $cmd An instance of Process or an array of the command and arguments @param callable|null $callback A PHP callback to run whenever there is some output available on STDOUT or STDERR
run
php
deptrac/deptrac
vendor/symfony/console/Helper/ProcessHelper.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Helper/ProcessHelper.php
MIT
public function mustRun(OutputInterface $output, array|Process $cmd, ?string $error = null, ?callable $callback = null) : Process { $process = $this->run($output, $cmd, $error, $callback); if (!$process->isSuccessful()) { throw new ProcessFailedException($process); } return $process; }
Runs the process. This is identical to run() except that an exception is thrown if the process exits with a non-zero exit code. @param array|Process $cmd An instance of Process or a command to run @param callable|null $callback A PHP callback to run whenever there is some output available on STDOUT or STDERR @throws ProcessFailedException @see run()
mustRun
php
deptrac/deptrac
vendor/symfony/console/Helper/ProcessHelper.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Helper/ProcessHelper.php
MIT
public function wrapCallback(OutputInterface $output, Process $process, ?callable $callback = null) : callable { if ($output instanceof ConsoleOutputInterface) { $output = $output->getErrorOutput(); } $formatter = $this->getHelperSet()->get('debug_formatter'); return function ($type, $buffer) use($output, $process, $callback, $formatter) { $output->write($formatter->progress(\spl_object_hash($process), $this->escapeString($buffer), Process::ERR === $type)); if (null !== $callback) { $callback($type, $buffer); } }; }
Wraps a Process callback to add debugging output.
wrapCallback
php
deptrac/deptrac
vendor/symfony/console/Helper/ProcessHelper.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Helper/ProcessHelper.php
MIT
public function __construct(OutputInterface $output, int $max = 0, float $minSecondsBetweenRedraws = 1 / 25) { if ($output instanceof ConsoleOutputInterface) { $output = $output->getErrorOutput(); } $this->output = $output; $this->setMaxSteps($max); $this->terminal = new Terminal(); if (0 < $minSecondsBetweenRedraws) { $this->redrawFreq = null; $this->minSecondsBetweenRedraws = $minSecondsBetweenRedraws; } if (!$this->output->isDecorated()) { // disable overwrite when output does not support ANSI codes. $this->overwrite = \false; // set a reasonable redraw frequency so output isn't flooded $this->redrawFreq = null; } $this->startTime = \time(); $this->cursor = new Cursor($output); }
@param int $max Maximum steps (0 if unknown)
__construct
php
deptrac/deptrac
vendor/symfony/console/Helper/ProgressBar.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Helper/ProgressBar.php
MIT
public function setPlaceholderFormatter(string $name, callable $callable) : void { $this->placeholders[$name] = $callable; }
Sets a placeholder formatter for a given name, for this instance only. @param callable(ProgressBar):string $callable A PHP callable
setPlaceholderFormatter
php
deptrac/deptrac
vendor/symfony/console/Helper/ProgressBar.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Helper/ProgressBar.php
MIT
public static function setFormatDefinition(string $name, string $format) : void { self::$formats ??= self::initFormats(); self::$formats[$name] = $format; }
Sets a format for a given name. This method also allow you to override an existing format. @param string $name The format name @param string $format A format string
setFormatDefinition
php
deptrac/deptrac
vendor/symfony/console/Helper/ProgressBar.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Helper/ProgressBar.php
MIT
public static function getFormatDefinition(string $name) : ?string { self::$formats ??= self::initFormats(); return self::$formats[$name] ?? null; }
Gets the format for a given name. @param string $name The format name
getFormatDefinition
php
deptrac/deptrac
vendor/symfony/console/Helper/ProgressBar.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Helper/ProgressBar.php
MIT
public function setMessage(string $message, string $name = 'message') : void { $this->messages[$name] = $message; }
Associates a text with a named placeholder. The text is displayed when the progress bar is rendered but only when the corresponding placeholder is part of the custom format line (by wrapping the name with %). @param string $message The text to associate with the placeholder @param string $name The name of the placeholder
setMessage
php
deptrac/deptrac
vendor/symfony/console/Helper/ProgressBar.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Helper/ProgressBar.php
MIT
public function setRedrawFrequency(?int $freq) : void { $this->redrawFreq = null !== $freq ? \max(1, $freq) : null; }
Sets the redraw frequency. @param int|null $freq The frequency in steps
setRedrawFrequency
php
deptrac/deptrac
vendor/symfony/console/Helper/ProgressBar.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Helper/ProgressBar.php
MIT
public function iterate(iterable $iterable, ?int $max = null) : iterable { $this->start($max ?? (\is_countable($iterable) ? \count($iterable) : 0)); foreach ($iterable as $key => $value) { (yield $key => $value); $this->advance(); } $this->finish(); }
Returns an iterator that will automatically update the progress bar when iterated. @template TKey @template TValue @param iterable<TKey, TValue> $iterable @param int|null $max Number of steps to complete the bar (0 if indeterminate), if null it will be inferred from $iterable @return iterable<TKey, TValue>
iterate
php
deptrac/deptrac
vendor/symfony/console/Helper/ProgressBar.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Helper/ProgressBar.php
MIT
public function start(?int $max = null, int $startAt = 0) : void { $this->startTime = \time(); $this->step = $startAt; $this->startingStep = $startAt; $startAt > 0 ? $this->setProgress($startAt) : ($this->percent = 0.0); if (null !== $max) { $this->setMaxSteps($max); } $this->display(); }
Starts the progress output. @param int|null $max Number of steps to complete the bar (0 if indeterminate), null to leave unchanged @param int $startAt The starting point of the bar (useful e.g. when resuming a previously started bar)
start
php
deptrac/deptrac
vendor/symfony/console/Helper/ProgressBar.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Helper/ProgressBar.php
MIT
public function advance(int $step = 1) : void { $this->setProgress($this->step + $step); }
Advances the progress output X steps. @param int $step Number of steps to advance
advance
php
deptrac/deptrac
vendor/symfony/console/Helper/ProgressBar.php
https://github.com/deptrac/deptrac/blob/master/vendor/symfony/console/Helper/ProgressBar.php
MIT