Completed
Push — master ( 1ce70a...0adf65 )
by Litera
11:25 queued 21s
created

getRegistrationFormFactory()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
rs 10
1
<?php
2
3
namespace App\Presenters;
4
5
use DateTime;
6
use App\Entities\VisitorEntity;
7
use App\Models\MeetingModel;
8
use App\Models\VisitorModel;
9
use App\Models\ProgramModel;
10
use App\Models\MealModel;
11
use App\Services\SkautIS\UserService;
12
use App\Services\Emailer;
13
use App\Services\VisitorService;
14
use App\Services\ProgramService;
15
use Tracy\Debugger;
16
use App\Components\Forms\RegistrationForm;
17
use App\Components\Forms\Factories\IRegistrationFormFactory;
18
use App\Services\SkautIS\EventService;
19
use Skautis\Wsdl\WsdlException;
20
use App\Models\SettingsModel;
21
22
/**
23
 * Registration controller
24
 *
25
 * This file handles the registration of visitors
26
 *
27
 * @author Tomas Litera
28
 * @copyright 2013-06-12 <[email protected]>
29
 * @package srazvs
30
 */
31
class RegistrationPresenter extends VisitorPresenter
32
{
33
34
	/**
35
	 * @var VisitorModel
36
	 */
37
	private $visitorModel;
38
39
	/**
40
	 * @var ProgramModel
41
	 */
42
	private $programModel;
43
44
	/**
45
	 * @var UserService
46
	 */
47
	private $userService;
48
49
	/**
50
	 * @var ProgramService
51
	 */
52
	private $programService;
53
54
	/**
55
	 * @var SettingsModel
56
	 */
57
	protected $settingsModel;
58
59
	/**
60
	 * @var boolean
61
	 */
62
	private $disabled = false;
63
64
	/**
65
	 * @var IRegistrationFormFactory
66
	 */
67
	private $registrationFormFactory;
68
69
	/**
70
	 * @var EventService
71
	 */
72
	protected $skautisEventService;
73
74
	/**
75
	 * @param MeetingModel   $meetingModel
76
	 * @param UserService    $userService
77
	 * @param VisitorModel   $visitorModel
78
	 * @param MealModel      $mealModel
79
	 * @param ProgramModel   $programModel
80
	 * @param VisitorService $visitorService
81
	 * @param SettingsModel  $settingsModel
82
	 */
83
	public function __construct(
84
		MeetingModel $meetingModel,
85
		UserService $userService,
86
		VisitorModel $visitorModel,
87
		MealModel $mealModel,
88
		ProgramModel $programModel,
89
		Emailer $emailer,
90
		VisitorService $visitorService,
91
		ProgramService $programService,
92
		EventService $skautisEvent,
93
		SettingsModel $settingsModel
94
	) {
95
		$this->setMeetingModel($meetingModel);
96
		$this->setUserService($userService);
97
		$this->setVisitorModel($visitorModel);
98
		$this->setMealModel($mealModel);
99
		$this->setProgramModel($programModel);
100
		$this->setEmailer($emailer);
101
		$this->setVisitorService($visitorService);
102
		$this->setProgramService($programService);
103
		$this->setEventService($skautisEvent);
104
		$this->setSettingsModel($settingsModel);
105
	}
106
107
	/**
108
	 * @return IRegistrationFormFactory
109
	 */
110
	public function getRegistrationFormFactory(): IRegistrationFormFactory
111
	{
112
		return $this->registrationFormFactory;
113
	}
114
115
	/**
116
	 * Injector
117
	 *
118
	 * @param  IRegistrationFormFactory $factory
119
	 */
120
121
	protected $error = FALSE;
122
123
	protected $hash = NULL;
124
	private $item;
125
	private $mealData;
126
	private $user;
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
127
	private $event;
128
129
	public function injectRegistrationFormFactory(IRegistrationFormFactory $factory)
130
	{
131
		$this->registrationFormFactory = $factory;
132
	}
133
134
	/**
135
	 * @return void
136
	 */
137
	public function startup()
138
	{
139
		parent::startup();
140
141
		$this->getMeetingModel()->setMeetingId($this->getMeetingId());
142
143
		if($this->getDebugMode() || $this->getSettingsModel()->findDebugRegime()) {
144
			$this->getMeetingModel()->setRegistrationHandlers(1);
145
			$this->setMeetingId(1);
146
		} else {
147
			$this->getMeetingModel()->setRegistrationHandlers($this->getMeetingId());
148
		}
149
150
		//$this->user = $this->container->getService('userService');
151
		//$this->event = $this->container->getService('eventService');
152
153
		$template = $this->getTemplate();
154
155
		$template->page_title = "Registrace srazu VS";
0 ignored issues
show
Bug introduced by
Accessing page_title 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...
156
		$template->meeting_heading = $this->getMeetingModel()->getRegHeading();
0 ignored issues
show
Bug introduced by
Accessing meeting_heading 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...
157
		$template->isRegistrationOpen = $this->getMeetingModel()->isRegOpen($this->getDebugMode());
0 ignored issues
show
Bug introduced by
Accessing isRegistrationOpen 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...
158
	}
159
160
	/**
161
	 * Process data from form
162
	 *
163
	 * @return void
164
	 */
165 View Code Duplication
	public function actionCreate()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
166
	{
167
		try {
168
			$postData = $this->getHttpRequest()->getPost();
169
			$postData['meeting'] = $this->getMeetingId();
170
171
			$guid = $this->getVisitorService()->create($postData);
172
			$result = $this->sendRegistrationSummary($postData, $guid);
173
174
			Debugger::log('Creation of registration('. $guid .') successfull, result: ' . json_encode($result), Debugger::INFO);
175
			$this->flashMessage('Registrace(' . $guid . ') byla úspěšně založena.', self::FLASH_TYPE_OK);
176
		} catch(Exception $e) {
0 ignored issues
show
Bug introduced by
The class App\Presenters\Exception does not exist. Did you forget a USE statement, or did you not list all dependencies?

Scrutinizer analyzes your composer.json/composer.lock file if available to determine the classes, and functions that are defined by your dependencies.

It seems like the listed class was neither found in your dependencies, nor was it found in the analyzed files in your repository. If you are using some other form of dependency management, you might want to disable this analysis.

Loading history...
177
			Debugger::log('Creation of registration('. $guid .') failed, result: ' .  $e->getMessage(), Debugger::ERROR);
0 ignored issues
show
Bug introduced by
The variable $guid does not seem to be defined for all execution paths leading up to this point.

If you define a variable conditionally, it can happen that it is not defined for all execution paths.

Let’s take a look at an example:

function myFunction($a) {
    switch ($a) {
        case 'foo':
            $x = 1;
            break;

        case 'bar':
            $x = 2;
            break;
    }

    // $x is potentially undefined here.
    echo $x;
}

In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined.

Available Fixes

  1. Check for existence of the variable explicitly:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        if (isset($x)) { // Make sure it's always set.
            echo $x;
        }
    }
    
  2. Define a default value for the variable:

    function myFunction($a) {
        $x = ''; // Set a default which gets overridden for certain paths.
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        echo $x;
    }
    
  3. Add a value for the missing path:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
    
            // We add support for the missing case.
            default:
                $x = '';
                break;
        }
    
        echo $x;
    }
    
