StackFormation\Helper\Validator::validateStackname PHP Method

validateStackname() public static method

public static validateStackname ( $stackName )
    public static function validateStackname($stackName)
    {
        if (!is_string($stackName)) {
            throw new \InvalidArgumentException('Invalid stack name (must be a string)');
        }
        // A stack name can contain only alphanumeric characters (case sensitive) and hyphens.
        // It must start with an alphabetic character and cannot be longer than 128 characters.
        if (!preg_match('/^[a-zA-Z][a-zA-Z0-9-]{0,127}$/', $stackName)) {
            throw new InvalidStackNameException($stackName);
        }
    }

Usage Example

コード例 #1
0
 protected final function execute(InputInterface $input, OutputInterface $output)
 {
     $stackName = $input->getArgument('stack');
     Validator::validateStackname($stackName);
     $stack = $this->getStackFactory()->getStack($stackName);
     return $this->executeWithStack($stack, $input, $output);
 }
All Usage Examples Of StackFormation\Helper\Validator::validateStackname