RarArchive::addEntry()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 6
ccs 4
cts 4
cp 1
rs 10
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Selective\Rar;
4
5
/**
6
 * A RAR archive.
7
 */
8
final class RarArchive
9
{
10
    /**
11
     * @var RarEntry[]
12
     */
13
    private $entries = [];
14
15
    /**
16
     * Get entries.
17
     *
18
     * @return RarEntry[] The entries
19
     */
20 3
    public function getEntries(): array
21
    {
22 3
        return $this->entries;
23
    }
24
25
    /**
26
     * Add entry.
27
     *
28
     * @param RarEntry $entry The rar entry
29
     *
30
     * @return self
31
     */
32 3
    public function addEntry(RarEntry $entry): self
33
    {
34 3
        $clone = clone $this;
35 3
        $clone->entries[] = $entry;
36
37 3
        return $clone;
38
    }
39
}
40