Completed
Push — master ( b21eaf...9104ac )
by Karthik
03:02
created

WorldDrop   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 7
c 2
b 0
f 0
dl 0
loc 22
ccs 8
cts 8
cp 1
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getArray() 0 4 1
A validateFormat() 0 6 2
1
<?php
2
3
namespace cyberinferno\Cabal\Helpers\FileSystem\Server;
4
5
use cyberinferno\Cabal\Helpers\Exceptions\FileBadFormatException;
6
use cyberinferno\Cabal\Helpers\FileSystem\File;
7
8
/**
9
 * Class WorldDrop
10
 *
11
 * Helper class to load contents from World_drop.scp file
12
 *
13
 * @package cyberinferno\Cabal\Helpers\FileSystem\Server
14
 */
15
class WorldDrop extends File
16
{
17
    /**
18
     * Returns array representation of the World_dop.scp file
19
     *
20
     * @return array
21
     */
22 3
    public function getArray()
23
    {
24 3
        $fileContents = $this->getFileContents();
25 3
        return explode("\n", $fileContents);
26
    }
27
28
    /**
29
     * @inheritdoc
30
     */
31 9
    protected function validateFormat()
32
    {
33 9
        parent::validateFormat();
34 9
        $fileContents = $this->getFileContents();
35 9
        if (substr($fileContents, 0, strlen('[WorldDrop]')) !== '[WorldDrop]') {
36 3
            throw new FileBadFormatException();
37
        }
38
    }
39
}