libphutil Technical Documentation

Updated
Sat, Apr 19, 12:53 AM

Technical documentation for developers using libphutil.

Core Utilities

Core Utilities Quick ReferenceArticleSummary of libphutil core utilities.AbstractDirectedGraphClassModels a directed graph in a generic way that works well with graphs stored in a database, and allows you to perform operations like cycle detection.array_fuse()FunctionSimplifies a common use of `array_combine()`. Specifically, this:array_interleave()FunctionAdd an element between every two elements of some array. That is, given a list `A, B, C, D`, and some element to interleave, `x`, this function returns `A, x, B, x, C, x, D`. This works like `implode()`, but does not concatenate the list into a string. In particular:array_mergev()FunctionMerge a vector of arrays performantly. This has the same semantics as array_merge(), so these calls are equivalent:array_select_keys()FunctionSelects a list of keys from an array, returning a new array with only the key-value pairs identified by the selected keys, in the specified order.assert_instances_of()FunctionChecks if all values of array are instances of the passed class. Throws InvalidArgumentException if it isn't true for any value.assert_stringlike()FunctionAssert that passed data can be converted to string.coalesce()FunctionReturns the first argument which is not strictly null, or ##null## if there are no such arguments. Identical to the MySQL function of the same name.head()FunctionReturns the first element of an array. Exactly like reset(), but doesn't choke if you pass it some non-referenceable value like the return value of a function.head_key()FunctionReturns the first key of an array.id()FunctionIdentity function, returns its argument unmodified.idx()FunctionAccess an array index, retrieving the value stored there if it exists or a default if it does not. This function allows you to concisely access an index which may or may not exist without raising a warning.ifilter()FunctionFilter a list of arrays by removing the ones with an empty() value for some index. This function works just like @{function:mfilter}, except that it operates on a list of arrays instead of a list of objects.igroup()FunctionGroup a list of arrays by the value of some index. This function is the same as @{function:mgroup}, except it operates on the values of array indexes rather than the return values of method calls.ipull()FunctionChoose an index from a list of arrays. Short for "index pull", this function works just like @{function:mpull}, except that it operates on a list of arrays and selects an index from them instead of operating on a list of objects and calling a method on them.isort()FunctionSort a list of arrays by the value of some index. This method is identical to @{function:msort}, but operates on a list of arrays instead of a list of objects.last()FunctionReturns the last element of an array. This is exactly like end() except that it won't warn you if you pass some non-referencable array to it -- e.g., the result of some other array operation.last_key()FunctionReturns the last key of an array.mfilter()FunctionFilter a list of objects by executing a method across all the objects and filter out the ones wth empty() results. this function works just like @{function:ifilter}, except that it operates on a list of objects instead of a list of arrays.mgroup()FunctionGroup a list of objects by the result of some method, similar to how GROUP BY works in an SQL query. This function simplifies grouping objects by some property:mpull()FunctionCall a method on a list of objects. Short for "method pull", this function works just like @{function:ipull}, except that it operates on a list of objects instead of a list of arrays. This function simplifies a common type of mapping operation:msort()FunctionSort a list of objects by the return value of some method. In PHP, this is often vastly more efficient than ##usort()## and similar.newv()FunctionInvokes the "new" operator with a vector of arguments. There is no way to call_user_func_array() on a class constructor, so you can instead use this function:nonempty()FunctionSimilar to @{function:coalesce}, but less strict: returns the first non-##empty()## argument, instead of the first argument that is strictly non-##null##. If no argument is nonempty, it returns the last argument. This is useful idiomatically for setting defaults:phutil_censor_credentials()FunctionAttempt to censor any plaintext credentials from a string.phutil_fwrite_nonblocking_stream()FunctionPerform an `fwrite()` which distinguishes between EAGAIN and EPIPE.phutil_is_utf8_with_only_bmp_characters()FunctionDetermine if a string is valid UTF-8, with only basic multilingual plane characters. This is particularly important because MySQL's `utf8` column types silently truncate strings which contain characters outside of this set.phutil_json_decode()FunctionDecode a JSON dictionary, or return a default value if the input does not decode or does not decode into a dictionary.phutil_loggable_string()FunctionConverts a string to a loggable one, with unprintables and newlines escaped.phutil_split_lines()FunctionSplit a corpus of text into lines. This function splits on "\n", "\r\n", or a mixture of any of them.phutil_units()FunctionConvert a human-readable unit description into a numeric one. This function allows you to replace this:PhutilArrayClassAbstract base class for implementing objects that behave like arrays. This class wraps a basic array and provides trivial implementations for `Countable`, `ArrayAccess` and `Iterator`, so subclasses need only implement specializations.PhutilArrayWithDefaultValueClassArray-like object with a default value that is populated when nonexistent keys are accessed. This is particularly useful to avoid constructs like this:PhutilBufferedIteratorClassSimple iterator that loads results page-by-page and handles buffering. In particular, this maps well to iterators that load database results page by page and allows you to implement an iterator over a large result set without needing to hold the entire set in memory.PhutilBufferedIteratorExampleClassExample implementation and test case for @{class:PhutilBufferedIterator}.PhutilCallbackFilterIteratorClassNOTE: This class has the same purpose as CallbackFilterIterator in PHP 5.4.PhutilChunkedIteratorClassThis is an iterator version of array_chunk().PhutilDirectedScalarGraphClassConcrete subclass of @{class:AbstractDirectedGraph} which can not load any data from external sources.PhutilEditDistanceMatrixClassCompute edit distance between two scalar sequences. This class uses Levenshtein (or Damerau-Levenshtein) to compute the edit distance between two inputs. The inputs are arrays containing any scalars (not just strings) so it can be used with, e.g., utf8 sequences.PhutilEditDistanceMatrixTestCaseClassPhutilLunarPhaseClassCompute the phase of the terran moon for a given epoch.PhutilLunarPhaseTestCaseClassPhutilRopeClassString-like object which reduces the cost of managing large strings. This is particularly useful for buffering large amounts of data that is being passed to `fwrite()`.PhutilRopeTestCaseClassppull()FunctionAccess a property on a list of objects. Short for "property pull", this function works just like @{function:mpull}, except that it accesses object properties instead of methods. This function simplifies a common type of mapping operation:

