TestCookieStore::canWrite()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 0
1
<?php
2
3
namespace SilverStripe\HybridSessions\Tests\Store;
4
5
use SilverStripe\HybridSessions\Store\CookieStore;
6
use SilverStripe\Dev\TestOnly;
7
8
class TestCookieStore extends CookieStore implements TestOnly
9
{
10
    /**
11
     * Override value of 'headers_sent' but only if running tests.
12
     *
13
     * Set to true or false, or null to not override
14
     *
15
     * @var string
16
     */
17
    public static $override_headers_sent = null;
18
19
    protected function canWrite()
20
    {
21
        if (self::$override_headers_sent !== null) {
22
            return !self::$override_headers_sent;
23
        }
24
25
        parent::canWrite();
26
    }
27
}
28