src/GameOfLife/Inputs/TemplateInput.php
/**
     * Returns whether the board dimensions shall be adjusted to be the same like the templates dimensions.
     * If the template position or the board dimensions are specified the function assumes that the user
     * wants to keep the original board dimensions
     *
     * @param Getopt $_options The option list
     * @param Board $_board The board that will be filled
     * @param array $_templateFields The template fields
     * @param String $_posOptionPrefix The pos option prefix
     *
     * @return Bool Indicates whether the board dimensions shall be adjusted to be the same like the templates dimensions
     */
Returns whether the board dimensions shall be adjusted to be the same like the templates dimensions.
If the template position or the board dimensions are specified the function assumes that the user
wants to keep the original board dimensions

@param Getopt $_options The option list
@param Board $_board The board that will be filled
@param array $_templateFields The template fields
@param String $_posOptionPrefix The pos option prefix

@return Bool Indicates whether the board dimensions shall be adjusted to be the same like the templates dimensions
Returns whether the board dimensions shall be adjusted to be the same like the templates dimensions . If the template position or the board dimensions are specified the function assumes that the user wants to keep the original board dimensions @param Getopt $_options The option list @param Board $_board The board that will be filled @param array $_templateFields The template fields @param String $_posOptionPrefix The pos option prefix @return Bool Indicates whether the board dimensions shall be adjusted to be the same like the templates dimensions
private function isDimensionsAdjustment(Getopt $_options, Board $_board, array $_templateFields, String $_posOptionPrefix): Bool
    {
        if ($_posOptionPrefix !== "template")
        { 
            $templatePosX = ceil(($_board->width() - count($_templateFields[0])) / 2);
            $templatePosY =  ceil(($_board->height() - count($_templateFields)) / 2);
            $templateHeight = count($_templateFields);
            $templateWidth = count($_templateFields[0]);
            if (! $this->templatePlacer->isTemplateOutOfBounds($_board, $templateWidth, $templateHeight, $templatePosX, $templatePosY))
            {
                return false;
            }
        }
        if ($_options->getOption($_posOptionPrefix . "PosX") !== null ||
            $_options->getOption($_posOptionPrefix . "PosY") !== null ||
            $_options->getOption("width") !== null ||
            $_options->getOption("height") !== null)
        {
            return false;
        }
        return true;
    }
private function isDimensionsAdjustment ( Getopt $ _options , Board $ _board , array $ _templateFields , String $ _posOptionPrefix ) : Bool { if ( $ _posOptionPrefix !== " template " ) { $ templatePosX = ceil ( ( $ _board -> width ( ) - count ( $ _templateFields [ 0 ] ) ) / 2 ) ; $ templatePosY = ceil ( ( $ _board -> height ( ) - count ( $ _templateFields ) ) / 2 ) ; $ templateHeight = count ( $ _templateFields ) ; $ templateWidth = count ( $ _templateFields [ 0 ] ) ; if ( ! $ this -> templatePlacer -> isTemplateOutOfBounds ( $ _board , $ templateWidth , $ templateHeight , $ templatePosX , $ templatePosY ) ) { return false ; } } if ( $ _options -> getOption ( $ _posOptionPrefix . " PosX " ) !== null || $ _options -> getOption ( $ _posOptionPrefix . " PosY " ) !== null || $ _options -> getOption ( " width " ) !== null || $ _options -> getOption ( " height " ) !== null ) { return false ; } return true ; }
Returns whether the board dimensions shall be adjusted to be the same like the templates dimensions.
Returns whether the board dimensions shall be adjusted to be the same like the templates dimensions .
// If the template was selected by using --input