Exemplo n.º 1
0
 /**
  * Creates a new command name.
  *
  * @param string   $string  The command name.
  * @param string[] $aliases The alias names.
  */
 public function __construct($string, array $aliases = array())
 {
     Assert::string($string, 'The command name must be a string. Got: %s');
     Assert::notEmpty($string, 'The command name must not be empty.');
     Assert::regex($string, '~^[a-zA-Z0-9\\-]+$~', 'The command name must contain letters, digits and hyphens only. Got: "%s"');
     Assert::allString($aliases, 'The command aliases must be strings. Got: %s');
     Assert::allNotEmpty($aliases, 'The command aliases must not be empty.');
     Assert::allRegex($aliases, '~^[a-zA-Z0-9\\-]+$~', 'The command aliases must contain letters, digits and hyphens only. Got: "%s"');
     $this->string = $string;
     $this->aliases = $aliases;
 }