public function hasRole($role = ''){

        $session = $this->getSession();
        $cookie = $this->getCookie();


        if ($cookie->has(self::USER_SESSION)) {
            $login = $cookie->get(self::USER_SESSION);
        }elseif (false !== $session->has(self::USER_SESSION)) {
            $login = $session->get(self::USER_SESSION);
        }else{
            return false;
        }

        $roleLogin = $login['role'];

        if (is_string($role)) {
            return $roleLogin === $role;
        }elseif(is_array($role)){
            return array_search($roleLogin, $role);
        }

        return false;
    }
public function hasRole($role = ''){

        $session = $this->getSession();
        $cookie = $this->getCookie();


        if ($cookie->has(self::USER_SESSION)) {
            $login = $cookie->get(self::USER_SESSION);
        }elseif (false !== $session->has(self::USER_SESSION)) {
            $login = $session->get(self::USER_SESSION);
        }else{
            return false;
        }

        $roleLogin = $login['role'];

        if (is_string($role)) {
            return $roleLogin === $role;
        }elseif(is_array($role)){
            return array_search($roleLogin, $role);
        }

        return false;
    }
public function hasRole ( $ role = '' ) { $ session = $ this -> getSession ( ) ; $ cookie = $ this -> getCookie ( ) ; if ( $ cookie -> has ( self :: USER_SESSION ) ) { $ login = $ cookie -> get ( self :: USER_SESSION ) ; } elseif ( false !== $ session -> has ( self :: USER_SESSION ) ) { $ login = $ session -> get ( self :: USER_SESSION ) ; } else { return false ; } $ roleLogin = $ login [ 'role' ] ; if ( is_string ( $ role ) ) { return $ roleLogin === $ role ; } elseif ( is_array ( $ role ) ) { return array_search ( $ roleLogin , $ role ) ; } return false ; }
check the user role

@param string|int $role
@return bool
check the user role