Back to Rules class

Method merge

public void
merge
(mixed $actions)
Method to merge actions with this object.
Parameters
  • mixed $actions Rule object, an array of actions or a JSON string array of actions.
Returns
  • void
Since
  • 1.7.0
Class: Rules
Project: Joomla

Method merge - Source code

/**
 * Method to merge actions with this object.
 *
 * @param   mixed  $actions  Rule object, an array of actions or a JSON string array of actions.
 *
 * @return  void
 *
 * @since   1.7.0
 */
public function merge($actions)
{
    if (\is_string($actions)) {
        $actions = json_decode($actions, true);
    }
    if (\is_array($actions)) {
        foreach ($actions as $action => $identities) {
            $this->mergeAction($action, $identities);
        }
    } elseif ($actions instanceof Rules) {
        $data = $actions->getData();
        foreach ($data as $name => $identities) {
            $this->mergeAction($name, $identities);
        }
    }
}