MphpD
v1.1.0-rc.1 Documentation GitHub

# Utils

Class containing several utility or helper functions.

## Methods

### escape_params

Function to parse an array of given parameters.

    Utils::escape_params(array $params, int $flags = 4) : string

#### Parameters

- ##### $params

  Array of strings.

- ##### $flags

  One or multiple OR-ed together of the following:

  - MPD_ESCAPE_NORMAL - "beetle's juice" becomes "\"beetle\'s juice\""
  - MPD_ESCAPE_DOUBLE_QUOTES - "beetle's juice" becomes "\\"beetle\'s juice\\""
  - MPD_ESCAPE_PREFIX_SPACE - Adds a space at the params beginning
  - MPD_ESCAPE_SUFFIX_SPACE - Adds a space at the params ending

#### Returns `string`

string

### pos_or_range

Function to "convert" int or array to a pos or range argument

    Utils::pos_or_range( $p) : mixed

#### Parameters

- ##### $p

#### Returns `mixed`

int|string

### parse_error

Function to parse an MPD error string to an array

    Utils::parse_error(string $error) : FloFaber\MphpD\MPDException

#### Parameters

- ##### $error

  The error string. For example "ACK [error@command_listNum] {current_command} message_text"

#### Returns `FloFaber\MphpD\MPDException`

\MPDException

© 2023 Florian Faber