Back to Rule class

Method mergeIdentity

public void
mergeIdentity
(mixed $identity, mixed $allow)
Merges the values for an identity.
Parameters
  • int $identity The identity.
  • bool $allow The value for the identity (true == allow, false == deny).
Returns
  • void
Since
  • 1.7.0
Class: Rule
Project: Joomla

Method mergeIdentity - Source code

/**
 * Merges the values for an identity.
 *
 * @param   integer  $identity  The identity.
 * @param   boolean  $allow     The value for the identity (true == allow, false == deny).
 *
 * @return  void
 *
 * @since   1.7.0
 */
public function mergeIdentity($identity, $allow)
{
    $identity = (int) $identity;
    $allow = (int) (bool) $allow;
    // Check that the identity exists.
    if (isset($this->data[$identity])) {
        // Explicit deny always wins a merge.
        if ($this->data[$identity] !== 0) {
            $this->data[$identity] = $allow;
        }
    } else {
        $this->data[$identity] = $allow;
    }
}