DashboardPresenter::setProgramOverviewControl()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace App\Presenters;
4
5
use App\Models\MeetingModel;
6
use App\Components\ProgramOverviewControl;
7
use Nette\Http\Request;
8
9
/**
10
 * This file handles the retrieval and serving of news articles
11
 */
12
class DashboardPresenter extends BasePresenter
13
{
14
15
	/**
16
	 * @var ProgramOverviewControl
17
	 */
18
	private $programOverview;
19
20
	/**
21
	 * @param MeetingModel           $model
22
	 * @param ProgramOverviewControl $control
23
	 */
24
	public function __construct(
25
		MeetingModel $model,
26
		ProgramOverviewControl $control
27
	) {
28
		$this->setModel($model);
0 ignored issues
show
Documentation introduced by
$model is of type object<App\Models\MeetingModel>, but the function expects a object<App\Model>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
29
		$this->setProgramOverviewControl($control);
30
	}
31
32
	/**
33
	 * @return void
34
	 */
35
	public function startup()
36
	{
37
		parent::startup();
38
39
		$this->getModel()->setMeetingId($this->getMeetingId());
40
	}
41
42
	/**
43
	 * Render entire page
44
	 * @return void
45
	 */
46
	public function renderDefault()
47
	{
48
		$template = $this->getTemplate();
49
		$template->data = $this->getModel()->find($this->getMeetingId());
0 ignored issues
show
Bug introduced by
Accessing data on the interface Nette\Application\UI\ITemplate suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
50
51
		$template->error_start = "";
0 ignored issues
show
Bug introduced by
Accessing error_start on the interface Nette\Application\UI\ITemplate suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
52
		$template->error_end = "";
0 ignored issues
show
Bug introduced by
Accessing error_end on the interface Nette\Application\UI\ITemplate suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
53
		$template->error_open_reg = "";
0 ignored issues
show
Bug introduced by
Accessing error_open_reg on the interface Nette\Application\UI\ITemplate suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
54
		$template->error_close_reg = "";
0 ignored issues
show
Bug introduced by
Accessing error_close_reg on the interface Nette\Application\UI\ITemplate suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
55
		$template->error_login = "";
0 ignored issues
show
Bug introduced by
Accessing error_login on the interface Nette\Application\UI\ITemplate suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
56
	}
57
58
	/**
59
	 * @return ProgramOverviewControl
60
	 */
61
	protected function createComponentProgramOverview()
62
	{
63
		return $this->programOverview->setMeetingId($this->getMeetingId());
64
	}
65
66
	/**
67
	 * @param  ProgramOverviewControl $control
68
	 * @return $this
69
	 */
70
	protected function setProgramOverviewControl(ProgramOverviewControl $control)
71
	{
72
		$this->programOverview = $control;
73
74
		return $this;
75
	}
76
77
}
78