Completed
Pull Request — master (#154)
by
unknown
05:50 queued 01:40
created

ProxyFactory::generateMethods()   C

Complexity

Conditions 14
Paths 53

Size

Total Lines 56

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 56
rs 6.2666
c 0
b 0
f 0
cc 14
nc 53
nop 1

How to fix   Long Method    Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\ODM\CouchDB\Proxy;
6
7
use Doctrine\ODM\CouchDB\Mapping\ClassMetadata;
8
use ProxyManager\Proxy\GhostObjectInterface;
9
10
interface ProxyFactory
11
{
12
	/**
13
	 * Never autogenerate a proxy and rely that it was generated by some
14
	 * process before deployment.
15
	 */
16
	public const AUTOGENERATE_NEVER = 0;
17
	/**
18
	 * Always generates a new proxy in every request.
19
	 *
20
	 * This is only sane during development.
21
	 */
22
	public const AUTOGENERATE_ALWAYS = 1;
23
	/**
24
	 * Autogenerate the proxy class when the proxy file does not exist.
25
	 *
26
	 * This strategy causes a file exists call whenever any proxy is used the
27
	 * first time in a request.
28
	 */
29
	public const AUTOGENERATE_FILE_NOT_EXISTS = 2;
30
	/**
31
	 * Generate the proxy classes using eval().
32
	 *
33
	 * This strategy is only sane for development, and even then it gives me
34
	 * the creeps a little.
35
	 */
36
	public const AUTOGENERATE_EVAL = 3;
37
38
	/**
39
	 * @param ClassMetadata[] $classes
40
	 *
41
	 * @return int
42
	 */
43
	public function generateProxyClasses(array $classes) : int;
44
45
	/**
46
	 * Gets a reference proxy instance for the entity of the given type and identified by
47
	 * the given identifier.
48
	 *
49
	 * @param ClassMetadata $metadata
50
	 * @param string $identifier
51
	 *
52
	 * @return GhostObjectInterface
53
	 */
54
	public function getProxy(ClassMetadata $metadata, string $identifier) : GhostObjectInterface;
55
}
56