cookieJar()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 4
c 0
b 0
f 0
dl 0
loc 7
rs 10
cc 2
nc 2
nop 0
1
<?php
2
3
namespace Bytic\Cookie;
4
5
6
/**
7
 * @param $name
8
 * @param $value
9
 * @param $time
10
 * @param $path
11
 * @param $domain
12
 * @param $secure
13
 * @param $httpOnly
14
 * @param $raw
15
 * @param $sameSite
16
 * @return CookieJar|Cookie|\Symfony\Component\HttpFoundation\Cookie|null
17
 */
18
function cookie($name = null, $value = null, $time = null, $path = null, $domain = null, $secure = null, $httpOnly = true, $raw = false, $sameSite = null)
19
{
20
    $cookieJar = cookieJar();
21
    if (is_null($name)) {
22
        return $cookieJar;
23
    }
24
    return $cookieJar->make($name, $value, $time, $path, $domain, $secure, $httpOnly, $raw, $sameSite);
25
}
26
27
function cookieJar()
28
{
29
    static $cookieJar = null;
30
    if ($cookieJar === null) {
31
        $cookieJar = new CookieJar();
32
    }
33
    return $cookieJar;
34
}