Issues (85)

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/ValueObject.php (3 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
namespace BestServedCold\PhalueObjects;
4
5
use BestServedCold\PhalueObjects\Contract\ValueObject as ValueObjectInterface;
6
7
/**
8
 * Class ValueObject
9
 *
10
 * @package   BestServedCold\PhalueObjects
11
 * @author    Adam Lewis <[email protected]>
12
 * @copyright Copyright (c) 2015 Best Served Cold Media Limited
13
 * @license   http://http://opensource.org/licenses/GPL-3.0 GPL License
14
 * @link      http://bestservedcold.com
15
 * @since     0.0.1-alpha
16
 * @version   1.0.0
17
 */
18
abstract class ValueObject implements ValueObjectInterface
0 ignored issues
show
ValueObject does not seem to conform to the naming convention (^Abstract|Factory$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
19
{
20
    /**
21
     * @var mixed
22
     */
23
    protected $value;
24
25
    /**
26
     * @var string
27
     */
28
    protected $type;
29
30
    /**
31
     * ValueObject constructor.
32
     *
33
     * @param $value
34
     */
35 200
    public function __construct($value)
36
    {
37 200
        $this->value = $value;
38 200
        $this->type  = gettype($value);
39 200
    }
40
41
    /**
42
     * @return mixed
43
     */
44 171
    public function getValue()
45
    {
46 171
        return $this->value;
47
    }
48
49
    /**
50
     * @param  $field
51
     * @param  $value
52
     * @throws \RuntimeException
53
     * @return void
0 ignored issues
show
Consider making the return type a bit more specific; maybe use NoType.

This check looks for the generic type array as a return type and suggests a more specific type. This type is inferred from the actual code.

Loading history...
54
     */
55 1
    public function __set($field, $value)
56
    {
57 1
        throw new \RuntimeException(
58
            "You cannot set a value of a Value Object, that's the whole point!"
59 1
        );
60
    }
61
62
    /**
63
     * @return string
64
     */
65 31
    public function __toString()
66
    {
67 31
        return method_exists($this, 'toString') ? $this->toString() : (string) $this->getValue();
0 ignored issues
show
The method toString() does not exist on BestServedCold\PhalueObjects\ValueObject. Did you maybe mean __toString()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
68
    }
69
70
    /**
71
     * @return string
72
     */
73
    public function getType()
74
    {
75
        return $this->type;
76
    }
77
78
    /**
79
     * @return string
80
     */
81 1
    public function hash()
82
    {
83 1
        return spl_object_hash($this);
84
    }
85
86
    /**
87
     * @param  ValueObjectInterface $object
88
     * @return bool
89
     */
90 2
    public function equals(ValueObjectInterface $object)
91
    {
92 2
        return $this->getValue() === $object->getValue();
93
    }
94
95
    /**
96
     * @inheritdoc
97
     */
98 190
    public function __destruct()
99
    {
100 190
        $this->value = null;
101 190
    }
102
}
103