Completed
Push — master ( 8bf78f...74f5ec )
by Ryan
06:58
created

ViewDefaults::defaults()   B

Complexity

Conditions 5
Paths 3

Size

Total Lines 15
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 15
rs 8.8571
c 0
b 0
f 0
cc 5
eloc 7
nc 3
nop 1
1
<?php namespace Anomaly\Streams\Platform\Ui\Table\Component\View;
2
3
use Anomaly\Streams\Platform\Ui\Table\TableBuilder;
4
5
/**
6
 * Class ViewDefaults
7
 *
8
 * @link          http://anomaly.is/streams-platform
9
 * @author        AnomalyLabs, Inc. <[email protected]>
10
 * @author        Ryan Thompson <[email protected]>
11
 * @package       Anomaly\Streams\Platform\Ui\Table\Component\View
12
 */
13
class ViewDefaults
14
{
15
16
    /**
17
     * Default table views.
18
     *
19
     * @param TableBuilder $builder
20
     */
21
    public function defaults(TableBuilder $builder)
22
    {
23
        if (!$stream = $builder->getTableStream()) {
24
            return;
25
        }
26
27
        if ($stream->isTrashable() && !$builder->getViews() && !$builder->isAjax()) {
28
            $builder->setViews(
29
                [
30
                    'all',
31
                    'trash'
32
                ]
33
            );
34
        }
35
    }
36
}
37