Webmozart\Console\Api\Config\ApplicationConfig::setName PHP Method

setName() public method

Sets the name of the application.
See also: getName()
public setName ( string $name ) : static
$name string The application name.
return static The current instance.
    public function setName($name)
    {
        if (null !== $name) {
            Assert::string($name, 'The application name must be a string. Got: %s');
            Assert::notEmpty($name, 'The application name must not be empty.');
            Assert::regex($name, '~^[a-zA-Z0-9\\-]+$~', 'The application name must contain letters, numbers and hyphens only. Did you mean to call setDisplayName()?');
        }
        $this->name = $name;
        return $this;
    }

Usage Example

Ejemplo n.º 1
0
 public function testGetDisplayNameReturnsHumanizedNameByDefault()
 {
     $this->config->setName('the-name');
     $this->assertSame('The Name', $this->config->getDisplayName());
 }