Issues (24)

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/Api/Match.php (4 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
namespace Happyr\ApiClient\Api;
4
5
use Happyr\ApiClient\Assert;
6
use Happyr\ApiClient\Model\Match\ExtendedMatch;
7
use Happyr\ApiClient\Model\Match\SelfDescription;
8
use Happyr\ApiClient\Model\Match\SimpleMatch;
9
use Happyr\ApiClient\Model\Match\TopPattern;
10
use Happyr\ApiClient\Model\Match\TopUser;
11
use Psr\Http\Message\ResponseInterface;
12
13
/**
14
 * @author Tobias Nyholm <[email protected]>
15
 */
16
final class Match extends HttpApi
17
{
18
    /**
19
     * @param $user
20
     * @param array $patterns
21
     * @param array $params   valid keys are norm and recalculate
22
     *
23
     * @return SimpleMatch|ResponseInterface
24
     */
25
    public function show($user, array $patterns, array $params = [])
26
    {
27
        Assert::stringNotEmpty($user);
28
        Assert::notEmpty($patterns);
29
30
        $params['user'] = $user;
31
        $params['pattern'] = implode(',', $patterns);
32
33
        $response = $this->httpGet('/api/match', $params);
34
35
        return $this->hydrateResponse($response, SimpleMatch::class);
36
    }
37
38
    /**
39
     * @param $user
40
     * @param array $patterns
41
     * @param array $params   valid keys are norm and locale
42
     *
43
     * @return ExtendedMatch|ResponseInterface
44
     */
45 View Code Duplication
    public function showExtended($user, array $patterns, array $params = [])
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...
46
    {
47
        Assert::stringNotEmpty($user);
48
        Assert::notEmpty($patterns);
49
50
        $params['user'] = $user;
51
        $params['pattern'] = implode(',', $patterns);
52
53
        $response = $this->httpGet('/api/match/extended', $params);
54
55
        return $this->hydrateResponse($response, ExtendedMatch::class);
56
    }
57
58
    /**
59
     * @param $user
60
     * @param array $patterns
61
     * @param array $params   valid keys are norm and locale
62
     *
63
     * @return SelfDescription|ResponseInterface
64
     */
65 View Code Duplication
    public function selfDescription($user, array $patterns, array $params = [])
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...
66
    {
67
        Assert::stringNotEmpty($user);
68
        Assert::notEmpty($patterns);
69
70
        $params['user'] = $user;
71
        $params['pattern'] = implode(',', $patterns);
72
73
        $response = $this->httpGet('/api/match/self-description', $params);
74
75
        return $this->hydrateResponse($response, SelfDescription::class);
76
    }
77
78
    /**
79
     * @param $user
80
     * @param array $patterns
81
     * @param array $params   valid keys are norm and limit
82
     *
83
     * @return TopPattern|ResponseInterface
84
     */
85 View Code Duplication
    public function topPatterns($user, array $patterns, array $params = [])
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...
86
    {
87
        Assert::stringNotEmpty($user);
88
        Assert::notEmpty($patterns);
89
90
        $params['user'] = $user;
91
        $params['pattern'] = implode(',', $patterns);
92
93
        $response = $this->httpGet('/api/match/top/patterns', $params);
94
95
        return $this->hydrateResponse($response, TopPattern::class);
96
    }
97
98
    /**
99
     * @param string $pattern
100
     * @param array  $params  valid keys are limit, offset and norm
101
     *
102
     * @return TopUser|ResponseInterface
103
     */
104 View Code Duplication
    public function topUser($pattern, array $params = [])
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...
105
    {
106
        Assert::stringNotEmpty($pattern);
107
108
        $params['pattern'] = $pattern;
109
110
        $response = $this->httpGet('/api/match/top/users', $params);
111
112
        return $this->hydrateResponse($response, TopUser::class);
113
    }
114
}
115