original_string: public function matchIdentityRoles(array $roles): bool
      {
          $identityRoles = $this->getIdentityRoles();
          // Too easy...
          if (empty($identityRoles)) {
              return false;
          }
          $roleNames = [];
          foreach ($roles as $role) {
              $roleNames[] = $role instanceof RoleInterface ? $role->getName() : (string)$role;
          }
  
          $identityRoleNames = [];
          foreach ($this->flattenRoles($identityRoles) as $role) {
              $identityRoleNames[] = $role->getName();
          }
  
          return count(array_intersect($roleNames, $identityRoleNames)) > 0;
      }
code: public function matchIdentityRoles(array $roles): bool
      {
          $identityRoles = $this->getIdentityRoles();
          // Too easy...
          if (empty($identityRoles)) {
              return false;
          }
          $roleNames = [];
          foreach ($roles as $role) {
              $roleNames[] = $role instanceof RoleInterface ? $role->getName() : (string)$role;
          }
  
          $identityRoleNames = [];
          foreach ($this->flattenRoles($identityRoles) as $role) {
              $identityRoleNames[] = $role->getName();
          }
  
          return count(array_intersect($roleNames, $identityRoleNames)) > 0;
      }
code_tokens: public function matchIdentityRoles ( array $ roles ) : bool { $ identityRoles = $ this -> getIdentityRoles ( ) ; // Too easy... if ( empty ( $ identityRoles ) ) { return false ; } $ roleNames = [ ] ; foreach ( $ roles as $ role ) { $ roleNames [ ] = $ role instanceof RoleInterface ? $ role -> getName ( ) : ( string ) $ role ; } $ identityRoleNames = [ ] ; foreach ( $ this -> flattenRoles ( $ identityRoles ) as $ role ) { $ identityRoleNames [ ] = $ role -> getName ( ) ; } return count ( array_intersect ( $ roleNames , $ identityRoleNames ) ) > 0 ; }
docstring: Check if the given roles match one of the identity roles
  
  This method is smart enough to automatically recursively extracts roles for hierarchical roles
  
  @param  string[]|RoleInterface[] $roles
  @return bool
docstring_tokens: Check if the given roles match one of the identity roles