Issues (12)

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/ClassGeneration/DocBlock.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
/*
4
 * This file is part of the ClassGeneration package.
5
 *
6
 * (c) Antonio Spinelli <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace ClassGeneration;
13
14
use ClassGeneration\DocBlock\TagCollection;
15
use ClassGeneration\DocBlock\TagCollectionInterface;
16
use ClassGeneration\DocBlock\TagInterface;
17
use ClassGeneration\Element\ElementAbstract;
18
19
/**
20
 * DocBlock ClassGeneration
21
 * @author Antonio Spinelli <[email protected]>
22
 */
23
class DocBlock extends ElementAbstract implements DocBlockInterface
24
{
25
26
    /**
27
     * DockBlock description.
28
     * @var string
29
     */
30
    protected $description;
31
32
    /**
33
     * List of allowed tags.
34
     * @var TagCollectionInterface
35
     */
36
    protected $tagCollection;
37
38
    /**
39
     * {@inheritdoc}
40
     */
41 99
    public function init()
42
    {
43 99
        $this->setTagCollection(new TagCollection());
44 99
    }
45
46
    /**
47
     * {@inheritdoc}
48
     */
49 36
    public function getDescription()
50
    {
51 36
        return $this->description;
52
    }
53
54
    /**
55
     * {@inheritdoc}
56
     */
57 32
    public function setDescription($description)
58
    {
59 32
        $this->description = $description;
60
61 32
        return $this;
62
    }
63
64
    /**
65
     * {@inheritdoc}
66
     */
67 31
    public function getTagCollection()
68
    {
69 31
        return $this->tagCollection;
70
    }
71
72
    /**
73
     * {@inheritdoc}
74
     */
75 99
    public function setTagCollection(TagCollectionInterface $tagCollection)
76
    {
77 99
        $this->tagCollection = $tagCollection;
78
79 99
        return $this;
80
    }
81
82
    /**
83
     * Add a docblock tag.
84
     *
85
     * @param TagInterface $tag
86
     *
87
     * @return DocBlock
88
     */
89 14
    public function addTag(TagInterface $tag)
90
    {
91 14
        $this->getTagCollection()->add($tag);
92
93 14
        return $this;
94
    }
95
96
    /**
97
     * Removes tags by name.
98
     *
99
     * @param string|array $tagName
100
     *
101
     * @return TagCollection
102
     */
103 1
    public function removeTagsByName($tagName)
104 1
    {
105 1
        return $this->getTagCollection()->removeByName($tagName);
106
    }
107
108
    /**
109
     * Removes tags by reference.
110
     *
111
     * @param string $reference
112
     *
113
     * @return TagCollection
114
     */
115 1
    public function removeTagsByReference($reference)
116
    {
117 1
        return $this->getTagCollection()->removeByReferece($reference);
0 ignored issues
show
$reference is of type string, but the function expects a object<ClassGeneration\Element\ElementInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
118
    }
119
120
    /**
121
     * Gets tags by name.
122
     *
123
     * @param string $tagName
124
     *
125
     * @return TagCollectionInterface
126
     */
127 2
    public function getTagsByName($tagName)
128
    {
129 2
        $foundList = $this->getTagCollection()->getByName($tagName);
130
131 2
        return $foundList;
132
    }
133
134
    /**
135
     * @{inheritdoc}
136
     */
137 24
    public function toString()
138
    {
139 24
        if ($this->getTagCollection()->count() == 0
140 24
            && ($this->getDescription() === null || $this->getDescription() === '')
141 24
        ) {
142 13
            return PHP_EOL;
143
        }
144
145 20
        $spaces = $this->getTabulationFormatted();
146
        $block = PHP_EOL
147 20
            . $spaces . '/**' . PHP_EOL
148 20
            . $spaces . ' * ' . $this->getDescription() . PHP_EOL
149 20
            . preg_replace('/\s\*\s/i', $spaces . ' * ', $this->getTagCollection()->toString());
150
151 20
        return $block . $spaces . ' */' . PHP_EOL;
152
    }
153
}
154