Code Duplication    Length = 29-29 lines in 4 locations

application/modules/xbanners/models/Base/BannerImage.php 1 location

@@ 2225-2253 (lines=29) @@
2222
     *
2223
     * @return array|string
2224
     */
2225
    public function __call($name, $params)
2226
    {
2227
        if (0 === strpos($name, 'get')) {
2228
            $virtualColumn = substr($name, 3);
2229
            if ($this->hasVirtualColumn($virtualColumn)) {
2230
                return $this->getVirtualColumn($virtualColumn);
2231
            }
2232
2233
            $virtualColumn = lcfirst($virtualColumn);
2234
            if ($this->hasVirtualColumn($virtualColumn)) {
2235
                return $this->getVirtualColumn($virtualColumn);
2236
            }
2237
        }
2238
2239
        if (0 === strpos($name, 'from')) {
2240
            $format = substr($name, 4);
2241
2242
            return $this->importFrom($format, reset($params));
2243
        }
2244
2245
        if (0 === strpos($name, 'to')) {
2246
            $format = substr($name, 2);
2247
            $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true;
2248
2249
            return $this->exportTo($format, $includeLazyLoadColumns);
2250
        }
2251
2252
        throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name));
2253
    }
2254
2255
}
2256

application/modules/xbanners/models/Base/BannerImageI18n.php 1 location

@@ 1472-1500 (lines=29) @@
1469
     *
1470
     * @return array|string
1471
     */
1472
    public function __call($name, $params)
1473
    {
1474
        if (0 === strpos($name, 'get')) {
1475
            $virtualColumn = substr($name, 3);
1476
            if ($this->hasVirtualColumn($virtualColumn)) {
1477
                return $this->getVirtualColumn($virtualColumn);
1478
            }
1479
1480
            $virtualColumn = lcfirst($virtualColumn);
1481
            if ($this->hasVirtualColumn($virtualColumn)) {
1482
                return $this->getVirtualColumn($virtualColumn);
1483
            }
1484
        }
1485
1486
        if (0 === strpos($name, 'from')) {
1487
            $format = substr($name, 4);
1488
1489
            return $this->importFrom($format, reset($params));
1490
        }
1491
1492
        if (0 === strpos($name, 'to')) {
1493
            $format = substr($name, 2);
1494
            $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true;
1495
1496
            return $this->exportTo($format, $includeLazyLoadColumns);
1497
        }
1498
1499
        throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name));
1500
    }
1501
1502
}
1503

application/modules/xbanners/models/Base/Banners.php 1 location

@@ 2101-2129 (lines=29) @@
2098
     *
2099
     * @return array|string
2100
     */
2101
    public function __call($name, $params)
2102
    {
2103
        if (0 === strpos($name, 'get')) {
2104
            $virtualColumn = substr($name, 3);
2105
            if ($this->hasVirtualColumn($virtualColumn)) {
2106
                return $this->getVirtualColumn($virtualColumn);
2107
            }
2108
2109
            $virtualColumn = lcfirst($virtualColumn);
2110
            if ($this->hasVirtualColumn($virtualColumn)) {
2111
                return $this->getVirtualColumn($virtualColumn);
2112
            }
2113
        }
2114
2115
        if (0 === strpos($name, 'from')) {
2116
            $format = substr($name, 4);
2117
2118
            return $this->importFrom($format, reset($params));
2119
        }
2120
2121
        if (0 === strpos($name, 'to')) {
2122
            $format = substr($name, 2);
2123
            $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true;
2124
2125
            return $this->exportTo($format, $includeLazyLoadColumns);
2126
        }
2127
2128
        throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name));
2129
    }
2130
2131
}
2132

application/modules/xbanners/models/Base/BannersI18n.php 1 location

@@ 1289-1317 (lines=29) @@
1286
     *
1287
     * @return array|string
1288
     */
1289
    public function __call($name, $params)
1290
    {
1291
        if (0 === strpos($name, 'get')) {
1292
            $virtualColumn = substr($name, 3);
1293
            if ($this->hasVirtualColumn($virtualColumn)) {
1294
                return $this->getVirtualColumn($virtualColumn);
1295
            }
1296
1297
            $virtualColumn = lcfirst($virtualColumn);
1298
            if ($this->hasVirtualColumn($virtualColumn)) {
1299
                return $this->getVirtualColumn($virtualColumn);
1300
            }
1301
        }
1302
1303
        if (0 === strpos($name, 'from')) {
1304
            $format = substr($name, 4);
1305
1306
            return $this->importFrom($format, reset($params));
1307
        }
1308
1309
        if (0 === strpos($name, 'to')) {
1310
            $format = substr($name, 2);
1311
            $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true;
1312
1313
            return $this->exportTo($format, $includeLazyLoadColumns);
1314
        }
1315
1316
        throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name));
1317
    }
1318
1319
}
1320