yuanxing008 /
laravel-aliyun-amqp
| 1 | <?php |
||||
| 2 | /** |
||||
| 3 | * Author: Joker |
||||
| 4 | * Date: 2020-05-08 13:57 |
||||
| 5 | */ |
||||
| 6 | |||||
| 7 | namespace JokerProject\LaravelAliyunAmqp\Command; |
||||
| 8 | |||||
| 9 | use Illuminate\Console\Command; |
||||
| 10 | use Monolog\Handler\StreamHandler; |
||||
| 11 | use Monolog\Logger; |
||||
| 12 | use JokerProject\LaravelAliyunAmqp\ConsumerInterface; |
||||
| 13 | use JokerProject\LaravelAliyunAmqp\Container; |
||||
| 14 | use JokerProject\LaravelAliyunAmqp\PublisherInterface; |
||||
| 15 | use Psr\Log\LoggerAwareInterface; |
||||
| 16 | use Psr\Log\LoggerInterface; |
||||
| 17 | use Symfony\Component\Console\Output\OutputInterface; |
||||
| 18 | |||||
| 19 | /** |
||||
| 20 | * Class BasePublisherCommand |
||||
| 21 | * |
||||
| 22 | * @package JokerProject\LaravelAliyunAmqp\Command |
||||
| 23 | */ |
||||
| 24 | class BasePublisherCommand extends Command |
||||
| 25 | { |
||||
| 26 | /** |
||||
| 27 | * The name and signature of the console command. |
||||
| 28 | * |
||||
| 29 | * @var string |
||||
| 30 | */ |
||||
| 31 | protected $signature = 'rabbitmq:publish {publisher} {message}'; |
||||
| 32 | |||||
| 33 | /** |
||||
| 34 | * The console command description. |
||||
| 35 | * |
||||
| 36 | * @var string |
||||
| 37 | */ |
||||
| 38 | protected $description = 'Publish one message'; |
||||
| 39 | |||||
| 40 | /** |
||||
| 41 | * @var null|Container |
||||
| 42 | */ |
||||
| 43 | private $container = null; |
||||
| 44 | |||||
| 45 | /** |
||||
| 46 | * BasePublisherCommand constructor. |
||||
| 47 | * |
||||
| 48 | * @param Container $container |
||||
| 49 | */ |
||||
| 50 | public function __construct(Container $container) |
||||
| 51 | { |
||||
| 52 | $this->container = $container; |
||||
| 53 | parent::__construct(); |
||||
| 54 | } |
||||
| 55 | |||||
| 56 | /** |
||||
| 57 | * @param string $publisherAliasName |
||||
| 58 | * @return PublisherInterface |
||||
| 59 | */ |
||||
| 60 | protected function getPublisher(string $publisherAliasName): PublisherInterface |
||||
| 61 | { |
||||
| 62 | return $this->container->getPublisher($publisherAliasName); |
||||
|
0 ignored issues
–
show
|
|||||
| 63 | } |
||||
| 64 | |||||
| 65 | /** |
||||
| 66 | * Execute the console command. |
||||
| 67 | * @return int |
||||
| 68 | */ |
||||
| 69 | public function handle() |
||||
| 70 | { |
||||
| 71 | $this->getPublisher($this->input->getArgument('publisher')) |
||||
|
0 ignored issues
–
show
It seems like
$this->input->getArgument('publisher') can also be of type null and string[]; however, parameter $publisherAliasName of JokerProject\LaravelAliy...Command::getPublisher() does only seem to accept string, maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 72 | ->publish($this->input->getArgument('message')); |
||||
|
0 ignored issues
–
show
It seems like
$this->input->getArgument('message') can also be of type null and string[]; however, parameter $message of JokerProject\LaravelAliy...herInterface::publish() does only seem to accept string, maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 73 | } |
||||
| 74 | } |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.