MessageFactory::create()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 7
nc 1
nop 3
dl 0
loc 12
ccs 8
cts 8
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the DataImporter package.
7
 *
8
 * (c) Loïc Sapone <[email protected]>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace IQ2i\DataImporter\Exchange;
15
16
use IQ2i\DataImporter\Reader\ReaderInterface;
17
18
final class MessageFactory
19
{
20 11
    public static function create(
21
        ReaderInterface $reader,
22
        mixed $data = null,
23
        ?string $archiveFilePath = null,
24
    ): Message {
25 11
        return new Message(
26 11
            $reader->getFile()->getFilename(),
27 11
            $reader->getFile()->getPathname(),
28 11
            $reader->index(),
29 11
            $reader->count(),
30 11
            $data,
31 11
            $archiveFilePath
32 11
        );
33
    }
34
}
35