public function replaceEntry(MenuEntry $new, MenuEntry $toReplace) {

		foreach($this->entries as $k => $e) {
			if($e === $toReplace) {
				$this->insertEntry($new, $k);
				$this->removeEntry($toReplace);
				break;
			}
		}
		
		return $this;

	}
public function replaceEntry(MenuEntry $new, MenuEntry $toReplace) {

		foreach($this->entries as $k => $e) {
			if($e === $toReplace) {
				$this->insertEntry($new, $k);
				$this->removeEntry($toReplace);
				break;
			}
		}
		
		return $this;

	}
public function replaceEntry ( MenuEntry $ new , MenuEntry $ toReplace ) { foreach ( $ this -> entries as $ k => $ e ) { if ( $ e === $ toReplace ) { $ this -> insertEntry ( $ new , $ k ) ; $ this -> removeEntry ( $ toReplace ) ; break ; } } return $ this ; }
replace a MenuEntry by another one

@param MenuEntry $new
@param MenuEntry $toReplace
@return Menu
replace a MenuEntry by another one