GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Issues (4)

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/Models/FirebaseModel.php (1 issue)

Severity

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: jaredchu
5
 * Date: 1/14/17
6
 * Time: 2:25 PM
7
 */
8
9
namespace JC\Firebase\Models;
10
11
use JC\Firebase\JCFirebase;
12
use JsonMapper;
13
14
/**
15
 * Class FirebaseModel
16
 * @package JCFirebase
17
 */
18
class FirebaseModel
19
{
20
21
    /**
22
     * @var string
23
     */
24
    public static $nodeName = '';
25
26
    /**
27
     * @var array
28
     */
29
    public static $maps = [];
30
31
    /**
32
     * @var string
33
     */
34
    public $key;
35
36
    /**
37
     * @var JCFirebase
38
     */
39
    public $firebase;
40
41
    /**
42
     * FirebaseModel constructor.
43
     *
44
     * @param \JC\Firebase\JCFirebase $firebase
45
     */
46 6
    public function __construct(JCFirebase $firebase = null)
47
    {
48 6
        $this->firebase = $firebase;
49 6
    }
50
51
    /**
52
     * @return string
53
     */
54 6
    public static function getNodeName()
55
    {
56 6
        return static::$nodeName ?: strtolower((new \ReflectionClass(get_called_class()))->getShortName());
57
    }
58
59
    /**
60
     * @param $nodeName
61
     */
62 2
    public static function setNodeName($nodeName)
63
    {
64 2
        static::$nodeName = $nodeName;
65 2
    }
66
67
    /**
68
     * @return array
69
     */
70 6
    public static function getMaps()
71
    {
72 6
        return static::$maps;
73
    }
74
75
    /**
76
     * @param array $maps
77
     */
78 1
    public static function setMaps($maps)
79
    {
80 1
        static::$maps = $maps;
81 1
    }
82
83
    /**
84
     * @return array
85
     */
86 6
    public function getData()
87
    {
88 6
        $object = clone $this;
89 6
        unset($object->firebase);
90 6
        unset($object->key);
91
92 6
        return static::mapAttributes(get_object_vars($object));
93
    }
94
95
    /**
96
     * @return bool
97
     */
98 4
    public function create()
99
    {
100 4
        $response = $this->firebase->post(static::getNodeName(), array(
101 4
            'data' => $this->getData()
102 4
        ));
103
104 4
        $this->key = json_decode($response->body())->name;
105
106 4
        return $response->success();
107
    }
108
109
110
    /**
111
     * @return bool
112
     */
113 4
    public function save()
114
    {
115 4
        if (!empty($this->key)) {
116 3
            $response = $this->firebase->put(static::getNodeName() . '/' . $this->key, array(
117 3
                'data' => $this->getData()
118 3
            ));
119
120 3
            $success = $response->success();
121 3
        } else {
122 1
            $success = $this->create();
123
        }
124
125 4
        return $success;
126
    }
127
128
    /**
129
     * @return bool
130
     */
131 1
    public function delete()
132
    {
133 1
        $success = false;
134 1
        if (!empty($this->key)) {
135 1
            $response = $this->firebase->delete(static::getNodeName() . '/' . $this->key);
136
137 1
            $success = $response->success();
138 1
        }
139
140 1
        return $success;
141
    }
142
143
    /**
144
     * @param $key
145
     * @param JCFirebase $firebase
146
     *
147
     * @return object
148
     */
149 6
    public static function findByKey($key, JCFirebase $firebase)
150
    {
151 6
        $response = $firebase->get(static::getNodeName() . '/' . $key);
152 6
        $object = null;
153 6
        if ($response->success() && $response->body() != 'null') {
154 5
            $object = static::map($response->json(), new static());
155 5
            $object->key = $key;
156 5
            $object->firebase = $firebase;
157 5
        }
158
159 6
        return $object;
160
    }
161
162
    /**
163
     * @param JCFirebase $firebase
164
     *
165
     * @return array(FirebaseModel)
0 ignored issues
show
The doc-type array(FirebaseModel) could not be parsed: Expected "|" or "end of type", but got "(" at position 5. (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
166
     */
167 2
    public static function findAll(JCFirebase $firebase)
168
    {
169 1
        $response = $firebase->get(static::getNodeName());
170 2
        $objects = array();
171
172 1
        $jsonObject = json_decode($response->body(), true);
173 1
        if ($response->success() && count($jsonObject)) {
174
            do {
175 1
                $object = static::map((object)current($jsonObject), new static());
176 1
                $object->key = key($jsonObject);
177 1
                $object->firebase = $firebase;
178 1
                $objects[] = $object;
179 1
            } while (next($jsonObject));
180 1
        }
181
182 1
        return $objects;
183
    }
184
185
    /**
186
     * @param $object
187
     * @param $instance
188
     * @return object
189
     */
190 5
    protected static function map($object, $instance)
191
    {
192 5
        $mapper = new JsonMapper();
193 5
        return $mapper->map((object)static::mapAttributes(get_object_vars($object), false), $instance);
194
    }
195
196
    /**
197
     * @param array $objectVars
198
     * @param bool $fromLocal
199
     * @return array
200
     */
201 6
    protected static function mapAttributes(array $objectVars, $fromLocal = true)
202
    {
203 6
        foreach (static::getMaps() as $localAttr => $DBAttr) {
204 1
            if ($fromLocal) {
205 1
                $objectVars[$DBAttr] = $objectVars[$localAttr];
206 1
                unset($objectVars[$localAttr]);
207 1
            } else {
208 1
                $objectVars[$localAttr] = $objectVars[$DBAttr];
209 1
                unset($objectVars[$DBAttr]);
210
            }
211 6
        }
212
213 6
        return $objectVars;
214
    }
215
}