danielpieper /
mrcli
| 1 | <?php declare(strict_types=1); |
||
| 2 | |||
| 3 | namespace DanielPieper\MergeReminder\ServiceProvider; |
||
| 4 | |||
| 5 | use DanielPieper\MergeReminder\Service\SlackService; |
||
| 6 | use DanielPieper\MergeReminder\SlackServiceAwareInterface; |
||
| 7 | use League\Container\Container; |
||
| 8 | use League\Container\ServiceProvider\AbstractServiceProvider; |
||
| 9 | use League\Container\ServiceProvider\BootableServiceProviderInterface; |
||
| 10 | use Razorpay\Slack\Client; |
||
| 11 | |||
| 12 | class SlackServiceProvider extends AbstractServiceProvider implements BootableServiceProviderInterface |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * {@inheritdoc} |
||
| 16 | */ |
||
| 17 | protected $provides = [ |
||
| 18 | Client::class, |
||
| 19 | SlackService::class, |
||
| 20 | ]; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * {@inheritdoc} |
||
| 24 | */ |
||
| 25 | public function register() |
||
| 26 | { |
||
| 27 | } |
||
| 28 | |||
| 29 | /** |
||
| 30 | * Method will be invoked on registration of a service provider implementing |
||
| 31 | * this interface. Provides ability for eager loading of Service Providers. |
||
| 32 | * |
||
| 33 | * @return void |
||
| 34 | */ |
||
| 35 | public function boot() |
||
| 36 | { |
||
| 37 | /** @var Container $container */ |
||
| 38 | $container = $this->getContainer(); |
||
| 39 | |||
| 40 | if (!$container->get('SLACK_WEBHOOK_URL') || !$container->get('SLACK_CHANNEL')) { |
||
| 41 | return; |
||
| 42 | } |
||
| 43 | |||
| 44 | $container->share(Client::class) |
||
|
0 ignored issues
–
show
|
|||
| 45 | ->addArguments([ |
||
| 46 | 'SLACK_WEBHOOK_URL', |
||
| 47 | [ |
||
| 48 | 'username' => 'Friendly Merge Reminder', |
||
| 49 | 'icon' => ':owl:', |
||
| 50 | 'channel' => $container->get('SLACK_CHANNEL'), |
||
| 51 | 'allow_markdown' => true, |
||
| 52 | ], |
||
| 53 | ]); |
||
| 54 | |||
| 55 | $container->share(SlackService::class) |
||
| 56 | ->addArgument(Client::class); |
||
| 57 | |||
| 58 | $container->inflector(SlackServiceAwareInterface::class) |
||
| 59 | ->invokeMethod('setSlackService', [SlackService::class]); |
||
| 60 | } |
||
| 61 | } |
||
| 62 |
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.