src/Registry.php
public function set($path, $value)
  {
    $old = null;
    if ( $nodes = explode('.', $path) ){
      $node = $this->data;

      for($i=0, $n=count($nodes)-1; $i<$n; $i++){
        if ( !isset($node->{$nodes[$i]}) && ($i != $n) ){
          $node->{$nodes[$i]} = new \stdClass;
        }
        
        $node = $node->{$nodes[$i]};
      }
      
      if ( isset($node->{$nodes[$i]}) ){
        $old = $node->{$nodes[$i]};
      }
      $node->{$nodes[$i]} = $value;
    }
    return $old;
  }
public function set($path, $value)
  {
    $old = null;
    if ( $nodes = explode('.', $path) ){
      $node = $this->data;

      for($i=0, $n=count($nodes)-1; $i<$n; $i++){
        if ( !isset($node->{$nodes[$i]}) && ($i != $n) ){
          $node->{$nodes[$i]} = new \stdClass;
        }
        
        $node = $node->{$nodes[$i]};
      }
      
      if ( isset($node->{$nodes[$i]}) ){
        $old = $node->{$nodes[$i]};
      }
      $node->{$nodes[$i]} = $value;
    }
    return $old;
  }
public function set ( $ path , $ value ) { $ old = null ; if ( $ nodes = explode ( '.' , $ path ) ) { $ node = $ this -> data ; for ( $ i = 0 , $ n = count ( $ nodes ) - 1 ; $ i < $ n ; $ i ++ ) { if ( ! isset ( $ node -> { $ nodes [ $ i ] } ) && ( $ i != $ n ) ) { $ node -> { $ nodes [ $ i ] } = new \ stdClass ; } $ node = $ node -> { $ nodes [ $ i ] } ; } if ( isset ( $ node -> { $ nodes [ $ i ] } ) ) { $ old = $ node -> { $ nodes [ $ i ] } ; } $ node -> { $ nodes [ $ i ] } = $ value ; } return $ old ; }
Set a registry value

@param   string  $path   Registry Path (e.g. joomla.content.showauthor)
@param   mixed   $value  Value of entry
@return   mixed  The value of the that has been set
Set a registry value