src/console/docopt/pattern/Pattern.php
public function fixIdentities($unique = null) {
        if ($this->children) {
            if (!isset($unique))
                $unique = array_unique($this->flat());

            foreach ($this->children as $i => $child) {
                if (!$child instanceof BranchPattern) {
                    if (!in_array($child, $unique))               // Not sure if this is a true substitute for 'assert c in uniq'
                        throw new \UnexpectedValueException();
                    $this->children[$i] = $unique[array_search($child, $unique)];
                }
                else {
                    $child->fixIdentities($unique);
                }
            }
        }
        return $this;
    }
public function fixIdentities($unique = null) {
        if ($this->children) {
            if (!isset($unique))
                $unique = array_unique($this->flat());

            foreach ($this->children as $i => $child) {
                if (!$child instanceof BranchPattern) {
                    if (!in_array($child, $unique))               // Not sure if this is a true substitute for 'assert c in uniq'
                        throw new \UnexpectedValueException();
                    $this->children[$i] = $unique[array_search($child, $unique)];
                }
                else {
                    $child->fixIdentities($unique);
                }
            }
        }
        return $this;
    }
public function fixIdentities ( $ unique = null ) { if ( $ this -> children ) { if ( ! isset ( $ unique ) ) $ unique = array_unique ( $ this -> flat ( ) ) ; foreach ( $ this -> children as $ i => $ child ) { if ( ! $ child instanceof BranchPattern ) { if ( ! in_array ( $ child , $ unique ) ) // Not sure if this is a true substitute for 'assert c in uniq' throw new \ UnexpectedValueException ( ) ; $ this -> children [ $ i ] = $ unique [ array_search ( $ child , $ unique ) ] ; } else { $ child -> fixIdentities ( $ unique ) ; } } } return $ this ; }
Make pattern-tree tips point to same object if they are equal.

@param Pattern[]|null $unique [optional]

@return $this
Make pattern - tree tips point to same object if they are equal .