Nextcloud PHP API (master)

IOutput

Interface that lets you output content from a command.

Tags
since
35.0.0
Attributes
#[Consumable]
$since: '35.0.0'

Table of Contents

Methods

getVerbosity()  : Verbosity
Gets the current verbosity of the output.
isDebug()  : bool
Returns whether verbosity is debug (-vvv).
isQuiet()  : bool
Returns whether verbosity is quiet (-q).
isVerbose()  : bool
Returns whether verbosity is verbose (-v).
isVeryVerbose()  : bool
Returns whether verbosity is very verbose (-vv).
progressAdvance()  : void
Make the progress bar advance the given number of steps (or 1 step if no argument is passed):
progressFinish()  : void
Finish the progress bar (filling up all the remaining steps when its length is known):
progressIterate()  : iterable<TKey, TValue>
If your progress bar loops over an iterable collection, use the progressIterate() helper:
progressStart()  : void
Displays a progress bar with a number of steps equal to the argument passed to the method (don't pass any value if the length of the progress bar is unknown):
setVerbosity()  : void
Sets the verbosity of the output.
write()  : void
Writes a message to the output.
writeArrayInOutputFormat()  : void
Write a list of items in the format specified with --output
writeln()  : void
Writes a message to the output and adds a newline at the end.
writeStreamingTableInOutputFormat()  : void
Write a multidimensional iterator of items in the format specified with --output
writeTableInOutputFormat()  : void
Write a multidimensional array of items in the format specified with --output

Methods

getVerbosity()

Gets the current verbosity of the output.

public getVerbosity() : Verbosity
Tags
since
35.0.0
Return values
Verbosity

isDebug()

Returns whether verbosity is debug (-vvv).

public isDebug() : bool
Tags
since
35.0.0
Return values
bool

isQuiet()

Returns whether verbosity is quiet (-q).

public isQuiet() : bool
Tags
since
35.0.0
Return values
bool

isVerbose()

Returns whether verbosity is verbose (-v).

public isVerbose() : bool
Tags
since
35.0.0
Return values
bool

isVeryVerbose()

Returns whether verbosity is very verbose (-vv).

public isVeryVerbose() : bool
Tags
since
35.0.0
Return values
bool

progressAdvance()

Make the progress bar advance the given number of steps (or 1 step if no argument is passed):

public progressAdvance([int $step = 1 ]) : void
// advances the progress bar 1 step
$output->progressAdvance();
// advances the progress bar 10 steps
$output->progressAdvance(10);
Parameters
$step : int = 1
Tags
since
35.0.0

progressFinish()

Finish the progress bar (filling up all the remaining steps when its length is known):

public progressFinish() : void
$output->progressFinish();
Tags
since
35.0.0

progressIterate()

If your progress bar loops over an iterable collection, use the progressIterate() helper:

public progressIterate(iterable<TKey, TValue$iterable[, int|null $max = null ]) : iterable<TKey, TValue>
$iterable = [1, 2];

foreach ($output->progressIterate($iterable) as $value) {
    // ... do some work
}
Parameters
$iterable : iterable<TKey, TValue>
$max : int|null = null

Number of steps to complete the bar (0 if indeterminate), if null it will be inferred from $iterable

Tags
template
since
35.0.0
Return values
iterable<TKey, TValue>

progressStart()

Displays a progress bar with a number of steps equal to the argument passed to the method (don't pass any value if the length of the progress bar is unknown):

public progressStart([int $max = 0 ]) : void
// displays a progress bar of unknown length
$output->progressStart();
// displays a 100-step length progress bar
$output->progressStart(100);
Parameters
$max : int = 0
Tags
since
35.0.0

setVerbosity()

Sets the verbosity of the output.

public setVerbosity(Verbosity $level) : void
Parameters
$level : Verbosity
Tags
since
35.0.0

write()

Writes a message to the output.

public write(string|iterable<string|int, mixed> $messages[, bool $newline = false ][, Verbosity $verbosity = Verbosity::Normal ]) : void
Parameters
$messages : string|iterable<string|int, mixed>
$newline : bool = false

Whether to add a newline

$verbosity : Verbosity = Verbosity::Normal

Only write messages if verbosity is set to at least that level.

Tags
since
35.0.0

writeArrayInOutputFormat()

Write a list of items in the format specified with --output

public writeArrayInOutputFormat(array<string|int, mixed> $items[, string $prefix = ' - ' ]) : void
Parameters
$items : array<string|int, mixed>
$prefix : string = ' - '
Tags
since
35.0.0

writeln()

Writes a message to the output and adds a newline at the end.

public writeln(string|iterable<string|int, mixed> $messages[, Verbosity $verbosity = Verbosity::Normal ]) : void
Parameters
$messages : string|iterable<string|int, mixed>
$verbosity : Verbosity = Verbosity::Normal

Only write messages if verbosity is set to at least that level.

Tags
since
35.0.0

writeStreamingTableInOutputFormat()

Write a multidimensional iterator of items in the format specified with --output

public writeStreamingTableInOutputFormat(Iterator<string|int, array<string, mixed>> $items, int $tableGroupSize) : void
Parameters
$items : Iterator<string|int, array<string, mixed>>
$tableGroupSize : int
Tags
since
35.0.0

writeTableInOutputFormat()

Write a multidimensional array of items in the format specified with --output

public writeTableInOutputFormat(array<int, array<string, mixed>> $items) : void
Parameters
$items : array<int, array<string, mixed>>
Tags
since
35.0.0
On this page

Search results