Code Duplication    Length = 29-29 lines in 2 locations

src/eXpansion/Bundle/LocalRecords/Model/Base/Record.php 1 location

@@ 1776-1804 (lines=29) @@
1773
     *
1774
     * @return array|string
1775
     */
1776
    public function __call($name, $params)
1777
    {
1778
        if (0 === strpos($name, 'get')) {
1779
            $virtualColumn = substr($name, 3);
1780
            if ($this->hasVirtualColumn($virtualColumn)) {
1781
                return $this->getVirtualColumn($virtualColumn);
1782
            }
1783
1784
            $virtualColumn = lcfirst($virtualColumn);
1785
            if ($this->hasVirtualColumn($virtualColumn)) {
1786
                return $this->getVirtualColumn($virtualColumn);
1787
            }
1788
        }
1789
1790
        if (0 === strpos($name, 'from')) {
1791
            $format = substr($name, 4);
1792
1793
            return $this->importFrom($format, reset($params));
1794
        }
1795
1796
        if (0 === strpos($name, 'to')) {
1797
            $format = substr($name, 2);
1798
            $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true;
1799
1800
            return $this->exportTo($format, $includeLazyLoadColumns);
1801
        }
1802
1803
        throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name));
1804
    }
1805
1806
}
1807

src/eXpansion/Framework/PlayersBundle/Model/Base/Player.php 1 location

@@ 1827-1855 (lines=29) @@
1824
     *
1825
     * @return array|string
1826
     */
1827
    public function __call($name, $params)
1828
    {
1829
        if (0 === strpos($name, 'get')) {
1830
            $virtualColumn = substr($name, 3);
1831
            if ($this->hasVirtualColumn($virtualColumn)) {
1832
                return $this->getVirtualColumn($virtualColumn);
1833
            }
1834
1835
            $virtualColumn = lcfirst($virtualColumn);
1836
            if ($this->hasVirtualColumn($virtualColumn)) {
1837
                return $this->getVirtualColumn($virtualColumn);
1838
            }
1839
        }
1840
1841
        if (0 === strpos($name, 'from')) {
1842
            $format = substr($name, 4);
1843
1844
            return $this->importFrom($format, reset($params));
1845
        }
1846
1847
        if (0 === strpos($name, 'to')) {
1848
            $format = substr($name, 2);
1849
            $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true;
1850
1851
            return $this->exportTo($format, $includeLazyLoadColumns);
1852
        }
1853
1854
        throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name));
1855
    }
1856
1857
}
1858