Issues (23)

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/Driver/AbstractAdapter.php (3 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
namespace TTS\Driver;
3
4
use GuzzleHttp\Exception\RequestException;
5
6
abstract class AbstractAdapter
7
{
8
    const DEFAULT_LANG = 'en_GB';
9
10
    protected $name = null;
11
    protected $voice = null;
12
    /** @var \GuzzleHttp\Client $client */
13
    protected $client = null;
14
15
    protected $language = null;
16
    protected $speed = null;
17
18
    private $debug = false;
19
20
    protected $languageMap = [
21
    ];
22
23
24
    public function __construct($language = self::DEFAULT_LANG, $speed = '0.5')
0 ignored issues
show
The parameter $speed is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
25
    {
26
        if ($this->validateLanguage($language)) {
27
            throw new \Exception('The language is not supported');
28
        }
29
30
        $this->client = new \GuzzleHttp\Client();
31
        $this->language = $this->languageMap[$language];
32
    }
33
34
    public function setLanguage($language)
35
    {
36
        if ($this->validateLanguage($language)) {
37
            throw new \Exception('The language is not supported');
38
        }
39
40
        $this->language = $this->languageMap[$language];
41
        return $this;
42
    }
43
44
    protected function validateLanguage($language)
45
    {
46
        return !array_key_exists($language, $this->languageMap);
47
    }
48
49
    public function getLanguage()
50
    {
51
        return $this->language;
52
    }
53
54
    public function setSpeed($speed)
55
    {
56
        $this->speed = $speed;
57
        return $this;
58
    }
59
60
    public function getSpeed()
61
    {
62
        return $this->speed;
63
    }
64
65
    public function getName()
66
    {
67
        return $this->name;
68
    }
69
70
    public function getVoice()
71
    {
72
        return $this->voice;
73
    }
74
75
    public function reguestGet($params)
76
    {
77
        $headers = [
78
            'User-Agent'    => 'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.872.0 Safari/535.2'
79
        ];
80
81
        try {
82
            $response = $this->client->get($this->getUri(), ['debug' => $this->debug, 'query' => $params, 'headers' => $headers]);
83
        } catch (RequestException $e) {
84
            echo $e->getMessage();
85
86
            if ($e->hasResponse()) {
0 ignored issues
show
This if statement is empty and can be removed.

This check looks for the bodies of if statements that have no statements or where all statements have been commented out. This may be the result of changes for debugging or the code may simply be obsolete.

These if bodies can be removed. If you have an empty if but statements in the else branch, consider inverting the condition.

if (rand(1, 6) > 3) {
//print "Check failed";
} else {
    print "Check succeeded";
}

could be turned into

if (rand(1, 6) <= 3) {
    print "Check succeeded";
}

This is much more concise to read.

Loading history...
87
            }
88
            die('error');
0 ignored issues
show
Coding Style Compatibility introduced by
The method reguestGet() contains an exit expression.

An exit expression should only be used in rare cases. For example, if you write a short command line script.

In most cases however, using an exit expression makes the code untestable and often causes incompatibilities with other libraries. Thus, unless you are absolutely sure it is required here, we recommend to refactor your code to avoid its usage.

Loading history...
89
        }
90
        return $response->getBody()->getContents();
91
    }
92
93
    abstract public function getUri();
94
    abstract public function make($text, $fileName);
95
}
96