Code Duplication    Length = 17-17 lines in 4 locations

eZ/Publish/Core/Persistence/Legacy/Tests/Content/Gateway/DoctrineDatabaseTest.php 4 locations

@@ 1845-1861 (lines=17) @@
1842
     *
1843
     * @return int
1844
     */
1845
    protected function countContentFields($contentId = null)
1846
    {
1847
        $query = $this->getDatabaseHandler()->createSelectQuery();
1848
        $query->select('count(*)')
1849
            ->from('ezcontentobject_attribute');
1850
1851
        if ($contentId !== null) {
1852
            $query->where(
1853
                'contentobject_id=' . $contentId
1854
            );
1855
        }
1856
1857
        $statement = $query->prepare();
1858
        $statement->execute();
1859
1860
        return (int)$statement->fetchColumn();
1861
    }
1862
1863
    /**
1864
     * Counts the number of versions.
@@ 1870-1886 (lines=17) @@
1867
     *
1868
     * @return int
1869
     */
1870
    protected function countContentVersions($contentId = null)
1871
    {
1872
        $query = $this->getDatabaseHandler()->createSelectQuery();
1873
        $query->select('count(*)')
1874
            ->from('ezcontentobject_version');
1875
1876
        if ($contentId !== null) {
1877
            $query->where(
1878
                'contentobject_id=' . $contentId
1879
            );
1880
        }
1881
1882
        $statement = $query->prepare();
1883
        $statement->execute();
1884
1885
        return (int)$statement->fetchColumn();
1886
    }
1887
1888
    /**
1889
     * Counts the number of content names.
@@ 1895-1911 (lines=17) @@
1892
     *
1893
     * @return int
1894
     */
1895
    protected function countContentNames($contentId = null)
1896
    {
1897
        $query = $this->getDatabaseHandler()->createSelectQuery();
1898
        $query->select('count(*)')
1899
            ->from('ezcontentobject_name');
1900
1901
        if ($contentId !== null) {
1902
            $query->where(
1903
                'contentobject_id=' . $contentId
1904
            );
1905
        }
1906
1907
        $statement = $query->prepare();
1908
        $statement->execute();
1909
1910
        return (int)$statement->fetchColumn();
1911
    }
1912
1913
    /**
1914
     * Counts the number of content objects.
@@ 1920-1936 (lines=17) @@
1917
     *
1918
     * @return int
1919
     */
1920
    protected function countContent($contentId = null)
1921
    {
1922
        $query = $this->getDatabaseHandler()->createSelectQuery();
1923
        $query->select('count(*)')
1924
            ->from('ezcontentobject');
1925
1926
        if ($contentId !== null) {
1927
            $query->where(
1928
                'id=' . $contentId
1929
            );
1930
        }
1931
1932
        $statement = $query->prepare();
1933
        $statement->execute();
1934
1935
        return (int)$statement->fetchColumn();
1936
    }
1937
1938
    /**
1939
     * Stores $fixture in $file to be required as a fixture.