Issues (36)

Security Analysis    no request data  

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

src/WuBookManager.php (15 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
/*
4
 * This file is part of Laravel WuBook.
5
 *
6
 * (c) Filippo Galante <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace IlGala\LaravelWubook;
13
14
use fXmlRpc\Client;
15
use fXmlRpc\Parser\NativeParser;
16
use fXmlRpc\Serializer\NativeSerializer;
17
use Illuminate\Contracts\Config\Repository;
18
use IlGala\LaravelWubook\Exceptions\WuBookException;
19
use IlGala\LaravelWubook\Api\WuBookAuth;
20
use IlGala\LaravelWubook\Api\WuBookAvailability;
21
use IlGala\LaravelWubook\Api\WuBookCancellationPolicies;
22
use IlGala\LaravelWubook\Api\WuBookChannelManager;
23
use IlGala\LaravelWubook\Api\WuBookCorporate;
24
use IlGala\LaravelWubook\Api\WuBookExtras;
25
use IlGala\LaravelWubook\Api\WuBookPrices;
26
use IlGala\LaravelWubook\Api\WuBookReservations;
27
use IlGala\LaravelWubook\Api\WuBookRestrictions;
28
use IlGala\LaravelWubook\Api\WuBookRooms;
29
use IlGala\LaravelWubook\Api\WuBookTransactions;
30
31
/**
32
 * This is the WuBook manager class.
33
 *
34
 * @author Filippo Galante <[email protected]>
35
 */
36
class WuBookManager
37
{
38
39
    /**
40
     * @var string
41
     */
42
    const ENDPOINT = 'https://wubook.net/xrws/';
43
44
    /**
45
     * @var array
46
     */
47
    private $config;
48
49
    /**
50
     * @var Illuminate\Cache\Repository
51
     */
52
    private $cache;
53
54
    /**
55
     * Create a new WuBook Instance.
56
     *
57
     * @param Repository $config
58
     * @throws WuBookException
59
     */
60
    public function __construct(Repository $config)
61
    {
62
        // Setup credentials
63
        $this->config = array_only($config->get('wubook'), ['username', 'password', 'provider_key', 'lcode']);
64
65
        // Credentials check
66
        if (!array_key_exists('username', $this->config) || !array_key_exists('password', $this->config) || !array_key_exists('provider_key', $this->config) || !array_key_exists('lcode', $this->lcode)) {
0 ignored issues
show
The property lcode does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
67
            throw new WuBookException('Credentials are required!');
68
        }
69
70
        if (!array_key_exists('cache_token', $this->config)) {
71
            $this->config['cache_token'] = false;
72
        }
73
74
        // Utilities
75
        $this->cache = app()['cache'];
76
    }
77
78
    /**
79
     * Auth API
80
     *
81
     * @return IlGala\LaravelWubook\Api\WuBookAuth
82
     */
83 View Code Duplication
    public function auth()
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
84
    {
85
        // Setup client
86
        $client = new Client(self::ENDPOINT, null, new NativeParser(), new NativeSerializer());
87
88
        return new WuBookAuth($this->config, $this->cache, $client);
89
    }
90
91
    /**
92
     * Availability API
93
     *
94
     * @param string $token
95
     * @return IlGala\LaravelWubook\Api\WuBookAvailability
96
     */
97 View Code Duplication
    public function availability($token = null)
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
98
    {
99
        // Setup client
100
        $client = new Client(self::ENDPOINT, null, new NativeParser(), new NativeSerializer());
101
102
        return new WuBookAvailability($this->config, $this->cache, $client, $token);
103
    }
104
105
    /**
106
     * Cancellation polices API
107
     *
108
     * @param string $token
109
     * @return IlGala\LaravelWubook\Api\WuBookCancellationPolicies
110
     */
111
    public function cancellation_policies($token = null)
112
    {
113
        $client = new Client(self::ENDPOINT, null, new NativeParser(), new NativeSerializer());
114
115
        return new WuBookCancellationPolicies($this->config, $this->cache, $client, $token);
116
    }
117
118
    /**
119
     * Channel manager API
120
     *
121
     * @param string $token
122
     * @return IlGala\LaravelWubook\Api\WuBookChannelManager
123
     */
124 View Code Duplication
    public function channel_manager($token = null)
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
125
    {
126
        // Setup client
127
        $client = new Client(self::ENDPOINT, null, new NativeParser(), new NativeSerializer());
128
129
        return new WuBookChannelManager($this->config, $this->cache, $client, $token);
130
    }
131
132
    /**
133
     * Corporate function API
134
     *
135
     * @param string $token
136
     * @return IlGala\LaravelWubook\Api\WuBookCorporate
137
     */
138 View Code Duplication
    public function corporate_functions($token = null)
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
139
    {
140
        // Setup client
141
        $client = new Client(self::ENDPOINT, null, new NativeParser(), new NativeSerializer());
142
143
        return new WuBookCorporate($this->config, $this->cache, $client, $token);
144
    }
145
146
    /**
147
     * Extra functions API
148
     *
149
     * @param string $token
150
     * @return IlGala\LaravelWubook\Api\WuBookExtras
151
     */
152 View Code Duplication
    public function extras($token = null)
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
153
    {
154
        // Setup client
155
        $client = new Client(self::ENDPOINT, null, new NativeParser(), new NativeSerializer());
156
157
        return new WuBookExtras($this->config, $this->cache, $client, $token);
158
    }
159
160
    /**
161
     * Prices API
162
     *
163
     * @param string $token
164
     * @return IlGala\LaravelWubook\Api\WuBookPrices
165
     */
166 View Code Duplication
    public function prices($token = null)
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
167
    {
168
        // Setup client
169
        $client = new Client(self::ENDPOINT, null, new NativeParser(), new NativeSerializer());
170
171
        return new WuBookPrices($this->config, $this->cache, $client, $token);
172
    }
173
174
    /**
175
     * Reservations API
176
     *
177
     * @param string $token
178
     * @return IlGala\LaravelWubook\Api\WuBookPrices
179
     */
180 View Code Duplication
    public function reservations($token = null)
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
181
    {
182
        // Setup client
183
        $client = new Client(self::ENDPOINT, null, new NativeParser(), new NativeSerializer());
184
185
        return new WuBookReservations($this->config, $this->cache, $client, $token);
186
    }
187
188
    /**
189
     * Restrictions API
190
     *
191
     * @param string $token
192
     * @return IlGala\LaravelWubook\Api\WuBookRestrictions
193
     */
194 View Code Duplication
    public function restrictions($token = null)
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
195
    {
196
        // Setup client
197
        $client = new Client(self::ENDPOINT, null, new NativeParser(), new NativeSerializer());
198
199
        return new WuBookRestrictions($this->config, $this->cache, $client, $token);
200
    }
201
202
    /**
203
     * Rooms API
204
     *
205
     * @param string $token
206
     * @return IlGala\LaravelWubook\Api\WuBookRooms
207
     */
208 View Code Duplication
    public function rooms($token = null)
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
209
    {
210
        // Setup client
211
        $client = new Client(self::ENDPOINT, null, new NativeParser(), new NativeSerializer());
212
213
        return new WuBookRooms($this->config, $this->cache, $client, $token);
214
    }
215
216
    /**
217
     * Transactions API
218
     *
219
     * @param string $token
220
     * @return IlGala\LaravelWubook\Api\WuBookTransactions
221
     */
222 View Code Duplication
    public function transactions($token = null)
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
223
    {
224
        // Setup client
225
        $client = new Client(self::ENDPOINT, null, new NativeParser(), new NativeSerializer());
226
227
        return new WuBookTransactions($this->config, $this->cache, $client, $token);
228
    }
229
230
    /**
231
     * Username getter.
232
     *
233
     * @return string
234
     */
235
    public function get_username()
236
    {
237
        return $this->username;
0 ignored issues
show
The property username does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
238
    }
239
240
    /**
241
     * Password getter.
242
     *
243
     * @return string
244
     */
245
    public function get_password()
246
    {
247
        return $this->password;
0 ignored issues
show
The property password does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
248
    }
249
250
    /**
251
     * Provider key getter.
252
     *
253
     * @return string
254
     */
255
    public function get_provider_key()
256
    {
257
        return $this->provider_key;
0 ignored issues
show
The property provider_key does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
258
    }
259
260
    /**
261
     * Client getter.
262
     *
263
     * @return PhpXmlRpc\Client
264
     */
265
    public function get_client()
266
    {
267
        return $this->client;
0 ignored issues
show
The property client does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
268
    }
269
}
270