Loading history...
178
			$this->flashMessage('Creation of registration failed, result: ' . $e->getMessage(), self::FLASH_TYPE_ERROR);
179
		}
180
181
		$this->redirect('Registration:check', $guid);
182
	}
183
184
	/**
185
	 * @param  string  $guid
186
	 * @return void
187
	 */
188 View Code Duplication
	public function actionUpdate($guid)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
189
	{
190
		try {
191
			$postData = $this->getHttpRequest()->getPost();
192
193
			$result = $this->getVisitorService()->update($guid, $postData);
194
			$result = $this->sendRegistrationSummary($postData, $guid);
195
196
			Debugger::log('Modification of registration('. $guid .') successfull, result: ' . json_encode($result), Debugger::INFO);
197
			$this->flashMessage('Registrace(' . $guid . ') byla úspěšně upravena.', self::FLASH_TYPE_OK);
198
		} catch(Exception $e) {
0 ignored issues
show
Bug introduced by
The class App\Presenters\Exception does not exist. Did you forget a USE statement, or did you not list all dependencies?

Scrutinizer analyzes your composer.json/composer.lock file if available to determine the classes, and functions that are defined by your dependencies.

It seems like the listed class was neither found in your dependencies, nor was it found in the analyzed files in your repository. If you are using some other form of dependency management, you might want to disable this analysis.

Loading history...
199
			Debugger::log('Modification of registration('. $guid .') failed, result: ' .  $e->getMessage(), Debugger::ERROR);
200
			$this->flashMessage('Modification of registration(' . $guid . ') failed, result: ' . $e->getMessage(), self::FLASH_TYPE_ERROR);
201
		}
202
203
		$this->redirect('Registration:check', $guid);
204
	}
