Cartalyst\Sentinel\Cookies\IlluminateCookie::get PHP Метод

get() публичный Метод

{@inheritDoc}
public get ( )
    public function get()
    {
        $key = $this->key;
        // Cannot use $this->jar->queued($key, function()) because it's not
        // available in 4.0.*, only 4.1+
        $queued = $this->jar->getQueuedCookies();
        if (isset($queued[$key])) {
            return $queued[$key];
        }
        return $this->request->cookie($key);
    }

Usage Example

Пример #1
0
 public function testGetWithPreviousCookies()
 {
     $cookie = new IlluminateCookie($request = m::mock('Illuminate\\Http\\Request'), $jar = m::mock('Illuminate\\Cookie\\CookieJar'), 'foo');
     $jar->shouldReceive('getQueuedCookies')->once()->andReturn([]);
     $request->shouldReceive('cookie')->with('foo')->once()->andReturn('bar');
     $this->assertEquals('bar', $cookie->get());
 }