Completed
Push — master ( 4b9e38...5979bd )
by Denis
01:39
created
src/Renderers/BaseRenderer.php 1 patch
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -7,37 +7,37 @@
 block discarded – undo
7 7
 
8 8
 abstract class BaseRenderer
9 9
 {
10
-    use Configurable;
11
-
12
-    /**
13
-     * HTML ID of container
14
-     * @var string
15
-     */
16
-    public $id = '';
17
-
18
-    /**
19
-     * BaseRenderer constructor.
20
-     * @param $config
21
-     * @throws \Woo\GridView\Exceptions\GridViewConfigException
22
-     */
23
-    public function __construct($config)
24
-    {
25
-        $this->loadConfig($config);
26
-
27
-        if (empty($this->id)) {
28
-            $this->id = 'grid_' . uniqid();
29
-        }
30
-    }
31
-
32
-    /**
33
-     * @return array
34
-     */
35
-    protected function configTests(): array
36
-    {
37
-        return [
38
-            'id' => 'string',
39
-        ];
40
-    }
41
-
42
-    public abstract function render(GridView $view) : string;
10
+	use Configurable;
11
+
12
+	/**
13
+	 * HTML ID of container
14
+	 * @var string
15
+	 */
16
+	public $id = '';
17
+
18
+	/**
19
+	 * BaseRenderer constructor.
20
+	 * @param $config
21
+	 * @throws \Woo\GridView\Exceptions\GridViewConfigException
22
+	 */
23
+	public function __construct($config)
24
+	{
25
+		$this->loadConfig($config);
26
+
27
+		if (empty($this->id)) {
28
+			$this->id = 'grid_' . uniqid();
29
+		}
30
+	}
31
+
32
+	/**
33
+	 * @return array
34
+	 */
35
+	protected function configTests(): array
36
+	{
37
+		return [
38
+			'id' => 'string',
39
+		];
40
+	}
41
+
42
+	public abstract function render(GridView $view) : string;
43 43
 }
44 44
\ No newline at end of file
Please login to merge, or discard this patch.
src/Renderers/DefaultRenderer.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -7,23 +7,23 @@
 block discarded – undo
7 7
 
8 8
 class DefaultRenderer extends BaseRenderer
9 9
 {
10
-    /**
11
-     * @param GridView $view
12
-     * @return string
13
-     * @throws \Throwable
14
-     */
15
-    public function render(GridView $view): string
16
-    {
17
-        $page = intval($_GET['page'] ?? 1);
10
+	/**
11
+	 * @param GridView $view
12
+	 * @return string
13
+	 * @throws \Throwable
14
+	 */
15
+	public function render(GridView $view): string
16
+	{
17
+		$page = intval($_GET['page'] ?? 1);
18 18
 
19
-        return view('woo_gridview::render-default', [
20
-            'columns' => $view->columns,
21
-            'data' => $view->dataProvider->getData($page, $view->rowsPerPage),
22
-            'tableHtmlOptions' => GridViewHelper::htmlOptionsToString($view->tableHtmlOptions),
23
-            'dataProvider' => $view->dataProvider,
24
-            'perPage' => $view->rowsPerPage,
25
-            'currentPage' => $page,
26
-            'containerId' => $this->id,
27
-        ])->render();
28
-    }
19
+		return view('woo_gridview::render-default', [
20
+			'columns' => $view->columns,
21
+			'data' => $view->dataProvider->getData($page, $view->rowsPerPage),
22
+			'tableHtmlOptions' => GridViewHelper::htmlOptionsToString($view->tableHtmlOptions),
23
+			'dataProvider' => $view->dataProvider,
24
+			'perPage' => $view->rowsPerPage,
25
+			'currentPage' => $page,
26
+			'containerId' => $this->id,
27
+		])->render();
28
+	}
29 29
 }
30 30
\ No newline at end of file
Please login to merge, or discard this patch.
src/Columns/ActionsColumn.php 1 patch
Indentation   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -6,60 +6,60 @@  discard block
 block discarded – undo
6 6
 
7 7
 class ActionsColumn extends BaseColumn
