Code Duplication    Length = 22-22 lines in 2 locations

src/Row.php 2 locations

@@ 138-159 (lines=22) @@
135
	 * @param  mixed             $key
136
	 * @return mixed
137
	 */
138
	public function getLeanMapperEntityProperty(LeanMapper\Entity $item, $key)
139
	{
140
		$properties = explode('.', $key);
141
		$value = $item;
142
143
		while ($property = array_shift($properties)) {
144
			if (!isset($value->{$property})) {
145
				if ($this->datagrid->strict_entity_property) {
146
					throw new DataGridException(sprintf(
147
						'Target Property [%s] is not an object or is empty, trying to get [%s]',
148
						$value, str_replace('.', '->', $key)
149
					));
150
				}
151
152
				return NULL;
153
			}
154
155
			$value = $value->{$property};
156
		}
157
158
		return $value;
159
	}
160
161
162
	/**
@@ 168-189 (lines=22) @@
165
	 * @param  string                    $key
166
	 * @return mixed
167
	 */
168
	public function getNextrasEntityProperty(Nextras\Orm\Entity\Entity $item, $key)
169
	{
170
		$properties = explode('.', $key);
171
		$value = $item;
172
173
		while ($property = array_shift($properties)) {
174
			if (!isset($value->{$property})) {
175
				if ($this->datagrid->strict_entity_property) {
176
					throw new DataGridException(sprintf(
177
						'Target Property [%s] is not an object or is empty, trying to get [%s]',
178
						$value, str_replace('.', '->', $key)
179
					));
180
				}
181
182
				return NULL;
183
			}
184
185
			$value = $value->{$property};
186
		}
187
188
		return $value;
189
	}
190
191
192
	/**