Code Duplication    Length = 29-29 lines in 5 locations

src/cli/Database/Base/Channel.php 1 location

@@ 1628-1656 (lines=29) @@
1625
     *
1626
     * @return array|string
1627
     */
1628
    public function __call($name, $params)
1629
    {
1630
        if (0 === strpos($name, 'get')) {
1631
            $virtualColumn = substr($name, 3);
1632
            if ($this->hasVirtualColumn($virtualColumn)) {
1633
                return $this->getVirtualColumn($virtualColumn);
1634
            }
1635
1636
            $virtualColumn = lcfirst($virtualColumn);
1637
            if ($this->hasVirtualColumn($virtualColumn)) {
1638
                return $this->getVirtualColumn($virtualColumn);
1639
            }
1640
        }
1641
1642
        if (0 === strpos($name, 'from')) {
1643
            $format = substr($name, 4);
1644
1645
            return $this->importFrom($format, reset($params));
1646
        }
1647
1648
        if (0 === strpos($name, 'to')) {
1649
            $format = substr($name, 2);
1650
            $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true;
1651
1652
            return $this->exportTo($format, $includeLazyLoadColumns);
1653
        }
1654
1655
        throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name));
1656
    }
1657
1658
}
1659

src/cli/Database/Base/Connection.php 1 location

@@ 1557-1585 (lines=29) @@
1554
     *
1555
     * @return array|string
1556
     */
1557
    public function __call($name, $params)
1558
    {
1559
        if (0 === strpos($name, 'get')) {
1560
            $virtualColumn = substr($name, 3);
1561
            if ($this->hasVirtualColumn($virtualColumn)) {
1562
                return $this->getVirtualColumn($virtualColumn);
1563
            }
1564
1565
            $virtualColumn = lcfirst($virtualColumn);
1566
            if ($this->hasVirtualColumn($virtualColumn)) {
1567
                return $this->getVirtualColumn($virtualColumn);
1568
            }
1569
        }
1570
1571
        if (0 === strpos($name, 'from')) {
1572
            $format = substr($name, 4);
1573
1574
            return $this->importFrom($format, reset($params));
1575
        }
1576
1577
        if (0 === strpos($name, 'to')) {
1578
            $format = substr($name, 2);
1579
            $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true;
1580
1581
            return $this->exportTo($format, $includeLazyLoadColumns);
1582
        }
1583
1584
        throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name));
1585
    }
1586
1587
}
1588

src/cli/Database/Base/Instance.php 1 location

@@ 2290-2318 (lines=29) @@
2287
     *
2288
     * @return array|string
2289
     */
2290
    public function __call($name, $params)
2291
    {
2292
        if (0 === strpos($name, 'get')) {
2293
            $virtualColumn = substr($name, 3);
2294
            if ($this->hasVirtualColumn($virtualColumn)) {
2295
                return $this->getVirtualColumn($virtualColumn);
2296
            }
2297
2298
            $virtualColumn = lcfirst($virtualColumn);
2299
            if ($this->hasVirtualColumn($virtualColumn)) {
2300
                return $this->getVirtualColumn($virtualColumn);
2301
            }
2302
        }
2303
2304
        if (0 === strpos($name, 'from')) {
2305
            $format = substr($name, 4);
2306
2307
            return $this->importFrom($format, reset($params));
2308
        }
2309
2310
        if (0 === strpos($name, 'to')) {
2311
            $format = substr($name, 2);
2312
            $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true;
2313
2314
            return $this->exportTo($format, $includeLazyLoadColumns);
2315
        }
2316
2317
        throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name));
2318
    }
2319
2320
}
2321

src/cli/Database/Base/Subscription.php 1 location

@@ 1846-1874 (lines=29) @@
1843
     *
1844
     * @return array|string
1845
     */
1846
    public function __call($name, $params)
1847
    {
1848
        if (0 === strpos($name, 'get')) {
1849
            $virtualColumn = substr($name, 3);
1850
            if ($this->hasVirtualColumn($virtualColumn)) {
1851
                return $this->getVirtualColumn($virtualColumn);
1852
            }
1853
1854
            $virtualColumn = lcfirst($virtualColumn);
1855
            if ($this->hasVirtualColumn($virtualColumn)) {
1856
                return $this->getVirtualColumn($virtualColumn);
1857
            }
1858
        }
1859
1860
        if (0 === strpos($name, 'from')) {
1861
            $format = substr($name, 4);
1862
1863
            return $this->importFrom($format, reset($params));
1864
        }
1865
1866
        if (0 === strpos($name, 'to')) {
1867
            $format = substr($name, 2);
1868
            $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true;
1869
1870
            return $this->exportTo($format, $includeLazyLoadColumns);
1871
        }
1872
1873
        throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name));
1874
    }
1875
1876
}
1877

src/cli/Database/Base/User.php 1 location

@@ 1944-1972 (lines=29) @@
1941
     *
1942
     * @return array|string
1943
     */
1944
    public function __call($name, $params)
1945
    {
1946
        if (0 === strpos($name, 'get')) {
1947
            $virtualColumn = substr($name, 3);
1948
            if ($this->hasVirtualColumn($virtualColumn)) {
1949
                return $this->getVirtualColumn($virtualColumn);
1950
            }
1951
1952
            $virtualColumn = lcfirst($virtualColumn);
1953
            if ($this->hasVirtualColumn($virtualColumn)) {
1954
                return $this->getVirtualColumn($virtualColumn);
1955
            }
1956
        }
1957
1958
        if (0 === strpos($name, 'from')) {
1959
            $format = substr($name, 4);
1960
1961
            return $this->importFrom($format, reset($params));
1962
        }
1963
1964
        if (0 === strpos($name, 'to')) {
1965
            $format = substr($name, 2);
1966
            $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true;
1967
1968
            return $this->exportTo($format, $includeLazyLoadColumns);
1969
        }
1970
1971
        throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name));
1972
    }
1973
1974
}
1975