Completed
Push — master ( 14b417...4b9e38 )
by Denis
01:33
created
src/GridViewHelper.php 1 patch
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -9,57 +9,57 @@
 block discarded – undo
9 9
 
10 10
 class GridViewHelper
11 11
 {
12
-    /**
13
-     * A list of grid aliases
14
-     * @var array
15
-     */
16
-    private static $aliases = [
17
-        'column' => [
18
-            'attribute' => AttributeColumn::class,
19
-            'raw' => RawColumn::class,
20
-            'actions' => ActionsColumn::class,
21
-        ],
22
-        'renderer' => [
23
-            'default' => DefaultRenderer::class,
24
-        ]
25
-    ];
12
+	/**
13
+	 * A list of grid aliases
14
+	 * @var array
15
+	 */
16
+	private static $aliases = [
17
+		'column' => [
18
+			'attribute' => AttributeColumn::class,
19
+			'raw' => RawColumn::class,
20
+			'actions' => ActionsColumn::class,
21
+		],
22
+		'renderer' => [
23
+			'default' => DefaultRenderer::class,
24
+		]
25
+	];
26 26
 
27
-    private function __construct() {}
27
+	private function __construct() {}
28 28
 
29
-    /**
30
-     * Allows to resolve class name by its alias
31
-     * @param string $context
32
-     * @param string $alias
33
-     * @return mixed
34
-     */
35
-    public static function resolveAlias(string $context, string $alias)
36
-    {
37
-        return self::$aliases[$context][$alias] ?? $alias;
38
-    }
29
+	/**
30
+	 * Allows to resolve class name by its alias
31
+	 * @param string $context
32
+	 * @param string $alias
33
+	 * @return mixed
34
+	 */
35
+	public static function resolveAlias(string $context, string $alias)
36
+	{
37
+		return self::$aliases[$context][$alias] ?? $alias;
38
+	}
39 39
 
40
-    /**
41
-     * Allows to convert options array to html string
42
-     * @param array $htmlOptions
43
-     * @param array $context - context is variables, which are allowed to use when property value calculated dynamically
44
-     * @return string
45
-     */
46
-    public static function htmlOptionsToString(array $htmlOptions, array $context = []) : string
47
-    {
48
-        if (empty($htmlOptions)) {
49
-            return '';
50
-        }
40
+	/**
41
+	 * Allows to convert options array to html string
42
+	 * @param array $htmlOptions
43
+	 * @param array $context - context is variables, which are allowed to use when property value calculated dynamically
44
+	 * @return string
45
+	 */
46
+	public static function htmlOptionsToString(array $htmlOptions, array $context = []) : string
47
+	{
48
+		if (empty($htmlOptions)) {
49
+			return '';
50
+		}
51 51
 
52
-        $out = [];
52
+		$out = [];
53 53
 
54
-        foreach ($htmlOptions as $k => $v) {
54
+		foreach ($htmlOptions as $k => $v) {
55 55
 
56
-            if ($v instanceof \Closure) {
57
-                $v = call_user_func_array($v, $context);
58
-            }
56
+			if ($v instanceof \Closure) {
57
+				$v = call_user_func_array($v, $context);
58
+			}
59 59
 
60
-            $out[] = htmlentities($k) . '="' . htmlentities($v, ENT_COMPAT) . '"';
61
-        }
60
+			$out[] = htmlentities($k) . '="' . htmlentities($v, ENT_COMPAT) . '"';
61
+		}
62 62
 
63
-        return implode(' ', $out);
64
-    }
63
+		return implode(' ', $out);
64
+	}
65 65
 }
66 66
\ No newline at end of file
Please login to merge, or discard this patch.
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.