private function varCreator($prefix, $typeCast)
    {
        $this->output(PHP_EOL.'-> Create new '.$prefix, Console::FG_YELLOW);
        $name = $this->prompt('Variable Name:', ['required' => true]);
        $label = $this->prompt('End-User Label:', ['required' => true]);
        $type = $this->select('Variable Type:', $this->getVariableTypes());
    
        $v = [
            'var' => Inflector::variablize($name),
            'label' => $label,
            'type' => $this->getVariableTypeInterfaceMap()[$type],
        ];
    
        if ($this->hasVariableTypeOption($type)) {
            $v['options'] = $this->getVariableTypeOption($type);
        }
    
        if ($typeCast == 'var') {
            $func = 'getVarValue';
        } else {
            $func = 'getCfgValue';
        }
    
        $extra = $this->getExtraVarDef($type, $v['var'], $func);
    
        if ($extra !== false) {
            $this->phpdoc[] = '{{extras.'.$v['var'].'}}';
            $this->viewFileDoc[] = '$this->extraValue(\''.$v['var'].'\');';
            $this->extras[] = $extra;
        }
    
        $this->output('Added '.$prefix.PHP_EOL, Console::FG_GREEN);
    
        return $v;
    }
private function varCreator($prefix, $typeCast)
    {
        $this->output(PHP_EOL.'-> Create new '.$prefix, Console::FG_YELLOW);
        $name = $this->prompt('Variable Name:', ['required' => true]);
        $label = $this->prompt('End-User Label:', ['required' => true]);
        $type = $this->select('Variable Type:', $this->getVariableTypes());
    
        $v = [
            'var' => Inflector::variablize($name),
            'label' => $label,
            'type' => $this->getVariableTypeInterfaceMap()[$type],
        ];
    
        if ($this->hasVariableTypeOption($type)) {
            $v['options'] = $this->getVariableTypeOption($type);
        }
    
        if ($typeCast == 'var') {
            $func = 'getVarValue';
        } else {
            $func = 'getCfgValue';
        }
    
        $extra = $this->getExtraVarDef($type, $v['var'], $func);
    
        if ($extra !== false) {
            $this->phpdoc[] = '{{extras.'.$v['var'].'}}';
            $this->viewFileDoc[] = '$this->extraValue(\''.$v['var'].'\');';
            $this->extras[] = $extra;
        }
    
        $this->output('Added '.$prefix.PHP_EOL, Console::FG_GREEN);
    
        return $v;
    }
private function varCreator ( $ prefix , $ typeCast ) { $ this -> output ( PHP_EOL . '-> Create new ' . $ prefix , Console :: FG_YELLOW ) ; $ name = $ this -> prompt ( 'Variable Name:' , [ 'required' => true ] ) ; $ label = $ this -> prompt ( 'End-User Label:' , [ 'required' => true ] ) ; $ type = $ this -> select ( 'Variable Type:' , $ this -> getVariableTypes ( ) ) ; $ v = [ 'var' => Inflector :: variablize ( $ name ) , 'label' => $ label , 'type' => $ this -> getVariableTypeInterfaceMap ( ) [ $ type ] , ] ; if ( $ this -> hasVariableTypeOption ( $ type ) ) { $ v [ 'options' ] = $ this -> getVariableTypeOption ( $ type ) ; } if ( $ typeCast == 'var' ) { $ func = 'getVarValue' ; } else { $ func = 'getCfgValue' ; } $ extra = $ this -> getExtraVarDef ( $ type , $ v [ 'var' ] , $ func ) ; if ( $ extra !== false ) { $ this -> phpdoc [ ] = '{{extras.' . $ v [ 'var' ] . '}}' ; $ this -> viewFileDoc [ ] = '$this->extraValue(\'' . $ v [ 'var' ] . '\');' ; $ this -> extras [ ] = $ extra ; } $ this -> output ( 'Added ' . $ prefix . PHP_EOL , Console :: FG_GREEN ) ; return $ v ; }
Create a variable based of user input.

@param string $prefix
@param string $typeCast 'var', 'cfg'
@return array
Create a variable based of user input .