Issues (2)

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/UK/DynamicProperties/ExplicitGetterSetter.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
 * @author         UniKado <[email protected]>
4
 * @copyright  (c) 2016, UniKado
5
 * @package        UK\DynamicProperties;
6
 * @since          2016-04-01
7
 * @version        0.1.0-dev (Tata43)
8
 */
9
10
11
declare( strict_types = 1 );
12
13
14
namespace UK\DynamicProperties;
15
16
17
/**
18
 * If you extend you're class from this class, you're class becomes a automatic working magic get + set method for
19
 * read + write accessing the values of all available getXyz + setXyz methods by dynamic properties.
20
 *
21
 * For example: If you're class defines the two public get methods 'getFoo()' and 'getFooBar()' and the public
22
 * set method 'setFooBar( $value ) you can also access it with the dynamic properties
23
 * $instance->foo [is readonly] and $instance->fooBar [read + write].
24
 *
25
 * But do'nt forget to document you're dyn. class properties with the @ property annotation
26
 *
27
 * @since v0.1.0-dev (Tata43)
28
 */
29
abstract class ExplicitGetterSetter extends ExplicitGetter
30
{
31
32
33
   // <editor-fold desc="// = = = =   P R O T E C T E D   F I E L D S   = = = = = = = = = = = = = = = = = = = = = = =">
34
35
   /**
36
    * The names of all set* methods (without the leading set) that should not be mapped as dynamic properties
37
    *
38
    * @type array
39
    */
40
   protected $ignoreSetProperties = [];
41
42
   // </editor-fold>
43
44
45
   // <editor-fold desc="// = = = =   P U B L I C   M E T H O D S   = = = = = = = = = = = = = = = = = = = = = = = = =">
46
47
   /**
48
    * The magic set method to let you access all setter methods by dynamic properties.
49
    *
50
    * @param  string $name    The name of the dynamic property.
51
    * @param  mixed  $value   The value to set.
52
    * @throws \LogicException Is thrown if the property does not exist or if writing is requested but not allowed.
53
    */
54 4
   public function __set( string $name, $value )
55
   {
56
57 4
      if ( ! $this->hasWritableProperty( $name, $setterName ) )
58
      {
59 1
         throw new \LogicException( 'No such property: ' . __CLASS__ . '::$' . $name. '!' );
60
      }
61
62 3
      $this->$setterName( $value );
63
64 3
   }
65
66
   /**
67
    * Magic isset implementation.
68
    *
69
    * @param  string $name The name of the required property.
70
    * @return boolean
71
    */
72 3
   public function __isset( string $name )
73
   {
74
75 3
      if ( $this->hasWritableProperty( $name, $setterName ) )
76
      {
77 2
         return true;
78
      }
79
80 1
      return parent::__isset( $name );
81
82
   }
83
84
   /**
85
    * Returns, if a property with the defined name exists for write access.
86
    *
87
    * @param  string $name       The name of the property.
88
    * @param  string $setterName Returns the name of the associated set method, if method returns TRUE.
89
    * @return boolean
90
    */
91 4 View Code Duplication
   public function hasWritableProperty( string $name, &$setterName ) : bool
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...
92
   {
93
94 4
      if ( \in_array( $name, $this->ignoreSetProperties ) )
95
      {
96
         return false;
97
      }
98
99 4
      $setterName = 'set' . \ucfirst( $name );
100
101 4
      return \method_exists( $this, $setterName );
102
103
   }
104
105
   // </editor-fold>
106
107
108
}
109
110