Cartalyst\Sentinel\Persistences\IlluminatePersistenceRepository::check PHP Method

check() public method

{@inheritDoc}
public check ( )
    public function check()
    {
        if ($code = $this->session->get()) {
            return $code;
        }
        if ($code = $this->cookie->get()) {
            return $code;
        }
    }

Usage Example

 public function testCheckWithCookie()
 {
     $persistence = new IlluminatePersistenceRepository($session = m::mock('Cartalyst\\Sentinel\\Sessions\\SessionInterface'), $cookie = m::mock('Cartalyst\\Sentinel\\Cookies\\CookieInterface'));
     $session->shouldReceive('get')->once();
     $cookie->shouldReceive('get')->once()->andReturn('bar');
     $this->assertEquals('bar', $persistence->check());
 }