GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Issues (113)

contrib/rabbit.php (4 issues)

1
<?php
2
/*
3
### Installing
4
5
```php
6
// deploy.php
7
8
require 'recipe/rabbit.php';
9
```
10
11
### Configuration options
12
13
- **rabbit** *(required)*: accepts an *array* with the connection information to [rabbitmq](http://www.rabbitmq.com) server token and team name.
14
15
16
You can provide also other configuration options:
17
18
 - *host* - default is localhost
19
 - *port* - default is 5672
20
 - *username* - default is *guest*
21
 - *password* - default is *guest*
22
 - *channel* - no default value, need to be specified via config
23
 - *message* - default is **Deployment to '{$host}' on *{$prod}* was successful\n($releasePath)**
24
 - *vhost* - default is
25
26
27
```php
28
// deploy.php
29
30
set('rabbit', [
31
    'host'     => 'localhost',
32
    'port'     => '5672',
33
    'username' => 'guest',
34
    'password' => 'guest',
35
    'channel'  => 'notify-channel',
36
    'vhost'    => '/my-app'
37
]);
38
```
39
40
### Suggested Usage
41
42
Since you should only notify RabbitMQ channel of a successful deployment, the `deploy:rabbit` task should be executed right at the end.
43
44
```php
45
// deploy.php
46
47
before('deploy:end', 'deploy:rabbit');
48
```
49
 */
50
namespace Deployer;
51
52
use Deployer\Task\Context;
53
use PhpAmqpLib\Connection\AMQPConnection;
0 ignored issues
show
The type PhpAmqpLib\Connection\AMQPConnection was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
54
use PhpAmqpLib\Message\AMQPMessage;
0 ignored issues
show
The type PhpAmqpLib\Message\AMQPMessage was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
55
56
57
desc('Notifying RabbitMQ channel about deployment');
58
task('deploy:rabbit', function () {
59
60
    if (!class_exists('PhpAmqpLib\Connection\AMQPConnection')) {
61
        throw new \RuntimeException("<comment>Please install php package</comment> <info>videlalvaro/php-amqplib</info> <comment>to use rabbitmq</comment>");
62
    }
63
64
    $config = get('rabbit', []);
65
66
    if (!isset($config['message'])) {
67
        $releasePath = get('release_path');
68
        $host = Context::get()->getHost();
69
70
        $stage = get('stage', false);
71
        $stageInfo = ($stage) ? sprintf(' on *%s*', $stage) : '';
72
73
        $message = "Deployment to '%s'%s was successful\n(%s)";
74
        $config['message'] = sprintf(
75
            $message,
76
            $host,
0 ignored issues
show
$host of type Deployer\Host\Host is incompatible with the type string expected by parameter $args of sprintf(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

76
            /** @scrutinizer ignore-type */ $host,
Loading history...
77
            $stageInfo,
78
            $releasePath
79
        );
80
    }
81
82
    $defaultConfig = array(
83
        'host' => 'localhost',
84
        'port' => 5672,
85
        'username' => 'guest',
86
        'password' => 'guest',
87
        'vhost' => '/',
88
    );
89
90
    $config = array_merge($defaultConfig, $config);
91
92
    if (!is_array($config) ||
0 ignored issues
show
The condition is_array($config) is always true.
Loading history...
93
        !isset($config['channel']) ||
94
        !isset($config['host']) ||
95
        !isset($config['port']) ||
96
        !isset($config['username']) ||
97
        !isset($config['password']) ||
98
        !isset($config['vhost']) )
99
    {
100
        throw new \RuntimeException("<comment>Please configure rabbit config:</comment> <info>set('rabbit', array('channel' => 'channel', 'host' => 'host', 'port' => 'port', 'username' => 'username', 'password' => 'password'));</info>");
101
    }
102
103
    $connection = new AMQPConnection($config['host'], $config['port'], $config['username'], $config['password'], $config['vhost']);
104
    $channel = $connection->channel();
105
106
    $msg = new AMQPMessage($config['message']);
107
    $channel->basic_publish($msg, $config['channel'], $config['channel']);
108
109
    $channel->close();
110
    $connection->close();
111
112
});
113