Authentication

PhutilAuthAdapterClassAbstract interface to an identity provider or authentication source, like Twitter, Facebook or Google.PhutilAuthAdapterEmptyClassEmpty authentication adapter with no logic.PhutilAuthAdapterLDAPClassRetrieve identify information from LDAP accounts.PhutilAuthAdapterOAuthClassAbstract adapter for OAuth2 providers.PhutilAuthAdapterOAuth1ClassAbstract adapter for OAuth1 providers.PhutilAuthAdapterOAuthAmazonClassAuthentication adapter for Amazon OAuth2.PhutilAuthAdapterOAuthAsanaClassAuthentication adapter for Asana OAuth2.PhutilAuthAdapterOAuthDisqusClassAuthentication adapter for Disqus OAuth2.PhutilAuthAdapterOAuthFacebookClassAuthentication adapter for Facebook OAuth2.PhutilAuthAdapterOAuthGitHubClassAuthentication adapter for Github OAuth2.PhutilAuthAdapterOAuthGoogleClassAuthentication adapter for Google OAuth2.PhutilAuthAdapterOAuthJIRAClassAuthentication adapter for JIRA OAuth1.PhutilAuthAdapterOAuthTwitchClassAuthentication adapter for Twitch.tv OAuth2.PhutilAuthAdapterOAuthTwitterClassAuthentication adapter for Twitter OAuth1.PhutilAuthAdapterPersonaClassAuthentication adapter for Mozilla's Persona.PhutilAuthConfigurationExceptionClassAuthentication is not configured correctly.PhutilAuthCredentialExceptionClassThe user provided invalid credentials.PhutilAuthExceptionClassAbstract exception class for errors encountered during authentication workflows.PhutilAuthUserAbortedExceptionClassThe user aborted the authentication workflow, by clicking "Cancel" or "Deny" or taking some similar action.

