src/GameOfLife/Inputs/BoardEditor/Options/SaveTemplateOption.php
/**
     * Saves current board to a custom template file.
     *
     * @param string $_templateName Thee template name
     *
     * @return bool Indicates whether the board editing is finished
     *
     * @throws \Exception The exception when the template saver fails to save the template
     */
Saves current board to a custom template file.
@param string $_templateName Thee template name

@return bool Indicates whether the board editing is finished

@throws \Exception The exception when the template saver fails to save the template
Saves current board to a custom template file . @param string $_templateName Thee template name @return bool Indicates whether the board editing is finished @throws \ Exception The exception when the template saver fails to save the template
public function saveTemplate(String $_templateName)
    {
        try
        {
            $this->templateSaver->saveCustomTemplate($_templateName, $this->parentBoardEditor->board());
        }
        catch (\Exception $_exception)
        {
            echo "Warning: A template with that name already exists.\n";
            $input = $this->parentBoardEditor->readInput("Overwrite the old file? (Yes|No): ");
            if (stristr($input, "y") || stristr($input, "yes"))
            {
                $this->templateSaver->saveCustomTemplate($_templateName, $this->parentBoardEditor->board(), true);
                echo "Template successfully replaced!\n\n";
            }
            else echo "Saving aborted.\n\n";
            return false;
        }
        echo "Template successfully saved!\n\n";
        echo "You can set/unset more cells or start the simulation by typing \"start\"\n\n";
        return false;
    }
public function saveTemplate ( String $ _templateName ) { try { $ this -> templateSaver -> saveCustomTemplate ( $ _templateName , $ this -> parentBoardEditor -> board ( ) ) ; } catch ( \ Exception $ _exception ) { echo " Warning: A template with that name already exists. \n " ; $ input = $ this -> parentBoardEditor -> readInput ( " Overwrite the old file? (Yes|No):  " ) ; if ( stristr ( $ input , " y " ) || stristr ( $ input , " yes " ) ) { $ this -> templateSaver -> saveCustomTemplate ( $ _templateName , $ this -> parentBoardEditor -> board ( ) , true ) ; echo " Template successfully replaced! \n \n " ; } else echo " Saving aborted. \n \n " ; return false ; } echo " Template successfully saved! \n \n " ; echo " You can set/unset more cells or start the simulation by typing  \" start \" \n \n " ; return false ; }
Saves current board to a custom template file.
Saves current board to a custom template file .