205
206
	/**
207
	 * @return void
208
	 */
209
	public function renderDefault()
210
	{
211
		$template = $this->getTemplate();
212
213
		////otevirani a uzavirani prihlasovani
214
		$disabled = $this->getMeetingModel()->isRegOpen($this->getDebugMode()) ? "" : "disabled";
215
		$template->disabled = $disabled;
0 ignored issues
show
Bug introduced by
Accessing disabled 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...
216
		$template->loggedIn = $this->getUserService()->isLoggedIn();
0 ignored issues
show
Bug introduced by
Accessing loggedIn 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...
217
218
		if($this->getUserService()->isLoggedIn()) {
219
			$this['registrationForm']->setDefaults(($this->useLoggedVisitor())->toArray());
220
		}
221
	}
222
223
	/**
224
	 * @param  string  $guid
225
	 * @return void
226
	 */
227
	public function renderCheck($guid)
228
	{
229
		$visitor = $this->getVisitorModel()->findByGuid($guid);
230
231
		$this->getMeetingModel()->setRegistrationHandlers($visitor->meeting);
232
233
		$template = $this->getTemplate();
234
		$template->guid = $guid;
0 ignored issues
show
Bug introduced by
Accessing guid 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...
235
		$template->visitor = $visitor;
0 ignored issues
show
Bug introduced by
Accessing visitor 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...
236
		$template->meetingId = $visitor->meeting;
0 ignored issues
show
Bug introduced by
Accessing meetingId 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...
237
		$template->meals = $this->getMealModel()->findByVisitorId($visitor->id);
0 ignored issues
show
Bug introduced by
Accessing meals 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...
238
		$template->province = $this->getMeetingModel()->getProvinceNameById($visitor->province);
0 ignored issues
show
Bug introduced by
Accessing province 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...
239
		$template->programs = $this->getProgramModel()->findByVisitorId($visitor->id);
0 ignored issues
show
Bug introduced by
Accessing programs 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...
240
	}
241
242
	/**
243
	 * @param  string $guid
244
	 * @return void
245
	 */
246
	public function renderEdit($guid)
247
	{
248
		$visitor = $this->getVisitorService()->findByGuid($guid);
249
		$meetingId = $visitor['meeting'];
250
251
		$this->getMeetingModel()->setRegistrationHandlers($meetingId);
252
253
		$template = $this->getTemplate();
254
		$template->guid = $guid;
0 ignored issues
show
Bug introduced by
Accessing guid 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...
255
		$template->meetingId = $meetingId;
0 ignored issues
show
Bug introduced by
Accessing meetingId 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...
256
		$template->loggedIn = $this->getUserService()->isLoggedIn();
0 ignored issues
show
Bug introduced by
Accessing loggedIn 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...
257
		$template->disabled = $this->getMeetingModel()->isRegOpen($this->getDebugMode()) ? "" : "disabled";
0 ignored issues
show
Bug introduced by
Accessing disabled 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...
258
259
		$this['registrationForm']->setDefaults($visitor);
260
	}
261
262
	/**
263
	 * @return RegistrationFormControl
264
	 */
265
	protected function createComponentRegistrationForm(): RegistrationForm
266
	{
267
		$control = $this->registrationFormFactory->create();
268
		$control->setMeetingId($this->getMeetingId());
269
		$control->onRegistrationSave[] = function(RegistrationForm $control, $newVisitor) {
270
			try {
271
				$guid = $this->getVisitorService()->create((array) $newVisitor);
272
/*
273
				if($this->getUserService()->isLoggedIn() && $this->getMeetingModel()->findCourseId()) {
274
					$this->getEventService()->insertEnroll(
275
						$this->getUserService()->getSkautis()->getUser()->getLoginId(),
276
						$this->getMeetingModel()->findCourseId(),
277
						// TODO: get real phone number
278
						'123456789'
279
					);
280
				}
281
*/
282
				$result = $this->sendRegistrationSummary((array) $newVisitor, $guid);
283
284
				Debugger::log('Storage of visitor('. $guid .') successfull, result: ' . json_encode($result), Debugger::INFO);
285
				$this->flashMessage('Účastník(' . $guid . ') byl úspěšně uložen.', self::FLASH_TYPE_OK);
286
			} catch(WsdlException $e) {
287
				Debugger::log('Storage of visitor('. $guid .') failed, result: ' . $e->getMessage(), Debugger::WARNING);
288
				$this->flashMessage('Uložení účastníka (' . $guid . ') selhalo. Účastník je již zaregistrován.', self::FLASH_TYPE_ERROR);
289
			} catch(Exception $e) {
0 ignored issues
show
Bug introduced by
The class App\Presenters\Exception does not exist. Did you forget a USE statement, or did you not list all dependencies?

Scrutinizer analyzes your composer.json/composer.lock file if available to determine the classes, and functions that are defined by your dependencies.

It seems like the listed class was neither found in your dependencies, nor was it found in the analyzed files in your repository. If you are using some other form of dependency management, you might want to disable this analysis.

Loading history...
290
				Debugger::log('Storage of visitor('. $guid .') failed, result: ' .  $e->getMessage(), Debugger::ERROR);
291
				$this->flashMessage('Uložení účastníka selhalo, chyba: ' . $e->getMessage(), self::FLASH_TYPE_ERROR);
292
			}
293
294
			$this->redirect('Registration:check', $guid);
295
		};
296
297
		return $control;
298
	}
299
300
	/**
301
	 * @return VisitorEntity
302
	 */
303
	protected function useLoggedVisitor(): VisitorEntity
304
	{
305
		$userDetail = $this->getUserService()->getUserDetail();
306
		$skautisUser = $this->getUserService()->getPersonalDetail($userDetail->ID_Person);
307
		$membership = $this->getUserService()->getPersonUnitDetail($userDetail->ID_Person);
308
309
		if(!preg_match('/^[1-9]{1}[0-9a-zA-Z]{2}\.[0-9a-zA-Z]{1}[0-9a-zA-Z]{1}$/', $membership->RegistrationNumber)) {
310
			$skautisUserUnit = $this->getUserService()->getParentUnitDetail($membership->ID_Unit)[0];
311
		} else {
312
			$skautisUserUnit = $this->getUserService()->getUnitDetail($membership->ID_Unit);
313
		}
314
315
		$visitor = new VisitorEntity;
316
		$visitor->name = $skautisUser->FirstName;
317
		$visitor->surname = $skautisUser->LastName;
318
		$visitor->nick = $skautisUser->NickName;
319
		$visitor->email = $skautisUser->Email;
320
		$visitor->street = $skautisUser->Street;
321
		$visitor->city = $skautisUser->City;
322
		$visitor->postal_code = preg_replace('/\s+/', '', $skautisUser->Postcode);
323
		$visitor->birthday = (new DateTime($skautisUser->Birthday))->format('d. m. Y');
324
		$visitor->group_name = $skautisUserUnit->DisplayName;
325
		$visitor->group_num = $skautisUserUnit->RegistrationNumber;
326
		if(isset($membership->Unit)) {
327
			$visitor->troop_name = $membership->Unit;
328
		}
329
330
		return $visitor;
331
	}
