Conditions | 2 |
Paths | 2 |
Total Lines | 17 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
41 | public function leaves() |
||
42 | { |
||
43 | $model = new $this->owner->modelClass(); |
||
44 | $db = $model->getDb(); |
||
45 | |||
46 | 2 | $columns = [$model->leftAttribute => SORT_ASC]; |
|
47 | |||
48 | 2 | if ($model->treeAttribute !== false) { |
|
49 | 2 | $columns = [$model->treeAttribute => SORT_ASC] + $columns; |
|
50 | } |
||
51 | 2 | ||
52 | $this->owner |
||
53 | 2 | ->andWhere([$model->rightAttribute => new Expression($db->quoteColumnName($model->leftAttribute) . '+ 1')]) |
|
54 | 2 | ->addOrderBy($columns); |
|
55 | 2 | ||
56 | return $this->owner; |
||
57 | 2 | } |
|
58 | } |
||
59 |