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/UnicomponentServiceManager.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
 * Created by PhpStorm.
4
 * User: reallyli
5
 * Date: 18/10/11
6
 * Time: 上午10:37.
7
 */
8
9
namespace Reallyli\LaravelUnicomponent;
10
11
class UnicomponentServiceManager
12
{
13
    /**
14
     * @var array
15
     */
16
    private $servicesComponents = [];
17
18
    /**
19
     * @var mixed
20
     */
21
    private $config;
22
23
    /**
24
     * Construct.
25
     *
26
     * @author reallyli <[email protected]>
27
     * @since 18/10/11
28
     * @param mixed $config
29
     * @return void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
30
     * 返回值类型:string,array,object,mixed(多种,不确定的),void(无返回值)
31
     */
32
    public function __construct($config)
33
    {
34
        $this->config = $config;
35
        $this->registerDefaultComponent();
36
    }
37
38
    /**
39
     * Method description:registerComponent.
40
     *
41
     * @author reallyli <[email protected]>
42
     * @since 18/10/11
43
     * @param UnicomponentServiceInterface $service
44
     * @return mixed
45
     * 返回值类型:string,array,object,mixed(多种,不确定的),void(无返回值)
46
     */
47
    public function registerComponent(UnicomponentServiceInterface $service)
48
    {
49
        $serviceProvider = $service->provider();
50
51
        $this->setServiceComponents($service->alias(), new $serviceProvider);
52
    }
53
54
    /**
55
     * Method description:registerDefaultComponent.
56
     *
57
     * @author reallyli <[email protected]>
58
     * @since 18/10/11
59
     * @return void
60
     * 返回值类型:string,array,object,mixed(多种,不确定的),void(无返回值)
61
     */
62
    public function registerDefaultComponent()
63
    {
64
        if (! $this->config) {
65
            return;
66
        }
67
68
        foreach ($this->config['components'] as $component) {
69
            $this->registerComponent(new $component['provider']);
70
        }
71
    }
72
73
    /**
74
     * Method description:setServiceInstance.
75
     *
76
     * @author reallyli <[email protected]>
77
     * @since 18/10/11
78
     * @param $alias
79
     * @param $instance
80
     * @return mixed
81
     * 返回值类型:string,array,object,mixed(多种,不确定的),void(无返回值)
82
     */
83
    protected function setServiceComponents($alias, $instance)
84
    {
85
        if (! array_key_exists($alias, $this->getServiceComponents())) {
86
            $this->servicesComponents[$alias] = $instance;
87
        }
88
89
        return $this->servicesComponents;
90
    }
91
92
    /**
93
     * Method description:getServices.
94
     *
95
     * @author reallyli <[email protected]>
96
     * @since 18/10/11
97
     * @return mixed
98
     * 返回值类型:string,array,object,mixed(多种,不确定的),void(无返回值)
99
     */
100
    public function getServiceComponents()
101
    {
102
        return $this->servicesComponents;
103
    }
104
105
    /**
106
     * Method description:getServiceComponent.
107
     *
108
     * @author reallyli <[email protected]>
109
     * @since 18/10/11
110
     * @param $serviceAlias
111
     * @return mixed
112
     * 返回值类型:string,array,object,mixed(多种,不确定的),void(无返回值)
113
     */
114
    public function getServiceComponent($serviceAlias)
115
    {
116
        return $this->getServiceComponents()[$serviceAlias] ?? null;
117
    }
118
119
    /**
120
     * Method description:__call.
121
     *
122
     * @author reallyli <[email protected]>
123
     * @since 18/10/11
124
     * @param string $method
125
     * @param array $parameters
126
     * @return mixed
127
     * 返回值类型:string,array,object,mixed(多种,不确定的),void(无返回值)
128
     */
129
    public function __call(string $method, array $parameters)
130
    {
131
        return $this->getServiceComponent($method);
132
    }
133
134
    /**
135
     * Method description:__get.
136
     *
137
     * @author reallyli <[email protected]>
138
     * @since 2018/11/20
139
     * @param string $componentName
140
     * @return mixed
141
     */
142
    public function __get(string $componentName)
143
    {
144
        return $this->getServiceComponent($componentName);
145
    }
146
}
147