ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\UI\Implementation\Crawler\ExamplesYamlParser Class Reference
+ Inheritance diagram for ILIAS\UI\Implementation\Crawler\ExamplesYamlParser:
+ Collaboration diagram for ILIAS\UI\Implementation\Crawler\ExamplesYamlParser:

Data Fields

const PARSER_STATE_END = 5
 
- Data Fields inherited from ILIAS\UI\Implementation\Crawler\EntriesYamlParser
const PARSER_STATE_OUTSIDE = 1
 
const PARSER_STATE_ENTRY = 2
 
const PARSER_STATE_SEEKING_RETURN = 3
 
const PARSER_STATE_SEEKING_FUNCTION_NAME = 4
 

Protected Member Functions

 getYamlEntriesFromString (string $content)
 
- Protected Member Functions inherited from ILIAS\UI\Implementation\Crawler\EntriesYamlParser
 getFileContentAsString (string $filePath)
 
 getYamlEntriesFromString (string $content)
 
 purifyYamlLine (string $line)
 
 getPHPArrayFromYamlArray (array $yaml_entries)
 
 getEntriesFromArray (array $entries_array)
 
 getEntryFromData (array $entry_data)
 

Additional Inherited Members

- Public Member Functions inherited from ILIAS\UI\Implementation\Crawler\EntriesYamlParser
 __construct ()
 FactoryCrawler constructor. More...
 
 parseYamlStringArrayFromFile (string $filePath)
 
 parseArrayFromFile (string $filePath)
 
 parseEntriesFromFile (string $filePath)
 
 parseYamlStringArrayFromString (string $content)
 
 parseArrayFromString (string $content)
 
 parseEntriesFromString (string $content)
 Returns a list UI Component Entries of the parsed YAML entries in a given string. More...
 
 parseYamlStringArrayFromFile (string $filePath)
 Returns an array of all YAML entries as string of the components in the factories in a given file. More...
 
 parseArrayFromFile (string $filePath)
 Returns an array of arrays of the parsed YAML entries in a given file. More...
 
 parseEntriesFromFile (string $filePath)
 Returns an Entry\ComponentEntries of the parsed YAML entries in a given file. More...
 
 parseYamlStringArrayFromString (string $content)
 Returns an array of all YAML entries as string of the components in the factories in a given string. More...
 
 parseArrayFromString (string $content)
 Returns an array of arrays of the parsed YAML entries in a given string. More...
 
 parseEntriesFromString (string $content)
 Returns a list UI Component Entries of the parsed YAML entries in a given string. More...
 
- Static Public Member Functions inherited from ILIAS\UI\Implementation\Crawler\EntriesYamlParser
static toUpperCamelCase (string $string, string $seperator)
 
static toLowerCamelCase (string $string, string $seperator)
 
static fromCamelCaseToWords (string $camelCaseString)
 
- Protected Attributes inherited from ILIAS\UI\Implementation\Crawler\EntriesYamlParser
array $items = array()
 
Exception Factory $ef = null
 
string $file_path = "none"
 Used to add for Information in Exceptions. More...
 

Detailed Description

Definition at line 26 of file ExamplesYamlParser.php.

Member Function Documentation

◆ getYamlEntriesFromString()

ILIAS\UI\Implementation\Crawler\ExamplesYamlParser::getYamlEntriesFromString ( string  $content)
protected
Exceptions
Exception

CrawlerException

Reimplemented from ILIAS\UI\Implementation\Crawler\EntriesYamlParser.

Definition at line 30 of file ExamplesYamlParser.php.

30 : array
31 {
32 $parser_state = self::PARSER_STATE_OUTSIDE;
33 $entry = "";
34
35 foreach (preg_split("/((\r?\n)|(\r\n?))/", $content) as $line) {
36
37 if ($parser_state === self::PARSER_STATE_OUTSIDE) {
38 if (preg_match('/---/', $line)) {
39 $entry = "";
40 $parser_state = self::PARSER_STATE_ENTRY;
41 }
42
43 } elseif ($parser_state === self::PARSER_STATE_ENTRY) {
44 if (!preg_match('/(\*$)|(---)/', $line)) {
45 $entry .= $this->purifyYamlLine($line) . "\n";
46 }
47 if (preg_match('/---/', $line)) {
48 $parser_state = self::PARSER_STATE_END;
49 }
50 }
51 }
52 if ($parser_state !== self::PARSER_STATE_END) {
53 return [];
54 }
55
56 $entry = $this->getPHPArrayFromYamlArray([$entry]);
57 return array_shift($entry);
58 }

References ILIAS\UI\Implementation\Crawler\EntriesYamlParser\getPHPArrayFromYamlArray(), ILIAS\UI\Implementation\Crawler\ExamplesYamlParser\PARSER_STATE_END, ILIAS\UI\Implementation\Crawler\EntriesYamlParser\PARSER_STATE_ENTRY, ILIAS\UI\Implementation\Crawler\EntriesYamlParser\PARSER_STATE_OUTSIDE, and ILIAS\UI\Implementation\Crawler\EntriesYamlParser\purifyYamlLine().

+ Here is the call graph for this function:

Field Documentation

◆ PARSER_STATE_END

const ILIAS\UI\Implementation\Crawler\ExamplesYamlParser::PARSER_STATE_END = 5

The documentation for this class was generated from the following file: