Authenticator   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 3
c 1
b 0
f 1
lcom 1
cbo 2
dl 0
loc 32
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A login() 0 11 2
1
<?php
2
3
4
namespace MyApp;
5
6
7
use MyApp\Event\AppEvents;
8
use MyApp\Event\UserLoginEvent;
9
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
10
11
12
class Authenticator
13
{
14
15
	/**
16
	 * @var EventDispatcherInterface
17
	 */
18
	private $eventDispatcherInterface;
19
20
21
	public function __construct(EventDispatcherInterface $eventDispatcherInterface)
22
	{
23
		$this->eventDispatcherInterface = $eventDispatcherInterface;
24
	}
25
26
27
	/**
28
	 * @param string $email
29
	 * @param string $password
30
	 */
31
	public function login($email, $password)
0 ignored issues
show
Unused Code introduced by
The parameter $password is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
32
	{
33
		// some verification code here
34
		$success = '...';
35
36
		if ($success) {
37
			$userLoginEvent = new UserLoginEvent($email);
38
			$this->eventDispatcherInterface->dispatch(AppEvents::ON_LOGIN, $userLoginEvent);
39
			// That's it! You've just successfully used an event.
40
		}
41
	}
42
43
}
44