Completed
Push — master ( ec29fe...2e5711 )
by Torben
09:02 queued 07:11
created

HmacViewHelper   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
c 0
b 0
f 0
lcom 1
cbo 0
dl 0
loc 26
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A render() 0 8 2
1
<?php
2
namespace DERHANSEN\SfEventMgt\ViewHelpers\Registration;
3
4
/*
5
 * This file is part of the TYPO3 CMS project.
6
 *
7
 * It is free software; you can redistribute it and/or modify it under
8
 * the terms of the GNU General Public License, either version 2
9
 * of the License, or any later version.
10
 *
11
 * For the full copyright and license information, please read the
12
 * LICENSE.txt file that was distributed with this source code.
13
 *
14
 * The TYPO3 project - inspiring people to share!
15
 */
16
17
use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper;
18
19
/**
20
 * Hmac ViewHelper for registrations
21
 *
22
 * @author Torben Hansen <[email protected]>
23
 */
24
class HmacViewHelper extends AbstractViewHelper
25
{
26
    /**
27
     * Hash Service
28
     *
29
     * @var \TYPO3\CMS\Extbase\Security\Cryptography\HashService
30
     * @inject
31
     */
32
    protected $hashService;
33
34
    /**
35
     * Returns the hmac for the given registration in order to cancel the registration
36
     *
37
     * @param \DERHANSEN\SfEventMgt\Domain\Model\Registration $registration Registration
38
     *
39
     * @return array
40
     */
41
    public function render($registration)
42
    {
43
        $result = '';
44
        if ($registration) {
45
            $result = $this->hashService->generateHmac('reg-' . $registration->getUid());
46
        }
47
        return $result;
48
    }
49
}
50