Issues (10)

Security Analysis    not enabled

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/Service/VocaDB/Endpoint/Track.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
/**
3
 * Created by PhpStorm.
4
 * User: oguzu
5
 * Date: 29-3-2017
6
 * Time: 16:29
7
 */
8
9
namespace Pbxg33k\MusicInfo\Service\VocaDB\Endpoint;
10
11
use Doctrine\Common\Collections\ArrayCollection;
12
use Pbxg33k\MusicInfo\Model\BaseModel;
13
use Pbxg33k\MusicInfo\Model\IMusicServiceEndpoint;
14
use Pbxg33k\VocaDB\Song as TrackEndpoint;
15
use Pbxg33k\VocaDB\Models\Track as VocaDBTrackModel;
16
use Pbxg33k\MusicInfo\Model\Track as TrackModel;
17
18
class Track extends TrackEndpoint implements IMusicServiceEndpoint
19
{
20
    const DATA_SOURCE = 'vocadb';
21
22
    protected $parent;
23
24
    /**
25
     * @param $apiService
26
     *
27
     * @return mixed
28
     */
29
    public function setParent($apiService)
30
    {
31
        $this->parent = $apiService;
32
33
        return $this;
34
    }
35
36
    /**
37
     * Transform single item to model
38
     *
39
     * @param VocaDBTrackModel $raw
40
     *
41
     * @return BaseModel
42
     */
43
    public function transformSingle($raw)
44
    {
45
        $object = new TrackModel();
46
        $object
47
            ->setId($raw->getId())
48
            ->setName($raw->getName());
49
50
        var_dump(
0 ignored issues
show
Security Debugging Code introduced by
var_dump(__FILE__, __LINE__, $raw); looks like debug code. Are you sure you do not want to remove it? This might expose sensitive data.
Loading history...
51
            __FILE__, __LINE__,
52
            $raw
53
        );die();
54
55
        return $object;
0 ignored issues
show
return $object; does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
56
57
    }
58
59
    /**
60
     * Transform collection to models
61
     *
62
     * @param $raw
63
     *
64
     * @return ArrayCollection
65
     */
66
    public function transformCollection($raw)
67
    {
68
        $collection = new ArrayCollection();
69
        foreach ($raw->collection as $artist) {
70
            $collection->add($this->transformSingle($artist));
71
        }
72
73
        return $collection;
74
    }
75
76
    /**
77
     * Transform to models
78
     *
79
     * @param $raw
80
     *
81
     * @return ArrayCollection
82
     */
83
    public function transform($raw)
84
    {
85
        return $this->transformCollection($raw);
86
    }
87
88
    /**
89
     * @return mixed
90
     */
91
    public function getParent()
92
    {
93
        return $this->parent;
94
    }
95
96
    /**
97
     * @param $guid
98
     *
99
     * @return mixed
100
     */
101
    public function getByGuid($guid, $complete = true)
102
    {
103
        return $this->transform(parent::getById($guid, $complete));
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (getById() instead of getByGuid()). Are you sure this is correct? If so, you might want to change this to $this->getById().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
104
    }
105
106
    public function getByName($name, $complete = true)
107
    {
108
        return $this->transform(parent::getByName($name, $complete));
109
    }
110
}