src/GameOfLife/Inputs/TemplateInput.php
/**
     * Places a template on the board or displays a list of templates.
     *
     * @param Board $_board The board
     * @param Getopt $_options The option list
     *
     * @throws \Exception The exception of FieldsPlacer, TemplateListPrinter or if no template file was specified
     */
Places a template on the board or displays a list of templates.
@param Board $_board The board
@param Getopt $_options The option list

@throws \Exception The exception of FieldsPlacer, TemplateListPrinter or if no template file was specified
Places a template on the board or displays a list of templates . @param Board $_board The board @param Getopt $_options The option list @throws \ Exception The exception of FieldsPlacer TemplateListPrinter or if no template file was specified
public function fillBoard(Board $_board, Getopt $_options)
    {
        if ($_options->getOption("template") !== null)
        {
            $this->placeTemplate($_board, $_options, $_options->getOption("template"), true);
        }
        elseif ($_options->getOption("list-templates") !== null)
        {
            $this->templateListPrinter->printTemplateLists();
        }
        else
        {
            $templateName = $this->getTemplateNameFromLinkedOption($_options);
            if ($templateName) $this->placeTemplate($_board, $_options, $templateName, false);
            else
            {
                if ($_options->getOption("input") !== "template")
                {
                    $randomInput = new RandomInput();
                    $randomInput->fillBoard($_board, new Getopt());
                }
                else throw new \Exception("No template file specified.");
            }
        }
    }
public function fillBoard ( Board $ _board , Getopt $ _options ) { if ( $ _options -> getOption ( " template " ) !== null ) { $ this -> placeTemplate ( $ _board , $ _options , $ _options -> getOption ( " template " ) , true ) ; } elseif ( $ _options -> getOption ( " list-templates " ) !== null ) { $ this -> templateListPrinter -> printTemplateLists ( ) ; } else { $ templateName = $ this -> getTemplateNameFromLinkedOption ( $ _options ) ; if ( $ templateName ) $ this -> placeTemplate ( $ _board , $ _options , $ templateName , false ) ; else { if ( $ _options -> getOption ( " input " ) !== " template " ) { $ randomInput = new RandomInput ( ) ; $ randomInput -> fillBoard ( $ _board , new Getopt ( ) ) ; } else throw new \ Exception ( " No template file specified. " ) ; } } }
Places a template on the board or displays a list of templates.
Places a template on the board or displays a list of templates .