Issues (37)

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.

Exception/NotFoundException.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
 * This file is part of the Cubiche package.
4
 *
5
 * Copyright (c) Cubiche
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Cubiche\Core\Bus\Exception;
12
13
use RuntimeException;
14
use Exception;
15
16
/**
17
 * NotFoundException class.
18
 *
19
 * @author Ivannis Suárez Jerez <[email protected]>
20
 */
21
class NotFoundException extends RuntimeException
22
{
23
    /**
24
     * Creates an exception for a not found message name, method name or handler for a given message.
25
     *
26
     * @param string         $type
27
     * @param mixed          $message
28
     * @param int            $code
29
     * @param Exception|null $cause
30
     *
31
     * @return NotFoundException
32
     */
33 View Code Duplication
    protected static function notFound($type, $message, $code = 0, Exception $cause = null)
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...
34
    {
35
        return new static(sprintf(
36
            'Not found a %s for a given object of type %s',
37
            $type,
38
            is_object($message) ? get_class($message) : gettype($message)
39
        ), $code, $cause);
40
    }
41
42
    /**
43
     * @param mixed          $object
44
     * @param Exception|null $cause
45
     *
46
     * @return NotFoundException
47
     */
48
    public static function nameOfMessage($object, Exception $cause = null)
49
    {
50
        return self::notFound('name of message', $object, 1, $cause);
51
    }
52
53
    /**
54
     * @param mixed          $object
55
     * @param Exception|null $cause
56
     *
57
     * @return NotFoundException
58
     */
59
    public static function nameOfCommand($object, Exception $cause = null)
60
    {
61
        return self::notFound('name of command', $object, 2, $cause);
62
    }
63
64
    /**
65
     * @param mixed          $object
66
     * @param Exception|null $cause
67
     *
68
     * @return NotFoundException
69
     */
70
    public static function handlerMethodNameForObject($object, Exception $cause = null)
71
    {
72
        return self::notFound('handler method name', $object, 3, $cause);
73
    }
74
75
    /**
76
     * @param mixed          $object
77
     * @param Exception|null $cause
78
     *
79
     * @return NotFoundException
80
     */
81
    public static function nameOfQuery($object, Exception $cause = null)
82
    {
83
        return self::notFound('name of query', $object, 4, $cause);
84
    }
85
86
    /**
87
     * @param string         $messageName
88
     * @param Exception|null $cause
89
     *
90
     * @return NotFoundException
91
     */
92
    public static function handlerFor($messageName, Exception $cause = null)
93
    {
94
        return new static(sprintf(
95
            'Not found a handler for a given message named %s',
96
            $messageName
97
        ), 5, $cause);
98
    }
99
100
    /**
101
     * Creates an exception for a not found middleware.
102
     *
103
     * @param string         $type
104
     * @param Exception|null $cause
105
     *
106
     * @return NotFoundException
107
     */
108
    public static function middlewareOfType($type, Exception $cause = null)
109
    {
110
        return new static(sprintf(
111
            'Not found a middleware of type %s',
112
            $type
113
        ), 6, $cause);
114
    }
115
116
    /**
117
     * @param mixed          $object
118
     * @param string         $method
119
     * @param Exception|null $cause
120
     *
121
     * @return NotFoundException
122
     */
123
    public static function methodForObject($object, $method, Exception $cause = null)
124
    {
125
        return self::notFound('method with name `'.$method.'`', $object, 7, $cause);
126
    }
127
}
128