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

ViewDefaults   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 2
dl 0
loc 24
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B defaults() 0 15 5
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