Handling Unicode and UTF-8

phutil_is_utf8()FunctionDetermine if a string is valid UTF-8.phutil_utf8_console_strlen()FunctionFind the console display length of a UTF-8 string. This may differ from the character length of the string if it contains double-width characters, like many Chinese characters.phutil_utf8_convert()FunctionConvert a string from one encoding (like ISO-8859-1) to another encoding (like UTF-8).phutil_utf8_hard_wrap()FunctionHard-wrap a block of UTF-8 text with no embedded HTML tags and entititesphutil_utf8_hard_wrap_html()FunctionHard-wrap a block of UTF-8 text with embedded HTML tags and entities.phutil_utf8_is_combining_character()FunctionDetermine if a given unicode character is a combining character or not.phutil_utf8_shorten()FunctionShorten a string to provide a summary, respecting UTF-8 characters. This function attempts to truncate strings at word boundaries.phutil_utf8_strlen()FunctionFind the character length of a UTF-8 string.phutil_utf8_strtolower()FunctionConvert a string to lower case in a UTF8-aware way. Similar to @{function:strtolower}.phutil_utf8_strtoupper()FunctionConvert a string to upper case in a UTF8-aware way. Similar to @{function:strtoupper}.phutil_utf8_strtr()FunctionReplace characters in a string in a UTF-aware way. Similar to @{function:strtr}.phutil_utf8_ucwords()FunctionConvert a string to title case in a UTF8-aware way. This function doesn't necessarily do a great job, but the builtin implementation of ucwords() can completely destroy inputs, so it just has to be better than that. Similar to @{function:ucwords}.phutil_utf8ize()FunctionConvert a string into valid UTF-8. This function is quite slow.phutil_utf8v()FunctionSplit a UTF-8 string into an array of characters. Combining characters are also split.phutil_utf8v_codepoints()FunctionSplit a UTF-8 string into an array of codepoints (as integers).phutil_utf8v_combined()FunctionSplit a UTF-8 string into an array of characters. Combining characters are not split.

testcase

AbstractDirectedGraphTestCaseClassExecFutureTestCaseClassFileFinderTestCaseClassFilesystemTestCaseClassFutureIteratorTestCaseClassLinesOfALargeExecFutureTestCaseClassLinesOfALargeFileTestCaseClassMFilterTestHelperClassPhutilArgumentParserTestCaseClassPhutilArgumentSpecificationTestCaseClassPhutilArrayTestCaseClassTest cases for @{class:PhutilArray} subclasses.PhutilBufferedIteratorTestCaseClassTest cases for functions in utils.php.PhutilChunkedIteratorTestCaseClassTest cases for functions in utils.php.PhutilConsoleWrapTestCaseClassPhutilDefaultSyntaxHighlighterEngineTestCaseClassTest cases for @{class:PhutilDefaultSyntaxHighlighterEngine}.PhutilDeferredLogTestCaseClassPhutilDocblockParserTestCaseClassTest cases for @{class:PhutilDocblockParser}.PhutilEmailAddressTestCaseClassTest cases for @{class:PhutilEmailAddress} parser.PhutilExcessiveServiceCallsDaemonClassDaemon which makes a lot of service calls.PhutilFatalDaemonClassDaemon which fails immediately.PhutilFileLockTestCaseClassPhutilHangForeverDaemonClassDaemon which hangs immediately.PhutilJSONTestCaseClassPhutilLanguageGuesserTestCaseClassPhutilMarkupTestCaseClassPhutilNiceDaemonClassDaemon which behaves properly.PhutilPersonTestClassPhutilPHPFragmentLexerHighlighterTestCaseClassPhutilPHTTestCaseClassTest cases for functions in pht.php.PhutilProcessGroupDaemonClassDaemon which spawns nonterminating, death-resistant children.PhutilQueryStringParserTestCaseClassTest cases for @{class:PhutilQueryStringParser} parser.PhutilRemarkupEngineTestCaseClassTest cases for @{class:PhutilRemarkupEngine}.PhutilSafeHTMLTestCaseClassPhutilSaturateStdoutDaemonClassDaemon which dumps huge amounts of data to stdout.PhutilSimpleOptionsTestCaseClassPhutilTortureTestDaemonClassDaemons which misbehave in specific ways.PhutilTranslatorTestCaseClassPhutilURITestCaseClassTest cases for @{class:PhutilURI} parser.PhutilUTF8TestCaseClassTest cases for functions in utf8.php.PhutilUtilsTestCaseClassTest cases for functions in utils.php.PhutilXHPASTSyntaxHighlighterTestCaseClassTestAbstractDirectedGraphClass

