1 | <?php |
||
31 | 1 | final class LinkChecker implements IChecker |
|
32 | { |
||
33 | /** |
||
34 | * Implement nette smart magic |
||
35 | */ |
||
36 | 1 | use Nette\SmartObject; |
|
37 | |||
38 | /** |
||
39 | * @var Application\IPresenterFactory |
||
40 | */ |
||
41 | private $presenterFactory; |
||
42 | |||
43 | /** |
||
44 | * @var Application\Application |
||
45 | */ |
||
46 | private $application; |
||
47 | |||
48 | /** |
||
49 | * @var ICheckRequirements |
||
50 | */ |
||
51 | private $requirementsChecker; |
||
52 | |||
53 | /** |
||
54 | * @param Application\IPresenterFactory $presenterFactory |
||
55 | * @param Application\Application $application |
||
56 | * @param ICheckRequirements $requirementsChecker |
||
57 | */ |
||
58 | function __construct( |
||
69 | |||
70 | /** |
||
71 | * Check whenever current user is allowed to use given link |
||
72 | * |
||
73 | * @param string $element etc "this", ":Admin:Show:default" |
||
74 | * |
||
75 | * @return bool |
||
76 | * |
||
77 | * @throws Application\InvalidPresenterException |
||
78 | * @throws \ReflectionException |
||
79 | */ |
||
80 | public function isAllowed($element) : bool |
||
98 | |||
99 | /** |
||
100 | * Format link to format array('module:submodule:presenter', 'action') |
||
101 | * |
||
102 | * @param string $destination |
||
103 | * |
||
104 | * @return array(presenter, action) |
||
105 | */ |
||
106 | public function formatLink(string $destination) : array |
||
141 | } |
||
142 |
Adding explicit visibility (
private
,protected
, orpublic
) is generally recommend to communicate to other developers how, and from where this method is intended to be used.