GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — master ( e4b67a...d8327a )
by Andreas
03:56
created

ImportMessageBuilder   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A buildNextMessage() 0 5 1
A build() 0 9 1
1
<?php
2
declare(strict_types=1);
3
/**
4
 */
5
6
namespace CommerceLeague\ActiveCampaign\MessageQueue\Contact;
7
8
/**
9
 * Class ImportMessageBuilder
10
 */
11
class ImportMessageBuilder
12
{
13
    /**
14
     * @var ImportMessageFactory
0 ignored issues
show
Bug introduced by
The type CommerceLeague\ActiveCam...ct\ImportMessageFactory 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...
15
     */
16
    private $importMessageFactory;
17
18
    /**
19
     * @param ImportMessageFactory $importMessageFactory
20
     */
21
    public function __construct(ImportMessageFactory $importMessageFactory)
22
    {
23
        $this->importMessageFactory = $importMessageFactory;
24
    }
25
26
    /**
27
     * @param int $limit
28
     * @param int $offset
29
     * @return ImportMessage
30
     */
31
    public function build(int $limit = 100, int $offset = 0): ImportMessage
32
    {
33
        /** @var ImportMessage $message */
34
        $message = $this->importMessageFactory->create();
35
36
        $message->setLimit($limit)
37
            ->setOffset($offset);
38
39
        return $message;
40
    }
41
42
    /**
43
     * @param ImportMessage $lastMessage
44
     * @return ImportMessage
45
     */
46
    public function buildNextMessage(ImportMessage $lastMessage): ImportMessage
47
    {
48
        return $this->build(
49
            $lastMessage->getLimit(),
50
            $lastMessage->getLimit() + $lastMessage->getOffset()
51
        );
52
    }
53
}
54