コード例 #1
0
 public function testMatchNotAll()
 {
     $set = 0b1010;
     $this->assertTrue(Flags::match($set, 0b1000, 0b100));
     $this->assertTrue(Flags::match($set, 0b1000 | 0b10));
     $this->assertFalse(Flags::match($set, 0b1000 | 0b10 | 0b100));
 }
コード例 #2
0
ファイル: User.php プロジェクト: pombredanne/xmlcheck-public
 /**
  * Checks whether user has supplied privileges.
  * @param int [...] sets of privileges to check
  * @return bool true if no privileges are supplied or if at least
  * one supplied set of privileges is matched with user's privileges
  */
 public function hasPrivileges(...$setsOfPrivileges)
 {
     if ($this->isLogged()) {
         return Flags::match($this->data['privileges'], ...$setsOfPrivileges);
     }
     return false;
 }