Page MenuHomePhabricator

final class PhutilEditorConfig
Arcanist Technical Documentation ()

Parser for EditorConfig files.

Methods

public function __construct($root)

Constructor.

Parameters
string$rootThe root directory.
Return
this//Implicit.//

public function getProperty($path, $key)

Get the specified EditorConfig property for the specified path.

Parameters
string$path
string$key
Return
wild

public function getProperties($path)

Get the EditorConfig properties for the specified path.

Returns a map containing all of the EditorConfig properties which apply to the specified path. The following rules are applied when processing EditorConfig files:

  • If a glob does not contain /, it can match a path in any subdirectory.
  • If the first character of a glob is /, it will only match files in the same directory as the .editorconfig file.
  • Properties and values are case-insensitive.
  • Unknown properties will be silently ignored.
  • Values are not validated against the specification (this may change in the future).
  • Invalid glob patterns will be silently ignored.
Parameters
string$path
Return
map<string, wild>

private function getEditorConfigs($path)

Returns the EditorConfig files which affect the specified path.

Find and parse all .editorconfig files between the specified path and the root directory. The results are returned in the same order that they should be matched.

return list<pair<string, map>>

Parameters
$path
Return
wild