TaxonomyTrait::getTerms()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 8
nc 1
nop 1
dl 0
loc 11
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace Jidaikobo\Kontiki\Models\Traits;
4
5
trait TaxonomyTrait
6
{
7
    public function getTerms(string $taxonomy): array
8
    {
9
        $result = $this->db->table('terms as t')
10
            ->join('term_taxonomy as tt', 't.term_id', '=', 'tt.term_id')
11
            ->select('t.*')
12
            ->distinct()
13
            ->where('tt.taxonomy', $taxonomy)
14
            ->get()
15
            ->toArray();
16
17
        return $result;
18
    }
19
}
20