Page MenuHomePhorge

final class PhutilSimpleOptions
libphutil Technical Documentation (Parsers)

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

Methods

public function __get($name)
Inherited

This method is not documented.
Parameters
$name
Return
wild

public function __set($name, $value)
Inherited

This method is not documented.
Parameters
$name
$value
Return
wild

public function current()
Inherited

This method is not documented.
Return
wild

public function key()
Inherited

This method is not documented.
Return
wild

public function next()
Inherited

This method is not documented.
Return
wild

public function rewind()
Inherited

This method is not documented.
Return
wild

public function valid()
Inherited

This method is not documented.
Return
wild

private function throwOnAttemptedIteration()
Inherited

This method is not documented.
Return
wild

public function getPhobjectClassConstant($key, $byte_limit)
Inherited

Phobject

Read the value of a class constant.

This is the same as just typing self::CONSTANTNAME, but throws a more useful message if the constant is not defined and allows the constant to be limited to a maximum length.

Parameters
string$keyName of the constant.
int|null$byte_limitMaximum number of bytes permitted in the value.
Return
stringValue of the constant.

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