Which for PHP

ResultSet
in package

FinalYes

Provides convenient access to the stream of search results.

Table of Contents

Methods

__construct()  : mixed
Creates a new result set.
all()  : array<string|int, string>
Returns all instances of the searched command.
first()  : string
Returns the first instance of the searched command.
stream()  : Generator<int, SplFileInfo>
Returns a stream of instances of the searched command.

Methods

__construct()

Creates a new result set.

public __construct(string $command, Finder $finder) : mixed
Parameters
$command : string

The searched command.

$finder : Finder

The finder used to perform the search.

all()

Returns all instances of the searched command.

public all([bool $throwIfNotFound = false ]) : array<string|int, string>
Parameters
$throwIfNotFound : bool = false

Value indicating whether to throw an exception if the command is not found.

Tags
throws
RuntimeException

The command has not been found.

Return values
array<string|int, string>

All search results, or an empty array if the command is not found.

first()

Returns the first instance of the searched command.

public first([bool $throwIfNotFound = false ]) : string
Parameters
$throwIfNotFound : bool = false

Value indicating whether to throw an exception if the command is not found.

Tags
throws
RuntimeException

The command has not been found.

Return values
string

The first search result, or an empty string if the command is not found.

stream()

Returns a stream of instances of the searched command.

public stream() : Generator<int, SplFileInfo>
Return values
Generator<int, SplFileInfo>

A stream of the search results.


        
On this page

Search results