View   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 8
c 1
b 0
f 0
dl 0
loc 25
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A render() 0 7 1
A buildUrl() 0 3 1
1
<?php
2
3
namespace Itstructure\GridView\Actions;
4
5
/**
6
 * Class View.
7
 * @package Itstructure\GridView\Actions
8
 */
9
class View extends BaseAction
10
{
11
    const ACTION = 'view';
12
13
    /**
14
     * @param $row
15
     * @param int $bootstrapColWidth
16
     * @return array|string
17
     */
18
    public function render($row, int $bootstrapColWidth = BaseAction::BOOTSTRAP_COL_WIDTH)
19
    {
20
        return view('grid_view::actions.'.self::ACTION, [
21
            'url' => $this->getUrl($row),
22
            'bootstrapColWidth' => $bootstrapColWidth,
23
            'htmlAttributes' => $this->buildHtmlAttributes()
24
        ])->render();
25
    }
26
27
    /**
28
     * @param $row
29
     * @return string
30
     */
31
    protected function buildUrl($row)
32
    {
33
        return $this->getCurrentUrl() . '/' . $row->id . '/' . self::ACTION;
34
    }
35
}
36