Code Duplication    Length = 22-22 lines in 2 locations

src/Row.php 2 locations

@@ 160-181 (lines=22) @@
157
	 * @param  mixed             $key
158
	 * @return mixed
159
	 */
160
	public function getLeanMapperEntityProperty(LeanMapper\Entity $item, $key)
161
	{
162
		$properties = explode('.', $key);
163
		$value = $item;
164
165
		while ($property = array_shift($properties)) {
166
			if (!isset($value->{$property})) {
167
				if ($this->datagrid->strict_entity_property) {
168
					throw new DataGridException(sprintf(
169
						'Target Property [%s] is not an object or is empty, trying to get [%s]',
170
						$value,
171
						str_replace('.', '->', $key)
172
					));
173
				}
174
175
				return null;
176
			}
177
178
			$value = $value->{$property};
179
		}
180
181
		return $value;
182
	}
183
184
@@ 190-211 (lines=22) @@
187
	 *
188
	 * @return mixed
189
	 */
190
	public function getNextrasEntityProperty(Nextras\Orm\Entity\Entity $item, string $key)
191
	{
192
		$properties = explode('.', $key);
193
		$value = $item;
194
195
		while ($property = array_shift($properties)) {
196
			if (!isset($value->{$property})) {
197
				if ($this->datagrid->strict_entity_property) {
198
					throw new DataGridException(sprintf(
199
						'Target Property [%s] is not an object or is empty, trying to get [%s]',
200
						$value,
201
						str_replace('.', '->', $key)
202
					));
203
				}
204
205
				return null;
206
			}
207
208
			$value = $value->{$property};
209
		}
210
211
		return $value;
212
	}
213
214