AbstractFetcher   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 29
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
fetchContentAsStringOrThrowRuntimeException() 0 1 ?
A fetch() 0 16 1
1
<?php
2
/**
3
 * @author stev leibelt <[email protected]>
4
 * @since 2017-04-12
5
 */
6
7
namespace Net\Bazzline\Component\ApacheServerStatusParser\Service\Content\Fetcher;
8
9
use RuntimeException;
10
11
abstract class AbstractFetcher implements FetcherInterface
12
{
13
    /**
14
     * @return array
15
     * @throws RuntimeException
16
     */
17
    public function fetch()
18
    {
19
        //begin of business logic
20
        $contentAsString    = strip_tags($this->fetchContentAsStringOrThrowRuntimeException());
21
        $contentAsArray     = explode(PHP_EOL, $contentAsString);
22
23
        $lines = array_filter(
24
            $contentAsArray,
25
            function($item) {
26
                return (strlen(trim($item)) > 0);
27
            }
28
        );
29
30
        return $lines;
31
        //end of business logic
32
    }
33
34
    /**
35
     * @return string
36
     * @throws RuntimeException
37
     */
38
    abstract protected function fetchContentAsStringOrThrowRuntimeException();
39
}
40