Test Setup Failed
Push — master ( 6b6842...4dae76 )
by Georgi
04:14
created

Launchpad::getJsModal()   A

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 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Epesi\Core\Layout\View;
4
5
use Illuminate\Support\Facades\URL;
6
use atk4\ui\VirtualPage;
7
use Closure;
8
use Epesi\Core\System\View\LaunchButton;
9
use atk4\ui\JsModal;
10
use atk4\ui\View;
11
12
class Launchpad extends View
13
{
14
	protected $title = 'Launchpad';
15
	
16
	protected $virtualPage;
17
		
18
	protected function init(): void
19
	{
20
		$this->virtualPage = VirtualPage::addTo($this->getOwner())->set(Closure::fromCallable([$this, 'getContents']));
0 ignored issues
show
Bug introduced by
Closure::fromCallable(ar...($this, 'getContents')) of type Closure is incompatible with the type array expected by parameter $fx of atk4\ui\VirtualPage::set(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

20
		$this->virtualPage = VirtualPage::addTo($this->getOwner())->set(/** @scrutinizer ignore-type */ Closure::fromCallable([$this, 'getContents']));
Loading history...
21
		
22
		parent::init();
23
	}
24
	
25
	public function getJsModal()
26
	{
27
		return new JsModal($this->title, $this->virtualPage);
28
	}
29
	
30
    protected function getContents(VirtualPage $vp)
31
    {
32
    	$vp->add([
0 ignored issues
show
Bug introduced by
array(new Epesi\Core\Sys...1', 'icon' => 'user'))) of type array<integer,Epesi\Core...stem\View\LaunchButton> is incompatible with the type atk4\ui\View expected by parameter $object of atk4\ui\View::add(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

32
    	$vp->add(/** @scrutinizer ignore-type */ [
Loading history...
33
    			new LaunchButton([
34
    					'label' => 'Test Button 1',
35
    					'icon' => 'user'
36
    			])
37
    	])->link(URL::to('/'));
0 ignored issues
show
Bug introduced by
The method link() does not exist on atk4\ui\AbstractView. It seems like you code against a sub-type of atk4\ui\AbstractView such as atk4\ui\View. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

37
    	])->/** @scrutinizer ignore-call */ link(URL::to('/'));
Loading history...
38
    	
39
    	$vp->add([
40
    			new LaunchButton([
41
    					'label' => 'Test Button 2',
42
    					'icon' => 'car'
43
    			])
44
    	]);
45
    	
46
    	$vp->add([
47
    			new LaunchButton([
48
    					'label' => 'Test Button 3',
49
    					'icon' => 'bus'
50
    			])
51
    	]);
52
    }
53
}
54