Issues (36)

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/Resources/proxy/template.php (9 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
/*
4
 * This file is part of php-cache\cache-bundle package.
5
 *
6
 * (c) 2015 Aaron Scherer <[email protected]>, Tobias Nyholm <[email protected]>
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
use Cache\CacheBundle\DataCollector\CacheProxyInterface;
13
use Cache\CacheBundle\DataCollector\TraceableAdapterEvent;
14
use Psr\Cache\CacheItemInterface;
15
16
class __TPL_CLASS__ extends __TPL_EXTENDS__ implements CacheProxyInterface
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
17
{
18
    private $__name;
19
    private $__calls = [];
20
21
    public function getItem($key)
22
    {
23
        $event = $this->start(__FUNCTION__, $key);
24
25
        try {
26
            $item = parent::getItem($key);
27
        } finally {
28
            $event->end = microtime(true);
29
        }
30
        if ($item->isHit()) {
31
            $event->hits++;
32
        } else {
33
            $event->misses++;
34
        }
35
        $event->result = $item->get();
36
37
        return $item;
38
    }
39
40
    public function hasItem($key)
41
    {
42
        $event = $this->start(__FUNCTION__, $key);
43
44
        try {
45
            $event->result = parent::hasItem($key);
46
        } finally {
47
            $event->end = microtime(true);
48
        }
49
50
        if (!$event->result) {
51
            $event->misses++;
52
        }
53
54
        return $event->result;
55
    }
56
57 View Code Duplication
    public function deleteItem($key)
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...
58
    {
59
        $event = $this->start(__FUNCTION__, $key);
60
61
        try {
62
            return $event->result = parent::deleteItem($key);
63
        } finally {
64
            $event->end = microtime(true);
65
        }
66
    }
67
68 View Code Duplication
    public function save(CacheItemInterface $item)
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...
69
    {
70
        $event = $this->start(__FUNCTION__, $item);
71
72
        try {
73
            return $event->result = parent::save($item);
74
        } finally {
75
            $event->end = microtime(true);
76
        }
77
    }
78
79 View Code Duplication
    public function saveDeferred(CacheItemInterface $item)
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...
80
    {
81
        $event = $this->start(__FUNCTION__, $item);
82
83
        try {
84
            return $event->result = parent::saveDeferred($item);
85
        } finally {
86
            $event->end = microtime(true);
87
        }
88
    }
89
90
    public function getItems(array $keys = [])
91
    {
92
        $event = $this->start(__FUNCTION__, $keys);
93
94
        try {
95
            $result = parent::getItems($keys);
96
        } finally {
97
            $event->end = microtime(true);
98
        }
99
        $f = function () use ($result, $event) {
100
            $event->result = [];
101
            foreach ($result as $key => $item) {
102
                if ($item->isHit()) {
103
                    $event->hits++;
104
                } else {
105
                    $event->misses++;
106
                }
107
                $event->result[$key] = $item->get();
108
                yield $key => $item;
109
            }
110
        };
111
112
        return $f();
113
    }
114
115 View Code Duplication
    public function clear()
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...
116
    {
117
        $event = $this->start(__FUNCTION__);
118
119
        try {
120
            return $event->result = parent::clear();
121
        } finally {
122
            $event->end = microtime(true);
123
        }
124
    }
125
126 View Code Duplication
    public function deleteItems(array $keys)
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...
127
    {
128
        $event = $this->start(__FUNCTION__, $keys);
129
130
        try {
131
            return $event->result = parent::deleteItems($keys);
132
        } finally {
133
            $event->end = microtime(true);
134
        }
135
    }
136
137 View Code Duplication
    public function commit()
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...
138
    {
139
        $event = $this->start(__FUNCTION__);
140
141
        try {
142
            return $event->result = parent::commit();
143
        } finally {
144
            $event->end = microtime(true);
145
        }
146
    }
147
148 View Code Duplication
    public function invalidateTag($tag)
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...
149
    {
150
        $event = $this->start(__FUNCTION__, $tag);
151
152
        try {
153
            return $event->result = parent::invalidateTag($tag);
154
        } finally {
155
            $event->end = microtime(true);
156
        }
157
    }
158
159 View Code Duplication
    public function invalidateTags(array $tags)
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...
160
    {
161
        $event = $this->start(__FUNCTION__, $tags);
162
163
        try {
164
            return $event->result = parent::invalidateTags($tags);
165
        } finally {
166
            $event->end = microtime(true);
167
        }
168
    }
169
170
    public function __getCalls()
171
    {
172
        return $this->__calls;
173
    }
174
175
    public function __setName($name)
176
    {
177
        $this->__name = $name;
178
    }
179
180
    private function start($name, $argument = null)
181
    {
182
        $this->__calls[] = $event = new TraceableAdapterEvent();
183
        $event->name     = $name;
184
        $event->argument = $argument;
185
        $event->start    = microtime(true);
186
187
        return $event;
188
    }
189
}
190