Code Duplication    Length = 18-18 lines in 2 locations

src/Suricate/DBCollection.php 2 locations

@@ 88-105 (lines=18) @@
85
        return $collection;
86
    }
87
88
    public function loadFromSql($sql, $sqlParams = array())
89
    {
90
        $dbLink = Suricate::Database();
91
        if (static::DB_CONFIG != '') {
92
            $dbLink->setConfig(static::DB_CONFIG);
93
        }
94
95
        $results = Suricate::Database()->query($sql, $sqlParams)->fetchAll();
96
97
        if ($results !== false) {
98
            foreach ($results as $currentResult) {
99
                $itemName = $this::ITEM_TYPE;
100
                $this->addItem($itemName::instanciate($currentResult));
101
            }
102
        }
103
104
        return $this;
105
    }
106
107
    public function lazyLoadFromSql($sql, $sqlParams = array())
108
    {
@@ 107-124 (lines=18) @@
104
        return $this;
105
    }
106
107
    public function lazyLoadFromSql($sql, $sqlParams = array())
108
    {
109
        $dbLink = Suricate::Database();
110
        if (static::DB_CONFIG != '') {
111
            $dbLink->setConfig(static::DB_CONFIG);
112
        }
113
114
        $results = $dbLink->query($sql, $sqlParams)
115
            ->fetchAll();
116
117
        if ($results !== false) {
118
            foreach ($results as $currentResult) {
119
                $this->addItemLink(current($currentResult));
120
            }
121
        }
122
123
        return $this;
124
    }
125
126
    /**
127
     * Load items linked to a parentId