Checker::checkOutputAlreadyWrote()   A
last analyzed

Complexity

Conditions 3
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
eloc 2
c 1
b 0
f 0
nc 2
nop 0
dl 0
loc 4
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Furious\HttpRunner;
6
7
use Furious\HttpRunner\Exception\HeadersAlreadySentException;
8
use Furious\HttpRunner\Exception\OutputAlreadyWroteException;
9
10
final class Checker
11
{
12
    public function checkHeadersAlreadySent(): void
13
    {
14
        if (headers_sent()) {
15
            throw new HeadersAlreadySentException();
16
        }
17
    }
18
19
    public function checkOutputAlreadyWrote(): void
20
    {
21
        if (ob_get_level() > 0 and ob_get_length() > 0) {
22
            throw new OutputAlreadyWroteException();
23
        }
24
    }
25
}