filesystem

FileFinderClassFind files on disk matching criteria, like the 'find' system utility. Use of this class is straightforward:FileListClassA list of files, primarily useful for parsing command line arguments. This class makes it easier to deal with user-specified lists of files and directories used by command line tools.FilesystemClassSimple wrapper class for common filesystem tasks like reading and writing files. When things go wrong, this class throws detailed exceptions with good information about what didn't work.FilesystemExceptionClassException thrown by Filesystem to indicate an error accessing the file system.LinesOfALargeClassAbstraction for processing large inputs without holding them in memory. This class implements line-oriented, buffered reads of some external stream, where a "line" is characterized by some delimiter character. This provides a straightforward interface for most large-input tasks, with relatively good performance.LinesOfALargeExecFutureClassRead the output stream of an @{class:ExecFuture} one line at a time. This abstraction allows you to process large inputs without holding them in memory. If you know your inputs fit in memory, it is generally more efficient (and certainly simpler) to read the entire input and `explode()` it. For more information, see @{class:LinesOfALarge}. See also @{class:LinesOfALargeFile} for a similar abstraction that works on files.LinesOfALargeFileClassRead the lines of a file, one at a time. This allows you to process large files without holding them in memory. In most cases, it is more efficient (and certainly simpler) to read the entire file and `explode()` it. For more information, see @{class:LinesOfALarge}. See also @{class:LinesOfALargeExecFuture}, for a similar abstraction that works on executed commands.PhutilDeferredLogClassObject that writes to a logfile when it is destroyed. This allows you to add more data to the log as execution unfolds, while still ensuring a write in normal circumstances (see below for discussion of cases where writes may not occur).PhutilDirectoryFixtureClassPhutilFileLockClassWrapper around `flock()` for advisory filesystem locking. Usage is straightforward:PhutilLockClassBase class for locks, like file locks.TempFileClassSimple wrapper to create a temporary file and guarantee it will be deleted on object destruction. Used like a string to path:

markup

