Code Duplication    Length = 12-12 lines in 2 locations

src/MultiLang/MultiLang.php 1 location

@@ 317-328 (lines=12) @@
314
        return $this;
315
    }
316
317
    public function loadTextsFromDatabase($lang)
318
    {
319
        $texts = $lang ? $this->getDb()->table($this->getTableName())
320
            ->where('lang', $lang)
321
            ->get(['key', 'value', 'lang', 'scope']) : $this->getDb()->table($this->getTableName())->get(['key', 'value', 'lang', 'scope']);
322
323
        $array = [];
324
        foreach ($texts as $row) {
325
            $array[$row->key] = $row->value;
326
        }
327
        return $array;
328
    }
329
330
    public function loadTextsFromCache()
331
    {

src/MultiLang/Repository.php 1 location

@@ 76-87 (lines=12) @@
73
    }
74
75
76
    public function loadFromDatabase($lang)
77
    {
78
        $texts = $lang ? $this->getDb()->table($this->getTableName())
79
            ->where('lang', $lang)
80
            ->get(['key', 'value', 'lang', 'scope']) : $this->getDb()->table($this->getTableName())->get(['key', 'value', 'lang', 'scope']);
81
82
        $array = [];
83
        foreach ($texts as $row) {
84
            $array[$row->key] = $row->value;
85
        }
86
        return $array;
87
    }
88
89
    /**
90
     * Get a database connection instance.