Code Duplication    Length = 29-29 lines in 3 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

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

app/Price/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