BinarySorter::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
c 0
b 0
f 0
rs 9.4285
cc 1
eloc 4
nc 1
nop 2
1
<?php
2
/**
3
 * Spiral Framework.
4
 *
5
 * @license   MIT
6
 * @author    Anton Titov (Wolfy-J)
7
 */
8
namespace Spiral\Listing\Sorters;
9
10
use Spiral\Listing\Dependency;
11
12
class BinarySorter extends ComplexSorter
13
{
14
    /**
15
     * @param string $expression Expression or column
16
     * @param array|Dependency  $dependencies
17
     */
18
    public function __construct($expression, $dependencies = [])
19
    {
20
        parent::__construct(
21
            new UnarySorter([$expression => self::ASC], $dependencies),
22
            new UnarySorter([$expression => self::DESC], $dependencies)
23
        );
24
    }
25
}