332
333
	/**
334
	 * @return MealModel
335
	 */
336
	protected function getMealModel()
337
	{
338
		return $this->mealModel;
339
	}
340
341
	/**
342
	 * @param  MealModel $model
343
	 * @return $this
344
	 */
345
	protected function setMealModel(MealModel $model)
346
	{
347
		$this->mealModel = $model;
348
349
		return $this;
350
	}
351
352
	/**
353
	 * @return MeetingModel
354
	 */
355
	protected function getMeetingModel()
356
	{
357
		return $this->meetingModel;
358
	}
359
360
	/**
361
	 * @param  MeetingModel $model
362
	 * @return $this
363
	 */
364
	protected function setMeetingModel(MeetingModel $model)
365
	{
366
		$this->meetingModel = $model;
367
368
		return $this;
369
	}
370
371
	/**
372
	 * @return VisitorModel
373
	 */
374
	protected function getVisitorModel()
375
	{
376
		return $this->visitorModel;
377
	}
378
379
	/**
380
	 * @param  VisitorModel $model
381
	 * @return $this
382
	 */
383
	protected function setVisitorModel(VisitorModel $model)
384
	{
385
		$this->visitorModel = $model;
386
387
		return $this;
388
	}
389
390
	/**
391
	 * @return ProgramModel
392
	 */
393
	protected function getProgramModel()
394
	{
395
		return $this->programModel;
396
	}
397
398
	/**
399
	 * @param  ProgramModel $model
400
	 * @return $this
401
	 */
402
	protected function setProgramModel(ProgramModel $model)
403
	{
404
		$this->programModel = $model;
405
406
		return $this;
407
	}
408
409
	/**
410
	 * @return UserService
411
	 */
412
	protected function getUserService()
413
	{
414
		return $this->userService;
415
	}
416
417
	/**
418
	 * @param  UserService $service
419
	 * @return $this
420
	 */
421
	protected function setUserService(UserService $service)
422
	{
423
		$this->userService = $service;
424
425
		return $this;
426
	}
427
428
	/**
429
	 * @return ProgramService
430
	 */
431
	protected function getProgramService()
432
	{
433
		return $this->programService;
434
	}
435
436
	/**
437
	 * @param  ProgramService $service
438
	 * @return $this
439
	 */
440
	protected function setProgramService(ProgramService $service)
441
	{
442
		$this->programService = $service;
443
444
		return $this;
445
	}
446
447
	/**
448
	 * @return EventService
449
	 */
450
	protected function getEventService(): EventService
451
	{
452
		return $this->skautisEventService;
453
	}
454
455
	/**
456
	 * @param EventService $skautisEvent
0 ignored issues
show
Bug introduced by
There is no parameter named $skautisEvent. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
457
	 *
458
	 * @return self
459
	 */
460
	protected function setEventService(EventService $service): self
461
	{
462
		$this->skautisEventService = $service;
463
464
		return $this;
465
	}
466
467
468
	/**
469
	 * @return SettingsModel
470
	 */
471
	public function getSettingsModel()
472
	{
473
		return $this->settingsModel;
474
	}
475
476
	/**
477
	 * @param SettingsModel $model
478
	 *
479
	 * @return self
480
	 */
481
	public function setSettingsModel(SettingsModel $model): self
482
	{
483
		$this->settingsModel = $model;
484
485
		return $this;
486
	}
487
488
}
489