Completed
Pull Request — master (#27)
by Will
09:02
created

TestCookieStore   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A canWrite() 0 8 2
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
12
    /**
13
     * Override value of 'headers_sent' but only if running tests.
14
     *
15
     * Set to true or false, or null to not override
16
     *
17
     * @var string
18
     */
19
    public static $override_headers_sent = null;
20
21
    protected function canWrite()
22
    {
23
        if (self::$override_headers_sent !== null) {
24
            return !self::$override_headers_sent;
25
        }
26
27
        parent::canWrite();
28
    }
29
}
30