/** * Takes a given piece of text and parses it for YAML * * @param string $yaml The YAML to parse * @return array */ public static function parse($yaml) { // reset replacements since these don't apply from parse to parse self::$replacements = array(); self::$replacement_types = array(); self::$i = 0; // prepare the YAML by removing comments, standardizing line-endings $yaml = self::prepare($yaml); // get indent self::setIndent($yaml); // break into structures $structures = self::breakIntoStructures($yaml); // parse structures return self::parseStructures($structures, true); }