Code Duplication    Length = 29-29 lines in 3 locations

packages/core/src/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

packages/selfprice/src/Models/Selfprice/Base/Selfprice.php 1 location

@@ 1238-1266 (lines=29) @@
1235
     *
1236
     * @return array|string
1237
     */
1238
    public function __call($name, $params)
1239
    {
1240
        if (0 === strpos($name, 'get')) {
1241
            $virtualColumn = substr($name, 3);
1242
            if ($this->hasVirtualColumn($virtualColumn)) {
1243
                return $this->getVirtualColumn($virtualColumn);
1244
            }
1245
1246
            $virtualColumn = lcfirst($virtualColumn);
1247
            if ($this->hasVirtualColumn($virtualColumn)) {
1248
                return $this->getVirtualColumn($virtualColumn);
1249
            }
1250
        }
1251
1252
        if (0 === strpos($name, 'from')) {
1253
            $format = substr($name, 4);
1254
1255
            return $this->importFrom($format, reset($params));
1256
        }
1257
1258
        if (0 === strpos($name, 'to')) {
1259
            $format = substr($name, 2);
1260
            $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true;
1261
1262
            return $this->exportTo($format, $includeLazyLoadColumns);
1263
        }
1264
1265
        throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name));
1266
    }
1267
1268
}
1269

packages/core/src/Models/User/Base/User.php 1 location

@@ 1538-1566 (lines=29) @@
1535
     *
1536
     * @return array|string
1537
     */
1538
    public function __call($name, $params)
1539
    {
1540
        if (0 === strpos($name, 'get')) {
1541
            $virtualColumn = substr($name, 3);
1542
            if ($this->hasVirtualColumn($virtualColumn)) {
1543
                return $this->getVirtualColumn($virtualColumn);
1544
            }
1545
1546
            $virtualColumn = lcfirst($virtualColumn);
1547
            if ($this->hasVirtualColumn($virtualColumn)) {
1548
                return $this->getVirtualColumn($virtualColumn);
1549
            }
1550
        }
1551
1552
        if (0 === strpos($name, 'from')) {
1553
            $format = substr($name, 4);
1554
1555
            return $this->importFrom($format, reset($params));
1556
        }
1557
1558
        if (0 === strpos($name, 'to')) {
1559
            $format = substr($name, 2);
1560
            $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true;
1561
1562
            return $this->exportTo($format, $includeLazyLoadColumns);
1563
        }
1564
1565
        throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name));
1566
    }
1567
1568
}
1569