Passed
Push — master ( 5ca280...347b45 )
by Georgi
02:45
created

LaunchPad::getContents()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 18
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 13
nc 1
nop 1
dl 0
loc 18
rs 9.8333
c 1
b 0
f 0
1
<?php
2
3
namespace Epesi\Base\Layout\Seeds;
4
5
use Illuminate\Support\Facades\URL;
6
use atk4\ui\jsExpression;
7
use atk4\ui\VirtualPage;
8
use Closure;
9
use Epesi\Core\System\Seeds\LaunchButton;
0 ignored issues
show
Bug introduced by
The type Epesi\Core\System\Seeds\LaunchButton 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...
10
11
class LaunchPad extends jsExpression
12
{
13
	protected $parent;
14
	
15
	public function __construct($parent)
16
	{
17
    	$this->parent = $parent;
18
    	
19
		parent::__construct('$(this).atkCreateModal([arg])', [
20
				'arg' => [
21
						'uri' => $this->getURL(),
22
						'title' => __('Launchpad'),
23
						'mode' => 'json'
24
				]
25
		]);
26
	}
27
    
28
	protected function getURL()
29
    {
30
    	return $this->parent->add('VirtualPage')->set(Closure::fromCallable([$this, 'getContents']))->getJSURL('cut');
31
    }
32
    
33
    protected function getContents(VirtualPage $vp)
34
    {
35
    	$vp->add([
36
    			new LaunchButton([
37
    					'label' => 'Test Button 1',
38
    					'icon' => 'user'
39
    			])
40
    	])->link(URL::to('/'));
41
    	$vp->add([
42
    			new LaunchButton([
43
    					'label' => 'Test Button 2',
44
    					'icon' => 'car'
45
    			])
46
    	]);
47
    	$vp->add([
48
    			new LaunchButton([
49
    					'label' => 'Test Button 3',
50
    					'icon' => 'bus'
51
    			])
52
    	]);
53
    }
54
}
55