示例#1
0
 public function insert($position, Contenu $content)
 {
     $max = $this->_write + 1;
     if ($position < 0 || $position > $max) {
         throw new MethodParametersException('Nouvelle position invalide');
     }
     for ($i = $position; $i < $max; $i += 1) {
         $content->add($this->_content[$i]);
         if ($i < $max - 1) {
             $content->add_sauts();
         }
     }
     $this->_write = $position;
     $content->rewind();
     while ($content->valid()) {
         if ($content->key() > 0) {
             $this->add_sauts();
         }
         $this->resetLine()->add($content->current());
         $content->next();
     }
 }