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.
Passed
Pull Request — master (#1061)
by Maxim
04:23 queued 01:35
created

CommonTemplate::getTemplateContent()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 55
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 55
ccs 0
cts 45
cp 0
crap 2
rs 9.7692
c 0
b 0
f 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
/* (c) Anton Medvedev <[email protected]>
3
 *
4
 * For the full copyright and license information, please view the LICENSE
5
 * file that was distributed with this source code.
6
 */
7
8
namespace Deployer\Initializer\Template;
9
10
/**
11
 * Generate a common (base) deployer configuration
12
 *
13
 * @author Vitaliy Zhuk <[email protected]>
14
 * @author Anton Medvedev <[email protected]>
15
 */
16
class CommonTemplate extends Template
17
{
18
    /**
19
     * {@inheritDoc}
20
     */
21
    protected function getTemplateContent()
22
    {
23
        return <<<PHP
24
<?php
25
namespace Deployer;
26
require 'recipe/common.php';
27
28
// Configuration
29
30
set('ssh_type', 'native');
31
set('ssh_multiplexing', true);
32
33
set('repository', '[email protected]:username/repository.git');
34
set('shared_files', []);
35
set('shared_dirs', []);
36
set('writable_dirs', []);
37
38
// Servers
39
40
server('production', 'domain.com')
41
    ->user('username')
42
    ->identityFile()
43
    ->set('deploy_path', '/var/www/domain.com');
44
45
46
// Tasks
47
48
desc('Restart PHP-FPM service');
49
task('php-fpm:restart', function () {
50
    // The user must have rights for restart service
51
    // /etc/sudoers: username ALL=NOPASSWD:/bin/systemctl restart php-fpm.service
52
    run('sudo systemctl restart php-fpm.service');
53
});
54
after('deploy:symlink', 'php-fpm:restart');
55
56
desc('Deploy your project');
57
task('deploy', [
58
    'deploy:prepare',
59
    'deploy:lock',
60
    'deploy:release',
61
    'deploy:update_code',
62
    'deploy:shared',
63
    'deploy:writable',
64
    'deploy:vendors',
65
    'deploy:clear_paths',
66
    'deploy:symlink',
67
    'deploy:unlock',
68
    'cleanup',
69
    'success'
70
]);
71
72
// [Optional] if deploy fails automatically unlock.
73
after('deploy:failed', 'deploy:unlock');
74
PHP;
75
    }
76
}
77