hsprintf()FunctionFormat a HTML code. This function behaves like sprintf(), except that all the normal conversions (like %s) will be properly escaped.jsprintf()FunctionFormat a Javascript string, using JSON to export complex values. This function behaves like sprintf(), except that all the normal conversions (like %s) will be properly escaped, and additional conversions are supported:phutil_escape_html()Functionphutil_escape_html_newlines()Functionphutil_escape_uri()FunctionEscape text for inclusion in a URI or a query parameter. Note that this method does NOT escape '/', because "%2F" is invalid in paths and Apache will automatically 404 the page if it's present. This will produce correct (the URIs will work) and desirable (the URIs will be readable) behavior in these cases:phutil_escape_uri_path_component()FunctionEscape text for inclusion as an infix URI substring. See discussion at @{function:phutil_escape_uri}. This function covers an unusual special case; @{function:phutil_escape_uri} is usually the correct function to use.phutil_implode_html()FunctionHTML safe version of implode().phutil_safe_html()FunctionMark string as safe for use in HTML.phutil_tag_div()Functionphutil_unescape_uri_path_component()FunctionUnescape text that was escaped by @{function:phutil_escape_uri_path_component}. See @{function:phutil_escape_uri} for discussion.PhutilConsoleSyntaxHighlighterClassSimple syntax highlighter for console output. We just try to highlight the commands so it's easier to follow transcripts.PhutilDefaultSyntaxHighlighterClassPhutilDefaultSyntaxHighlighterEngineClassPhutilDefaultSyntaxHighlighterEnginePygmentsFutureClassPhutilDivinerSyntaxHighlighterClassSimple syntax highlighter for the ".diviner" format, which is just Remarkup with a specific ruleset. This should also work alright for Remarkup.PhutilInvisibleSyntaxHighlighterClassPhutilLexerSyntaxHighlighterClassPhutilMarkupEngineClassPhutilPygmentsSyntaxHighlighterClassPhutilRainbowSyntaxHighlighterClassHighlights source code with a rainbow of colors, regardless of the language. This highlighter is useless, absurd, and extremely slow.PhutilRemarkupBlockInterpreterClassPhutilRemarkupBlockStorageClassRemarkup prevents several classes of text-processing problems by replacing tokens in the text as they are marked up. For example, if you write something like this:PhutilRemarkupEngineClassPhutilRemarkupEngineBlockRuleClassPhutilRemarkupEngineRemarkupCodeBlockRuleClassPhutilRemarkupEngineRemarkupDefaultBlockRuleClassPhutilRemarkupEngineRemarkupHeaderBlockRuleClassPhutilRemarkupEngineRemarkupHorizontalRuleBlockRuleClassPhutilRemarkupEngineRemarkupInlineBlockRuleClassPhutilRemarkupEngineRemarkupInterpreterRuleClassPhutilRemarkupEngineRemarkupListBlockRuleClassPhutilRemarkupEngineRemarkupLiteralBlockRuleClassPhutilRemarkupEngineRemarkupNoteBlockRuleClassPhutilRemarkupEngineRemarkupQuotesBlockRuleClassPhutilRemarkupEngineRemarkupSimpleTableBlockRuleClassPhutilRemarkupEngineRemarkupTableBlockRuleClassPhutilRemarkupEngineRemarkupTestInterpreterRuleClassPhutilRemarkupRuleClassPhutilRemarkupRuleBoldClassPhutilRemarkupRuleDelClassPhutilRemarkupRuleDocumentLinkClassPhutilRemarkupRuleEscapeRemarkupClassPhutilRemarkupRuleHyperlinkClassPhutilRemarkupRuleItalicClassPhutilRemarkupRuleLinebreaksClassPhutilRemarkupRuleMonospaceClassPhutilSyntaxHighlighterClassPhutilSyntaxHighlighterEngineClassPhutilSyntaxHighlighterExceptionClassPhutilXHPASTSyntaxHighlighterClassPhutilXHPASTSyntaxHighlighterFutureClassvjsprintf()Functionxsprintf_javascript()Functionxsprintf() callback for javascript encoding.xsprintf_ldap()Functionldap_sprintf() callback for LDAP encoding.xsprintf_uri()Functionuri_sprintf() callback for URI encoding.

console

