Code Duplication    Length = 29-29 lines in 4 locations

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

@@ 2245-2273 (lines=29) @@
2242
     *
2243
     * @return array|string
2244
     */
2245
    public function __call($name, $params)
2246
    {
2247
        if (0 === strpos($name, 'get')) {
2248
            $virtualColumn = substr($name, 3);
2249
            if ($this->hasVirtualColumn($virtualColumn)) {
2250
                return $this->getVirtualColumn($virtualColumn);
2251
            }
2252
2253
            $virtualColumn = lcfirst($virtualColumn);
2254
            if ($this->hasVirtualColumn($virtualColumn)) {
2255
                return $this->getVirtualColumn($virtualColumn);
2256
            }
2257
        }
2258
2259
        if (0 === strpos($name, 'from')) {
2260
            $format = substr($name, 4);
2261
2262
            return $this->importFrom($format, reset($params));
2263
        }
2264
2265
        if (0 === strpos($name, 'to')) {
2266
            $format = substr($name, 2);
2267
            $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true;
2268
2269
            return $this->exportTo($format, $includeLazyLoadColumns);
2270
        }
2271
2272
        throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name));
2273
    }
2274
2275
}
2276

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

@@ 1492-1520 (lines=29) @@
1489
     *
1490
     * @return array|string
1491
     */
1492
    public function __call($name, $params)
1493
    {
1494
        if (0 === strpos($name, 'get')) {
1495
            $virtualColumn = substr($name, 3);
1496
            if ($this->hasVirtualColumn($virtualColumn)) {
1497
                return $this->getVirtualColumn($virtualColumn);
1498
            }
1499
1500
            $virtualColumn = lcfirst($virtualColumn);
1501
            if ($this->hasVirtualColumn($virtualColumn)) {
1502
                return $this->getVirtualColumn($virtualColumn);
1503
            }
1504
        }
1505
1506
        if (0 === strpos($name, 'from')) {
1507
            $format = substr($name, 4);
1508
1509
            return $this->importFrom($format, reset($params));
1510
        }
1511
1512
        if (0 === strpos($name, 'to')) {
1513
            $format = substr($name, 2);
1514
            $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true;
1515
1516
            return $this->exportTo($format, $includeLazyLoadColumns);
1517
        }
1518
1519
        throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name));
1520
    }
1521
1522
}
1523

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

@@ 2121-2149 (lines=29) @@
2118
     *
2119
     * @return array|string
2120
     */
2121
    public function __call($name, $params)
2122
    {
2123
        if (0 === strpos($name, 'get')) {
2124
            $virtualColumn = substr($name, 3);
2125
            if ($this->hasVirtualColumn($virtualColumn)) {
2126
                return $this->getVirtualColumn($virtualColumn);
2127
            }
2128
2129
            $virtualColumn = lcfirst($virtualColumn);
2130
            if ($this->hasVirtualColumn($virtualColumn)) {
2131
                return $this->getVirtualColumn($virtualColumn);
2132
            }
2133
        }
2134
2135
        if (0 === strpos($name, 'from')) {
2136
            $format = substr($name, 4);
2137
2138
            return $this->importFrom($format, reset($params));
2139
        }
2140
2141
        if (0 === strpos($name, 'to')) {
2142
            $format = substr($name, 2);
2143
            $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true;
2144
2145
            return $this->exportTo($format, $includeLazyLoadColumns);
2146
        }
2147
2148
        throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name));
2149
    }
2150
2151
}
2152

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

@@ 1309-1337 (lines=29) @@
1306
     *
1307
     * @return array|string
1308
     */
1309
    public function __call($name, $params)
1310
    {
1311
        if (0 === strpos($name, 'get')) {
1312
            $virtualColumn = substr($name, 3);
1313
            if ($this->hasVirtualColumn($virtualColumn)) {
1314
                return $this->getVirtualColumn($virtualColumn);
1315
            }
1316
1317
            $virtualColumn = lcfirst($virtualColumn);
1318
            if ($this->hasVirtualColumn($virtualColumn)) {
1319
                return $this->getVirtualColumn($virtualColumn);
1320
            }
1321
        }
1322
1323
        if (0 === strpos($name, 'from')) {
1324
            $format = substr($name, 4);
1325
1326
            return $this->importFrom($format, reset($params));
1327
        }
1328
1329
        if (0 === strpos($name, 'to')) {
1330
            $format = substr($name, 2);
1331
            $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true;
1332
1333
            return $this->exportTo($format, $includeLazyLoadColumns);
1334
        }
1335
1336
        throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name));
1337
    }
1338
1339
}
1340