Code Duplication    Length = 29-29 lines in 2 locations

app/Models/Task/Base/Task.php 1 location

@@ 1197-1225 (lines=29) @@
1194
     *
1195
     * @return array|string
1196
     */
1197
    public function __call($name, $params)
1198
    {
1199
        if (0 === strpos($name, 'get')) {
1200
            $virtualColumn = substr($name, 3);
1201
            if ($this->hasVirtualColumn($virtualColumn)) {
1202
                return $this->getVirtualColumn($virtualColumn);
1203
            }
1204
1205
            $virtualColumn = lcfirst($virtualColumn);
1206
            if ($this->hasVirtualColumn($virtualColumn)) {
1207
                return $this->getVirtualColumn($virtualColumn);
1208
            }
1209
        }
1210
1211
        if (0 === strpos($name, 'from')) {
1212
            $format = substr($name, 4);
1213
1214
            return $this->importFrom($format, reset($params));
1215
        }
1216
1217
        if (0 === strpos($name, 'to')) {
1218
            $format = substr($name, 2);
1219
            $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true;
1220
1221
            return $this->exportTo($format, $includeLazyLoadColumns);
1222
        }
1223
1224
        throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name));
1225
    }
1226
1227
}
1228

app/Models/User/Base/User.php 1 location

@@ 1437-1465 (lines=29) @@
1434
     *
1435
     * @return array|string
1436
     */
1437
    public function __call($name, $params)
1438
    {
1439
        if (0 === strpos($name, 'get')) {
1440
            $virtualColumn = substr($name, 3);
1441
            if ($this->hasVirtualColumn($virtualColumn)) {
1442
                return $this->getVirtualColumn($virtualColumn);
1443
            }
1444
1445
            $virtualColumn = lcfirst($virtualColumn);
1446
            if ($this->hasVirtualColumn($virtualColumn)) {
1447
                return $this->getVirtualColumn($virtualColumn);
1448
            }
1449
        }
1450
1451
        if (0 === strpos($name, 'from')) {
1452
            $format = substr($name, 4);
1453
1454
            return $this->importFrom($format, reset($params));
1455
        }
1456
1457
        if (0 === strpos($name, 'to')) {
1458
            $format = substr($name, 2);
1459
            $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true;
1460
1461
            return $this->exportTo($format, $includeLazyLoadColumns);
1462
        }
1463
1464
        throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name));
1465
    }
1466
1467
}
1468