phutil_console_confirm()Functionphutil_console_format()Functionphutil_console_get_terminal_width()FunctionDetermine the width of the terminal, if possible. Returns `null` on failure.phutil_console_prompt()Functionphutil_console_require_tty()Functionphutil_console_wrap()FunctionSoft wrap text for display on a console, respecting UTF8 character boundaries and ANSI color escape sequences.PhutilArgumentParserClassParser for command-line arguments for scripts. Like similar parsers, this class allows you to specify, validate, and render help for command-line arguments. For example:PhutilArgumentParserExceptionClassPhutilArgumentSpecificationClassPhutilArgumentSpecificationExceptionClassPhutilArgumentUsageExceptionClassPhutilArgumentWorkflowClassUsed with @{class:PhutilArgumentParser} to build command line tools which operate in several modes, called "workflows", like `git`, `svn`, `arc`, `apt-get`. For example, you might build a simple calculator like this:PhutilConsoleClassProvides access to the command-line console. Instead of reading from or writing to stdin/stdout/stderr directly, this class provides a richer API including support for ANSI color and formatting, convenience methods for prompting the user, and the ability to interact with stdin/stdout/stderr in some other process instead of this one.PhutilConsoleFormatterClassPhutilConsoleServerClassPhutilConsoleServerChannelClassPhutilConsoleStdinNotInteractiveExceptionClassThrown when you prompt the user with @{function:phutil_console_prompt} or @{function:phutil_console_confirm} but stdin is not an interactive TTY so the user can't possibly respond. Usually this means the user ran the command with something piped into stdin.PhutilHelpArgumentWorkflowClassPhutilInteractiveEditorClassEdit a document interactively, by launching $EDITOR (like vi or nano).

Free Radicals

