diff --git a/src/symbols/PhutilSymbolLoader.php b/src/symbols/PhutilSymbolLoader.php --- a/src/symbols/PhutilSymbolLoader.php +++ b/src/symbols/PhutilSymbolLoader.php @@ -1,32 +1,39 @@ setType('class') - * ->setLibrary('example') - * ->selectAndLoadSymbols(); + * `PhutilSymbolLoader` is a query object which selects symbols which satisfy + * certain criteria, and optionally loads them. For instance, to load all + * classes in a library: + * + * ```lang=php + * $symbols = id(new PhutilSymbolLoader()) + * ->setType('class') + * ->setLibrary('example') + * ->selectAndLoadSymbols(); + * ``` * * When you execute the loading query, it returns a dictionary of matching * symbols: * - * array( - * 'class$Example' => array( - * 'type' => 'class', - * 'name' => 'Example', - * 'library' => 'libexample', - * 'where' => 'examples/example.php', - * ), - * // ... more ... - * ); + * ```lang=php + * array( + * 'class$Example' => array( + * 'type' => 'class', + * 'name' => 'Example', + * 'library' => 'libexample', + * 'where' => 'examples/example.php', + * ), + * // ... more ... + * ); + * ``` * * The **library** and **where** keys show where the symbol is defined. The * **type** and **name** keys identify the symbol itself. * - * NOTE: This class must not use libphutil functions, including id() and idx(). + * NOTE: This class must not use libphutil functions, including @{function:id} + * and @{function:idx}. * * @task config Configuring the Query * @task load Loading Symbols @@ -45,10 +52,12 @@ /** - * Select the type of symbol to load, either ##class## or ##function##. + * Select the type of symbol to load, either `class`, `function` or + * `interface`. * * @param string Type of symbol to load. * @return this + * * @task config */ public function setType($type) { @@ -63,6 +72,7 @@ * * @param string Library name. * @return this + * * @task config */ public function setLibrary($library) { @@ -81,6 +91,7 @@ * * @param string Path relative to library root, like "apps/cheese/". * @return this + * * @task config */ public function setPathPrefix($path) { @@ -95,6 +106,7 @@ * * @param string Symbol name. * @return this + * * @task config */ public function setName($name) { @@ -110,6 +122,7 @@ * * @param string Base class name. * @return this + * * @task config */ public function setAncestorClass($base) { @@ -127,6 +140,7 @@ * * @param bool True if the query should load only concrete symbols. * @return this + * * @task config */ public function setConcreteOnly($concrete) { @@ -145,6 +159,7 @@ * @return dict A dictionary of matching symbols. See top-level class * documentation for details. These symbols will be loaded * and available. + * * @task load */ public function selectAndLoadSymbols() { @@ -187,12 +202,11 @@ // As an optimization, we filter the list of candidate symbols in // several passes, applying a name-based filter first if possible since // it is highly selective and guaranteed to match at most one symbol. - // This is the common case and we land here through __autoload() so it's - // worthwhile to microoptimize a bit because this code path is very hot - // and we save 5-10ms per page for a very moderate increase in + // This is the common case and we land here through `__autoload()` so + // it's worthwhile to micro-optimize a bit because this code path is + // very hot and we save 5-10ms per page for a very moderate increase in // complexity. - if ($this->name) { // If we have a name filter, just pick the matching name out if it // exists. @@ -277,6 +291,7 @@ * * @return dict A dictionary of matching symbols. See top-level class * documentation for details. + * * @task load */ public function selectSymbolsWithoutLoading() {