Passed
Pull Request — master (#23)
by Aleksey
09:29 queued 06:06
created

ArvatoRssRepository::getMapper()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
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\Zed\ArvatoRss\Persistence;
9
10
use Generated\Shared\Transfer\ArvatoRssApiCallLogTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...toRssApiCallLogTransfer 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 Orm\Zed\ArvatoRss\Persistence\SpyArvatoRssApiCallLogQuery;
0 ignored issues
show
Bug introduced by
The type Orm\Zed\ArvatoRss\Persis...rvatoRssApiCallLogQuery 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...
12
use Spryker\Zed\Kernel\Persistence\AbstractRepository;
13
use SprykerEco\Zed\ArvatoRss\Persistence\Mapper\ArvatoRssPersistenceMapper;
14
15
/**
16
 * @method \SprykerEco\Zed\ArvatoRss\Persistence\ArvatoRssPersistenceFactory getFactory()
17
 */
18
class ArvatoRssRepository extends AbstractRepository implements ArvatoRssRepositoryInterface
19
{
20
    /**
21
     * @param string $orderReference
22
     * @param string $type
23
     *
24
     * @return \Generated\Shared\Transfer\ArvatoRssApiCallLogTransfer|null
25
     */
26
    public function findApiLogByOrderReferenceAndType(string $orderReference, string $type): ?ArvatoRssApiCallLogTransfer
27
    {
28
        $arvatoRssApiCallLog = $this->getArvatoRssApiCallLogQuery()
29
            ->filterByCallType($type)
30
            ->filterByOrderReference($orderReference)
31
            ->findOne();
32
33
        if ($arvatoRssApiCallLog === null) {
34
            return null;
35
        }
36
37
        return $this->getMapper()
38
            ->mapEntityToArvatoRssApiCallLogTransfer($arvatoRssApiCallLog, new ArvatoRssApiCallLogTransfer());
39
    }
40
41
    /**
42
     * @param string $communicationToken
43
     * @param string $type
44
     *
45
     * @return \Generated\Shared\Transfer\ArvatoRssApiCallLogTransfer|null
46
     */
47
    public function findApiLogByCommunicationTokenAndType(string $communicationToken, string $type): ?ArvatoRssApiCallLogTransfer
48
    {
49
        $arvatoRssApiCallLog = $this->getArvatoRssApiCallLogQuery()
50
            ->filterByCallType($type)
51
            ->filterByCommunicationToken($communicationToken)
52
            ->findOne();
53
54
        if ($arvatoRssApiCallLog === null) {
55
            return null;
56
        }
57
58
        return $this->getMapper()
59
            ->mapEntityToArvatoRssApiCallLogTransfer($arvatoRssApiCallLog, new ArvatoRssApiCallLogTransfer());
60
    }
61
62
    /**
63
     * @return \Orm\Zed\ArvatoRss\Persistence\SpyArvatoRssApiCallLogQuery
64
     */
65
    protected function getArvatoRssApiCallLogQuery(): SpyArvatoRssApiCallLogQuery
66
    {
67
        return $this->getFactory()->createArvatoRssApiCallLogQuery();
68
    }
69
70
    /**
71
     * @return \SprykerEco\Zed\ArvatoRss\Persistence\Mapper\ArvatoRssPersistenceMapper
72
     */
73
    protected function getMapper(): ArvatoRssPersistenceMapper
74
    {
75
        return $this->getFactory()->createArvatoRssPersistenceMapper();
76
    }
77
}
78