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.

Service   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 94
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 0
loc 94
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
B defaultIndexFile() 0 37 1
A options() 0 4 1
A packs() 0 7 1
A servers() 0 4 1
1
<?php
2
/**
3
 * Pterodactyl - Panel
4
 * Copyright (c) 2015 - 2017 Dane Everitt <[email protected]>.
5
 *
6
 * Permission is hereby granted, free of charge, to any person obtaining a copy
7
 * of this software and associated documentation files (the "Software"), to deal
8
 * in the Software without restriction, including without limitation the rights
9
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
 * copies of the Software, and to permit persons to whom the Software is
11
 * furnished to do so, subject to the following conditions:
12
 *
13
 * The above copyright notice and this permission notice shall be included in all
14
 * copies or substantial portions of the Software.
15
 *
16
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
 * SOFTWARE.
23
 */
24
25
namespace Pterodactyl\Models;
26
27
use Illuminate\Database\Eloquent\Model;
28
29
class Service extends Model
30
{
31
    /**
32
     * The table associated with the model.
33
     *
34
     * @var string
35
     */
36
    protected $table = 'services';
37
38
    /**
39
     * Fields that are mass assignable.
40
     *
41
     * @var array
42
     */
43
    protected $fillable = [
44
        'name', 'description', 'folder', 'startup', 'index_file',
45
    ];
46
47
    /**
48
     * Returns the default contents of the index.js file for a service.
49
     *
50
     * @return string
51
     */
52
    public static function defaultIndexFile()
53
    {
54
        return <<<'EOF'
55
'use strict';
56
57
/**
58
 * Pterodactyl - Daemon
59
 * Copyright (c) 2015 - 2017 Dane Everitt <[email protected]>
60
 *
61
 * Permission is hereby granted, free of charge, to any person obtaining a copy
62
 * of this software and associated documentation files (the "Software"), to deal
63
 * in the Software without restriction, including without limitation the rights
64
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
65
 * copies of the Software, and to permit persons to whom the Software is
66
 * furnished to do so, subject to the following conditions:
67
 *
68
 * The above copyright notice and this permission notice shall be included in all
69
 * copies or substantial portions of the Software.
70
 *
71
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
72
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
73
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
74
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
75
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
76
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
77
 * SOFTWARE.
78
 */
79
const rfr = require('rfr');
80
const _ = require('lodash');
81
82
const Core = rfr('src/services/index.js');
83
84
class Service extends Core {}
85
86
module.exports = Service;
87
EOF;
88
    }
89
90
    /**
91
     * Gets all service options associated with this service.
92
     *
93
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
94
     */
95
    public function options()
96
    {
97
        return $this->hasMany(ServiceOption::class);
98
    }
99
100
    /**
101
     * Returns all of the packs associated with a service, regardless of the service option.
102
     *
103
     * @return \Illuminate\Database\Eloquent\Relations\HasManyThrough
104
     */
105
    public function packs()
106
    {
107
        return $this->hasManyThrough(
108
            'Pterodactyl\Models\Pack', 'Pterodactyl\Models\ServiceOption',
109
            'service_id', 'option_id'
110
        );
111
    }
112
113
    /**
114
     * Gets all servers associated with this service.
115
     *
116
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
117
     */
118
    public function servers()
119
    {
120
        return $this->hasMany(Server::class);
121
    }
122
}
123