src/Security/UserManager.php
public function getUser()
    {
        if (null === $this->user && $this->isLogin()) {
            $username = Base::instance()->get(static::SESSION_USER);
            $this->user = Security::instance()->getUserProvider()->loadByUsername($username);

            try {
                Authentication::instance()->checkUser($this->user);
            } catch(Exception $e) {
                $this->user = null;
            }
        }

        return $this->user;
    }
public function getUser()
    {
        if (null === $this->user && $this->isLogin()) {
            $username = Base::instance()->get(static::SESSION_USER);
            $this->user = Security::instance()->getUserProvider()->loadByUsername($username);

            try {
                Authentication::instance()->checkUser($this->user);
            } catch(Exception $e) {
                $this->user = null;
            }
        }

        return $this->user;
    }
public function getUser ( ) { if ( null === $ this -> user && $ this -> isLogin ( ) ) { $ username = Base :: instance ( ) -> get ( static :: SESSION_USER ) ; $ this -> user = Security :: instance ( ) -> getUserProvider ( ) -> loadByUsername ( $ username ) ; try { Authentication :: instance ( ) -> checkUser ( $ this -> user ) ; } catch ( Exception $ e ) { $ this -> user = null ; } } return $ this -> user ; }
Get user, load from session if needed
@return UserInterface
Get user load from session if needed