BaseButton::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace ChurakovMike\EasyGrid\Columns\Actions;
4
5
use App\Models\ImageCheck;
0 ignored issues
show
Bug introduced by
The type App\Models\ImageCheck was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use App\User;
0 ignored issues
show
Bug introduced by
The type App\User was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
use ChurakovMike\EasyGrid\Traits\Configurable;
8
use Closure;
9
10
/**
11
 * Class BaseButton.
12
 * @package ChurakovMike\EasyGrid\Columns\Actions
13
 *
14
 * @property string $url
15
 */
16
abstract class BaseButton
17
{
18
    use Configurable;
19
20
    /**
21
     * @var string $url
22
     */
23
    public $url;
24
25
    /**
26
     * BaseButton constructor.
27
     * @param array $config
28
     */
29
    public function __construct(array $config = [])
30
    {
31
        $this->loadConfig($config);
32
    }
33
34
    /**
35
     * @param $row
36
     * Render action button.
37
     */
38
    public function render($row)
39
    {
40
    }
41
42
    /**
43
     * @param $row
44
     * @return Closure|string
45
     */
46
    public function getUrl($row)
47
    {
48
        if ($this->url instanceof Closure) {
0 ignored issues
show
introduced by
$this->url is never a sub-type of Closure.
Loading history...
49
            return call_user_func($this->url, $row);
50
        }
51
52
        return $this->buildUrl($row);
53
    }
54
55
    /**
56
     * Build url for some actions.
57
     * @param $row
58
     */
59
    abstract public function buildUrl($row);
60
61
    /**
62
     * @return string
63
     */
64
    public function getCurrentUrl()
65
    {
66
        return url()->current();
67
    }
68
}
69