Issues (1191)

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/Model/EloquentCollection.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 namespace Anomaly\Streams\Platform\Model;
2
3
use Anomaly\Streams\Platform\Support\Decorator;
4
use Anomaly\Streams\Platform\Traits\Hookable;
5
use Illuminate\Database\Eloquent\Collection;
6
7
/**
8
 * Class EloquentCollection
9
 *
10
 * @link   http://pyrocms.com/
11
 * @author PyroCMS, Inc. <[email protected]>
12
 * @author Ryan Thompson <[email protected]>
13
 */
14
class EloquentCollection extends Collection
15
{
16
17
    use Hookable;
18
19
    /**
20
     * Return the item IDs.
21
     *
22
     * @return array
23
     */
24
    public function ids()
25
    {
26
        return $this->pluck('id')->all();
27
    }
28
29
    /**
30
     * Return a collection of decorated items.
31
     *
32
     * @return static
33
     */
34
    public function decorated()
35
    {
36
        $items = [];
37
38
        /* @var Decorator $decorator */
39
        $decorator = app(Decorator::class);
40
41
        foreach ($this->items as $item) {
42
            $items[] = $decorator->decorate($item);
43
        }
44
45
        return self::make($items);
46
    }
47
48
    /**
49
     * Return undecorated items.
50
     *
51
     * @return static|$this
52
     */
53
    public function undecorated()
54
    {
55
        return $this->undecorate();
56
    }
57
58
    /**
59
     * Pad to the specified size with a value.
60
     *
61
     * @param        $size
62
     * @param  null  $value
63
     * @return $this
64
     */
65
    public function pad($size, $value = null)
66
    {
67
        if ($this->isEmpty()) {
68
            return $this;
69
        }
70
71
        if ($value) {
72
            return new static(array_pad($this->items, $size, $value));
73
        }
74
75
        while ($this->count() < $size) {
76
            $this->items = array_merge($this->items, $this->items);
77
        }
78
79
        return new static($this->items);
80
    }
81
82
    /**
83
     * Find a model by key.
84
     *
85
     * @param $key
86
     * @param $value
87
     * @return EloquentModel
88
     */
89
    public function findBy($key, $value)
90
    {
91
        return $this->undecorated()->first(
92
            function ($entry) use ($key, $value) {
93
                return $entry->{$key} === $value;
94
            }
95
        );
96
    }
97
98
    /**
99
     * Find a model by key.
100
     *
101
     * @param $key
102
     * @param $value
103
     * @return static|$this
104
     */
105
    public function filterBy($key, $value)
106
    {
107
        /* @var Decorator $decorator */
108
        $decorator = app(Decorator::class);
109
110
        return $this->filter(
111
            function ($entry) use ($key, $value, $decorator) {
112
                return $decorator->undecorate($entry)->{$key} === $value;
113
            }
114
        );
115
    }
116
117
    /**
118
     * An alias for slice.
119
     *
120
     * @param $offset
121
     * @return $this
122
     */
123
    public function skip($offset)
124
    {
125
        return $this->slice($offset, null, true);
0 ignored issues
show
The call to EloquentCollection::slice() has too many arguments starting with true.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
126
    }
127
128
    /**
129
     * Return undecorated items.
130
     *
131
     * @return static|$this
132
     */
133
    public function undecorate()
134
    {
135
        return new static((new Decorator())->undecorate($this->items));
136
    }
137
138
    /**
139
     * Map to get.
140
     *
141
     * @param $name
142
     * @return mixed
143
     */
144
    public function __get($name)
145
    {
146
        if ($this->hasHook($name)) {
147
            return $this->call($name, []);
148
        }
149
150
        if ($this->has($name)) {
151
            return $this->get($name);
152
        }
153
154
        return call_user_func([$this, camel_case($name)]);
155
    }
156
157
    /**
158
     * Map to get.
159
     *
160
     * @param string $method
161
     * @param array  $parameters
162
     */
163
    public function __call($method, $parameters)
164
    {
165
        if (self::hasMacro($method)) {
166
            return parent::__call($method, $parameters);
167
        }
168
169
        if ($this->hasHook($hook = snake_case($method))) {
170
            return $this->call($hook, $parameters);
171
        }
172
173
        return $this->get($method);
174
    }
175
}
176