Issues (34)

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/Message/Notification.php (1 issue)

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
 * Copyright 2014 Underground Elephant
5
 *
6
 * Licensed under the Apache License, Version 2.0 (the "License");
7
 * you may not use this file except in compliance with the License.
8
 * You may obtain a copy of the License at
9
 *
10
 *     http://www.apache.org/licenses/LICENSE-2.0
11
 *
12
 * Unless required by applicable law or agreed to in writing, software
13
 * distributed under the License is distributed on an "AS IS" BASIS,
14
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
 * See the License for the specific language governing permissions and
16
 * limitations under the License.
17
 *
18
 * @package     qpush-bundle
19
 * @copyright   Underground Elephant 2014
20
 * @license     Apache License, Version 2.0
21
 */
22
23
namespace Uecode\Bundle\QPushBundle\Message;
24
25
use Doctrine\Common\Collections\ArrayCollection;
26
27
/**
28
 * @author Keith Kirk <[email protected]>
29
 */
30 View Code Duplication
class Notification
0 ignored issues
show
This class 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...
31
{
32
    /**
33
     * Notification Id
34
     *
35
     * @var int|string
36
     */
37
    protected $id;
38
39
    /**
40
     * Notification Body
41
     *
42
     * @var string|array
43
     */
44
    protected $body;
45
46
    /**
47
     * Notification Metadata
48
     *
49
     * @var ArrayCollection
50
     */
51
    protected $metadata;
52
53
    /**
54
     * Constructor.
55
     *
56
     * Sets the Notification Id, Notification Body, and any Notification Metadata
57
     *
58
     * @param int|string   $id       The Notification Id
59
     * @param string|array $body     The Notification Message
60
     * @param array        $metadata The Notification Metadata
61
     */
62 15
    public function __construct($id, $body, array $metadata)
63
    {
64 15
        $this->id       = $id;
65 15
        $this->metadata = new ArrayCollection($metadata);
66
67 15
        $message = is_string($body) ? json_decode($body, true) : $body;
68 15
        if (json_last_error() !== JSON_ERROR_NONE) {
69 4
            $message = $body;
70
        }
71
72 15
        $this->body = $message;
73 15
    }
74
75
    /**
76
     * Returns the Notification Id
77
     *
78
     * @return int|string
79
     */
80 4
    public function getId()
81
    {
82 4
        return $this->id;
83
    }
84
85
    /**
86
     * Returns the Notification Body
87
     *
88
     * @return string|array
89
     */
90 4
    public function getBody()
91
    {
92 4
        return $this->body;
93
    }
94
95
    /**
96
     * Returns the Notification Metadata
97
     *
98
     * @return ArrayCollection
99
     */
100 5
    public function getMetadata()
101
    {
102 5
        return $this->metadata;
103
    }
104
}
105