8 8
 {
9
-    /**
10
-     * By default is empty for this column
11
-     * @var string
12
-     */
13
-    public $title = '';
9
+	/**
10
+	 * By default is empty for this column
11
+	 * @var string
12
+	 */
13
+	public $title = '';
14 14
 
15
-    /**
16
-     * Value contains short codes for actions
17
-     * @var string
18
-     */
19
-    public $value = '{show} {edit} {delete}';
15
+	/**
16
+	 * Value contains short codes for actions
17
+	 * @var string
18
+	 */
19
+	public $value = '{show} {edit} {delete}';
20 20
 
21
-    /**
22
-     * Additional actions could be added, key is short-code and value is callback
23
-     * @var array
24
-     */
25
-    public $additionalActions = [];
21
+	/**
22
+	 * Additional actions could be added, key is short-code and value is callback
23
+	 * @var array
24
+	 */
25
+	public $additionalActions = [];
26 26
 
27
-    /**
28
-     * @var \Closure|null
29
-     */
30
-    public $actionsUrls;
27
+	/**
28
+	 * @var \Closure|null
29
+	 */
30
+	public $actionsUrls;
31 31
 
32
-    /**
33
-     * @var string
34
-     */
35
-    public $contentFormat = 'raw';
32
+	/**
33
+	 * @var string
34
+	 */
35
+	public $contentFormat = 'raw';
36 36
 
37
-    /**
38
-     * @return array
39
-     */
40
-    protected function configTests(): array
41
-    {
42
-        return array_merge(parent::configTests(), [
43
-            'value' => 'string',
44
-            'additionalActions' => 'array',
45
-            'actionsUrls' => 'any',
46
-        ]);
47
-    }
37
+	/**
38
+	 * @return array
39
+	 */
40
+	protected function configTests(): array
41
+	{
42
+		return array_merge(parent::configTests(), [
43
+			'value' => 'string',
44
+			'additionalActions' => 'array',
45
+			'actionsUrls' => 'any',
46
+		]);
47
+	}
48 48
 
49
-    /**
50
-     * @return array
51
-     */
52
-    public function basicActions()
53
-    {
54
-        return [
55
-            'show' => function($model) {
56
-                return '<a href="' . call_user_func($this->actionsUrls, $model)['show'] . '">View</a>';
57
-            },
58
-            'edit' => function($model) {
59
-                return '<a href="' . call_user_func($this->actionsUrls, $model)['edit'] . '">Edit</a>';
60
-            },
61
-            'delete' => function($model) {
62
-                return '
49
+	/**
50
+	 * @return array
51
+	 */
52
+	public function basicActions()
53
+	{
54
+		return [
55
+			'show' => function($model) {
56
+				return '<a href="' . call_user_func($this->actionsUrls, $model)['show'] . '">View</a>';
57
+			},
58
+			'edit' => function($model) {
59
+				return '<a href="' . call_user_func($this->actionsUrls, $model)['edit'] . '">Edit</a>';
60
+			},
61
+			'delete' => function($model) {
62
+				return '
63 63
                     <form action="' . call_user_func($this->actionsUrls, $model)['delete'] . '" method="post" class="deleteForm">
64 64
                         <input type="hidden" name="_token" value="' . csrf_token() . '">
65 65
                         <input type="hidden" name="_method" value="DELETE">
@@ -68,27 +68,27 @@  discard block
 block discarded – undo
68 68
                         >Delete</button>
69 69
                     </form>
70 70
                 ';
71
-            },
72
-        ];
73
-    }
71
+			},
72
+		];
73
+	}
74 74
 
75
-    /**
76
-     * @inheritdoc
77
-     */
78
-    public function _renderValue($row)
79
-    {
80
-        $result = $this->value;
75
+	/**
76
+	 * @inheritdoc
77
+	 */
78
+	public function _renderValue($row)
79
+	{
80
+		$result = $this->value;
81 81
 
82
-        $actions = array_merge($this->basicActions(), $this->additionalActions);
82
+		$actions = array_merge($this->basicActions(), $this->additionalActions);
83 83
 
84
-        foreach ($actions as $key => $action) {
85
-            if (strpos($result, '{' . $key . '}') === false) {
86
-                continue;
87
-            }
84
+		foreach ($actions as $key => $action) {
85
+			if (strpos($result, '{' . $key . '}') === false) {
86
+				continue;
87
+			}
88 88
 
89
-            $result = str_replace('{' . $key . '}', $action($row), $result);
90
-        }
89
+			$result = str_replace('{' . $key . '}', $action($row), $result);
90
+		}
91 91
 
92
-        return $result;
93
-    }
92
+		return $result;
93
+	}
94 94
 }
95 95
\ No newline at end of file
Please login to merge, or discard this patch.