Page MenuHomePhabricator

final class PhutilSimpleOptions
Arcanist Technical Documentation ()

Utilities for parsing simple option lists used in Remarkup, like codeblocks:

lang=php, name=example.php, lines=30, counterexample

Tasks

Parsing Simple Options

  • public function parse($input) — Convert a simple option list into a dict. For example:

Unparsing Simple Options

No methods for this task.

Parser Configuration

  • public function setCaseSensitive($case_sensitive) — Configure case sensitivity of the parser. By default, the parser is case insensitive, so "legs=4" has the same meaning as "LEGS=4". If you set it to be case sensitive, the keys have different meanings.

Internals

No methods for this task.

Other Methods

  • public function unparse($options, $escape) — Convert a dictionary into a simple option list. For example:
  • private function normalizeKey($key)
  • private function quoteString($string, $escape)

Methods

public function parse($input)

Convert a simple option list into a dict. For example:

legs=4, eyes=2

...becomes:

array(
  'legs' => '4',
  'eyes' => '2',
);
Parameters
string$inputInput option list.
Return
dictParsed dictionary.

public function unparse($options, $escape)

Convert a dictionary into a simple option list. For example:

array(
  'legs' => '4',
  'eyes' => '2',
);

...becomes:

legs=4, eyes=2
Parameters
dict$optionsInput dictionary.
string$escapeAdditional characters to escape.
Return
stringUnparsed option list.

public function setCaseSensitive($case_sensitive)

Configure case sensitivity of the parser. By default, the parser is case insensitive, so "legs=4" has the same meaning as "LEGS=4". If you set it to be case sensitive, the keys have different meanings.

Parameters
bool$case_sensitiveTrue to make the parser case sensitive, false (default) to make it case-insensitive.
Return
this

private function normalizeKey($key)

This method is not documented.
Parameters
$key
Return
wild

private function quoteString($string, $escape)

This method is not documented.
Parameters
$string
$escape
Return
wild