-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathVisibilityService.visibility-example.php
49 lines (42 loc) · 1.18 KB
/
VisibilityService.visibility-example.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
/**
* Created by PhpStorm.
* User: Ppito
* Date: 13/01/2020
* Time: 8:45 PM
*
* @link https://github.com/Ppito/laminas-whoops for the canonical source repository
* @copyright Copyright (c) 2020 Mickael TONNELIER.
* @license https://github.com/Ppito/laminas-whoops/blob/master/LICENSE.md The MIT License
*/
namespace Application\Service;
use WhoopsErrorHandler\Service\VisibilityServiceAbstract;
use WhoopsErrorHandler\Service\VisibilityServiceInterface;
class VisibilityService extends VisibilityServiceAbstract implements VisibilityServiceInterface {
/**
* @var @Model\User
*/
protected $connectedUser = null;
/**
* Configure Service Handler
* - Get Connected User
*
* @return void
*/
public function configure(): void {
$container = $this->getContainer();
$this->connectedUser = $container->has('User') ?
$container->get('User') :
null;
}
/**
* Verify the role of the user
*
* @return bool
*/
public function canAttachEvent(): bool {
return $this->connectedUser ?
$this->connectedUser->hasRole('Admin') :
false;
}
}