AphrontQueryCharacterSetExceptionClassExecPassthruTestCaseClassldap_sprintf()FunctionFormat an LDAP string. This function behaves like sprintf(), except that all the normal conversions (like %s) will be properly escaped, and additional conversions are supported:PhageAgentBootloaderClassPhageAgentTestCaseClassPhagePHPAgentClassPhagePHPAgentBootloaderClassPhobjectClassPHPASTParserTestCaseClassphutil_get_signal_name()FunctionReturn a human-readable signal name (like "SIGINT" or "SIGKILL") for a given signal number.phutil_tag()FunctionRender an HTML tag in a way that treats user content as unsafe by default.PhutilBallOfPHPClassConcatenates PHP files together into a single stream. Used by Phage to transmit bootloading code.PhutilBugtraqParserClassReplaces ticket or issue IDs in a block of text with links. This mechanism is based on (and compatible with) the Bugtraq system in TortiseSVN. SeePhutilBugtraqParserTestCaseClassPhutilChannelTestCaseClassPhutilCLikeCodeSnippetContextFreeGrammarClassGenerates valid context-free code for most programming languages that could pass as C. Except for PHP. But includes Java (mostly).PhutilCodeSnippetContextFreeGrammarClassGenerates non-sense code snippets according to context-free rules, respecting indentation etc.PhutilCommandStringClassPhutilConsoleMessageClassPhutilConsoleProgressBarClassShow a progress bar on the console. Usage:PhutilContextFreeGrammarClassGenerate nonsense test data according to a context-free grammar definition.PhutilcsprintfTestCaseClassPhutilEmailAddressClassBasic email address parser. This parser is very liberal and does not attempt to be fully RFC-compliant, because trying to do so is a crazy mess. However, it should parse all reasonable addresses which are actually in use on the internet today.PhutilErrorHandlerTestCaseClassPhutilErrorTrapClassTrap PHP errors while this object is alive, so they can be accessed and included in exceptions or other types of logging. For example, if you have code like this:PhutilFileTreeClassData structure for representing filesystem directory trees.PhutilGitURIClassParser for the alternate URI scheme used by SCP and Git, which look like this:PhutilGitURITestCaseClassPhutilInfrastructureTestCaseClassPhutilJavaCodeSnippetContextFreeGrammarClassPhutilJSONClassUtilities for wrangling JSON.PhutilJSONProtocolChannelClassChannel that transmits dictionaries of primitives using JSON serialization. This channel is not binary safe.PhutilJSONProtocolChannelTestCaseClassPhutilKeyValueCacheNamespaceClassPhutilKeyValueCacheProfilerClassPhutilKeyValueCacheProxyClassPhutilKeyValueCacheTestCaseClassPhutilLanguageGuesserClassVery simple class to guess the languages of source files which we failed to determine by examining file name/extension rules.PhutilLipsumContextFreeGrammarClassPhutilLockExceptionClassPhutilLogfileChannelClassA @{class:PhutilChannelChannel} which wraps some other channel and writes data passed over it to a log file.PhutilNumberClassPhutilOAuth1FutureClassProxy future that implements OAuth1 request signing. For references, see:PhutilOAuth1FutureTestCaseClassPhutilOpaqueEnvelopeClassOpaque reference to a string (like a password) that won't put any sensitive data in stack traces, var_dump(), print_r(), error logs, etc. Usage:PhutilOpaqueEnvelopeKeyClassHolds the key for @{class:PhutilOpaqueEnvelope} in a logically distant location so it will never appear in stack traces, etc. You should never need to use this class directly. See @{class:PhutilOpaqueEnvelope} for information about opaque envelopes.PhutilOpaqueEnvelopeTestCaseClassPhutilParserGeneratorClassSimple LR(1) parser generator. Generally, build a parser by setting terminals and rules, then calling @{method:processGrammar}. For example, here is a simple grammar which accepts one or more "a" followed by exactly one "b":PhutilParserGeneratorExceptionClassPhutilParserGeneratorInvalidRuleExceptionClassPhutilParserGeneratorIrreducibleRuleExceptionClassPhutilParserGeneratorTestCaseClassPhutilParserGeneratorUnknownSymbolExceptionClassPhutilParserGeneratorUnreachableRuleExceptionClassPhutilParserGeneratorUnreachableTerminalExceptionClassPhutilPHPCodeSnippetContextFreeGrammarClassPhutilPHPFragmentLexerTestCaseClassPhutilPHPObjectProtocolChannelClassChannel that transmits PHP objects using PHP serialization. This channel is binary safe.PhutilPHPObjectProtocolChannelTestCaseClassPhutilQueryStringParserClassParses a request string leaving all characters intact.PhutilReadableSerializerTestCaseClassPhutilRealnameContextFreeGrammarClassPhutilRemarkupRuleUnderlineClassPhutilSafeHTMLClassPhutilSafeHTMLProducerInterfaceInterfaceImplement this interface to mark an object as capable of producing a PhutilSafeHTML representation. This is primarily useful for building renderable HTML views.PhutilServiceProfilerClassSimple event store for service calls, so they can be printed to stdout or displayed in a debug console.PhutilShellLexerTestCaseClassPhutilSimpleOptionsClassUtilities for parsing simple option lists used in Remarkup, like codeblocks:PhutilSimpleOptionsLexerTestCaseClassPhutilSpriteClassNOTE: This is very new and unstable.PhutilSpriteSheetClassNOTE: This is very new and unstable.PhutilTestCaseClassPhutilTypeCheckExceptionClassPhutilTypeExtraParametersExceptionClassPhutilTypeMissingParametersExceptionClassPhutilTypeSpecClassPerform type checks using a simple type grammar. The grammar supports the following basic types:PhutilTypeSpecTestCaseClassPhutilURIClassBasic URI parser object.PhutilurisprintfTestCaseClassPhutilxsprintfTestCaseClassQueryFutureClassThis class provides several approaches for querying data from the database:urisprintf()FunctionFormat a URI. This function behaves like sprintf(), except that all the normal conversions (like %s) will be properly escaped, and additional conversions are supported:vurisprintf()FunctionXHPASTNodeTestCaseClassxsprintf()FunctionParse a sprintf()-style format string in an extensible way.xsprintf_callback_example()FunctionExample @{function:xsprintf} callback. When you call xsprintf(), you must pass a callback like this one. xsprintf() will invoke the callback when it encounters a conversion (like "%Z") in the pattern string.