Passed
Pull Request — feature/eco-3047/dev (#35)
by Aleksey
09:26 queued 04:02
created

HeidelpayNotificationProcessorMapper   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 8
c 1
b 0
f 0
dl 0
loc 21
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A mapRequestToNotificationTransfer() 0 10 1
1
<?php
2
3
/**
4
 * MIT License
5
 * For full license information, please view the LICENSE file that was distributed with this source code.
6
 */
7
8
namespace SprykerEco\Yves\Heidelpay\Processor\Notification\Mapper;
9
10
use Generated\Shared\Transfer\HeidelpayNotificationTransfer;
1 ignored issue
show
Bug introduced by
The type Generated\Shared\Transfe...payNotificationTransfer was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
11
use Symfony\Component\HttpFoundation\Request;
12
13
class HeidelpayNotificationProcessorMapper implements HeidelpayNotificationProcessorMapperInterface
14
{
15
    protected const HEADER_X_PUSH_TIMESTAMP = 'X-Push-Timestamp';
16
    protected const HEADER_X_PUSH_RETRIES = 'X-Push-Retries';
17
18
    /**
19
     * @param \Symfony\Component\HttpFoundation\Request $request
20
     * @param \Generated\Shared\Transfer\HeidelpayNotificationTransfer $notificationTransfer
21
     *
22
     * @return \Generated\Shared\Transfer\HeidelpayNotificationTransfer
23
     */
24
    public function mapRequestToNotificationTransfer(
25
        Request $request,
26
        HeidelpayNotificationTransfer $notificationTransfer
27
    ): HeidelpayNotificationTransfer {
28
        $notificationTransfer
29
            ->setNotificationBody($request->getContent())
30
            ->setTimestamp($request->headers->get(static::HEADER_X_PUSH_TIMESTAMP))
31
            ->setRetries((int)$request->headers->get(static::HEADER_X_PUSH_RETRIES));
32
33
        return $notificationTransfer;
34
    }
35
}
36