FileResponse   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 14
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A sendBody() 0 2 1
A __construct() 0 7 1
1
<?php
2
3
namespace Lepton\Http\Response;
4
5
 class FileResponse extends SuccessResponse
6
{
7
8
    public function __construct(
9
        public $filePath,
10
        $contentType,
11
12
        )
13
    {
14
        parent::__construct(headers: ["Content-Type" => $contentType]);
15
    }
16
17
    public function sendBody(){
18
        readfile($this->filePath);
19
    }
20
21
22
}
23