for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the FreshCentrifugoBundle.
*
* (c) Artem Henvald <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Fresh\CentrifugoBundle\Command;
use Symfony\Component\Console\Exception\InvalidArgumentException;
use Symfony\Component\Console\Input\InputInterface;
/**
* ArgumentUserTrait.
* @author Artem Henvald <[email protected]>
trait ArgumentUserTrait
{
/** @var string */
protected $user;
* @param InputInterface $input
* @throws InvalidArgumentException
protected function initializeUserArgument(InputInterface $input): void
$user = $input->getArgument('user');
if (!\is_string($user)) {
throw new InvalidArgumentException('Argument "user" is not a string.');
}
$this->user = $user;