ILIAS  trunk Revision v11.0_alpha-2658-ge2404539063
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...
 
- 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

Definition at line 30 of file ExamplesYamlParser.php.

References ILIAS\UI\Implementation\Crawler\EntriesYamlParser\getPHPArrayFromYamlArray(), and ILIAS\UI\Implementation\Crawler\EntriesYamlParser\purifyYamlLine().

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  }
+ Here is the call graph for this function:

Field Documentation

◆ PARSER_STATE_END

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

Definition at line 28 of file ExamplesYamlParser.php.


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