Issues (14)

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/model/PhpFunction.php (1 issue)

Severity

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
 * Copyright 2011 Johannes M. Schmitt <[email protected]>
4
 *
5
 * Licensed under the Apache License, Version 2.0 (the "License");
6
 * you may not use this file except in compliance with the License.
7
 * You may obtain a copy of the License at
8
 *
9
 * http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
declare(strict_types=1);
18
19
namespace gossi\codegen\model;
20
21
use gossi\codegen\model\parts\BodyPart;
22
use gossi\codegen\model\parts\DocblockPart;
23
use gossi\codegen\model\parts\LongDescriptionPart;
24
use gossi\codegen\model\parts\ParametersPart;
25
use gossi\codegen\model\parts\QualifiedNamePart;
26
use gossi\codegen\model\parts\ReferenceReturnPart;
27
use gossi\codegen\model\parts\TypeDocblockGeneratorPart;
28
use gossi\codegen\model\parts\TypePart;
29
use gossi\docblock\Docblock;
30
use gossi\docblock\tags\ReturnTag;
31
32
/**
33
 * Represents a PHP function.
34
 *
35
 * @author Johannes M. Schmitt <[email protected]>
36
 * @author Thomas Gossmann
37
 * @deprecated Not a structural model. Please refer to https://github.com/gossi/php-code-generator/issues/35 and join the discussion if you really need this
38
 */
39
class PhpFunction extends AbstractModel implements GenerateableInterface, NamespaceInterface, DocblockInterface, RoutineInterface {
40
41
	use BodyPart;
42
	use DocblockPart;
43
	use LongDescriptionPart;
44
	use ParametersPart;
45
	use QualifiedNamePart;
46
	use ReferenceReturnPart;
47
	use TypeDocblockGeneratorPart;
48
	use TypePart;
49
50
// 	/**
51
// 	 * Creates a PHP function from reflection
52
// 	 *
53
// 	 * @deprecated will be removed in version 0.5
54
// 	 * @param \ReflectionFunction $ref
55
// 	 * @return PhpFunction
56
// 	 */
57
// 	public static function fromReflection(\ReflectionFunction $ref) {
58
// 		$function = self::create($ref->name)
59
// 			->setReferenceReturned($ref->returnsReference())
60
// 			->setBody(ReflectionUtils::getFunctionBody($ref));
61
62
// 		$docblock = new Docblock($ref);
63
// 		$function->setDocblock($docblock);
64
// 		$function->setDescription($docblock->getShortDescription());
65
// 		$function->setLongDescription($docblock->getLongDescription());
66
67
// 		foreach ($ref->getParameters() as $refParam) {
68
// 			assert($refParam instanceof \ReflectionParameter); // hmm - assert here?
69
70
// 			$param = PhpParameter::fromReflection($refParam);
71
// 			$function->addParameter($param);
72
// 		}
73
74
// 		return $function;
75
// 	}
76
77
	/**
78
	 * Creates a new PHP function
79
	 *
80
	 * @param string $name qualified name
81
	 * @return static
82
	 */
83 6
	public static function create($name = null) {
84 6
		return new static($name);
0 ignored issues
show
Deprecated Code introduced by
The class gossi\codegen\model\PhpFunction has been deprecated with message: Not a structural model. Please refer to https://github.com/gossi/php-code-generator/issues/35 and join the discussion if you really need this

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
85
	}
86
87
	/**
88
	 * Creates a new PHP function
89
	 *
90
	 * @param string $name qualified name
91
	 */
92 9
	public function __construct($name = null) {
93 9
		$this->setQualifiedName($name);
94 9
		$this->docblock = new Docblock();
95 9
		$this->initParameters();
96 9
	}
97
98
	/**
99
	 * @inheritDoc
100
	 */
101 3
	public function generateDocblock(): void {
102 3
		$docblock = $this->getDocblock();
103 3
		$docblock->setShortDescription($this->getDescription());
104 3
		$docblock->setLongDescription($this->getLongDescription());
105
106
		// return tag
107 3
		$this->generateTypeTag(new ReturnTag());
108
109
		// param tags
110 3
		$this->generateParamDocblock();
111 3
	}
112
}
113