ContentDisposition   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 4
Bugs 0 Features 0
Metric Value
wmc 3
c 4
b 0
f 0
lcom 1
cbo 1
dl 0
loc 22
ccs 8
cts 8
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A extractData() 0 6 1
A getAttribute() 0 7 2
1
<?php
2
3
namespace Fracture\Http\Headers;
4
5
class ContentDisposition extends Common
6
{
7
8
    protected $headerName = 'Content-Disposition';
9
10
11 2
    protected function extractData($header)
12
    {
13 2
        $matches = null;
14 2
        preg_match('/^(.+); *name="(?P<name>[^"]+)"(; *filename="(?P<filename>[^"]+)")?/', $header, $matches);
15 2
        return $matches + ['name' => null, 'filename' => null];
16
    }
17
18
19 2
    public function getAttribute($name)
20
    {
21 2
        if (array_key_exists($name, $this->data)) {
22 2
            return $this->data[$name];
23
        }
24 1
        return null;
25
    }
26
}
27