@@ 86-101 (lines=16) @@ | ||
83 | * @param mixed $value |
|
84 | * @return mixed |
|
85 | */ |
|
86 | protected function processTypeToResource(Attribute $definition, $value) |
|
87 | { |
|
88 | $type = $definition->getType(); |
|
89 | ||
90 | if (isset($this->registeredTypes[$type])) { |
|
91 | $parameters = $definition->getTypeParameters(); |
|
92 | ||
93 | return $this->registeredTypes[$type]->toResource($value, $parameters); |
|
94 | } |
|
95 | ||
96 | if (in_array($type, $this->genericTypes)) { |
|
97 | return $this->processGenericType($type, $value); |
|
98 | } |
|
99 | ||
100 | throw new \LogicException(sprintf('Unable to handle unknown type "%s" of attribute "%s"', $type, $definition->getName())); |
|
101 | } |
|
102 | ||
103 | /** |
|
104 | * Process data-type |
|
@@ 110-125 (lines=16) @@ | ||
107 | * @param mixed $value |
|
108 | * @return mixed |
|
109 | */ |
|
110 | protected function processResourceToType(Attribute $definition, $value) |
|
111 | { |
|
112 | $type = $definition->getType(); |
|
113 | ||
114 | if (isset($this->registeredTypes[$type])) { |
|
115 | $parameters = $definition->getTypeParameters(); |
|
116 | ||
117 | return $this->registeredTypes[$type]->fromResource($value, $parameters); |
|
118 | } |
|
119 | ||
120 | if (in_array($type, $this->genericTypes)) { |
|
121 | return $this->processGenericType($type, $value); |
|
122 | } |
|
123 | ||
124 | throw new \LogicException(sprintf('Unable to handle unknown type "%s" of attribute "%s"', $type, $definition->getName())); |
|
125 | } |
|
126 | ||
127 | /** |
|
128 | * Process generic data-types |