53 if (is_null($this->
input)) {
54 throw new EofException(
'End of input stream, or no input supplied');
61 switch ($this->
input[0]) {
66 $this->root =
new VCard([],
false);
69 throw new ParseException(
'The root component must either be a vcalendar, or a vcard');
72 foreach ($this->
input[1] as $prop) {
75 if (isset($this->
input[2]))
foreach ($this->
input[2] as $comp) {
98 $properties = array_map(
99 function($jProp) use ($self) {
100 return $self->parseProperty($jProp);
105 if (isset($jComp[2])) {
107 $components = array_map(
108 function($jComp) use ($self) {
109 return $self->parseComponent($jComp);
114 }
else $components = [];
116 return $this->root->createComponent(
118 array_merge($properties, $components),
139 $propertyName = strtoupper($propertyName);
143 $defaultPropertyClass = $this->root->getClassNameForPropertyName($propertyName);
145 $parameters = (array)$parameters;
147 $value = array_slice($jProp, 3);
149 $valueType = strtoupper($valueType);
151 if (isset($parameters[
'group'])) {
152 $propertyName = $parameters[
'group'] .
'.' . $propertyName;
153 unset($parameters[
'group']);
156 $prop = $this->root->createProperty($propertyName,
null, $parameters, $valueType);
157 $prop->setJsonValue($value);
163 if ($defaultPropertyClass ===
'Sabre\VObject\Property\FlatText') {
164 $defaultPropertyClass =
'Sabre\VObject\Property\Text';
170 if ($defaultPropertyClass !== get_class($prop)) {
171 $prop[
"VALUE"] = $valueType;
187 if (is_resource(
$input)) {
An exception for terminatinating execution or to throw for unit testing.
Exception thrown by parser when the end of the stream has been reached, before this was expected.
Exception thrown by Reader if an invalid object was attempted to be parsed.
setInput($input)
Sets the input data.
parse($input=null, $options=0)
This method starts the parsing process.
parseProperty(array $jProp)
Parses properties.
parseComponent(array $jComp)
Parses a component.