Conditions | 2 |
Total Lines | 106 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
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:
If many parameters/temporary variables are present:
1 | <?php declare(strict_types=1); |
||
34 | public function setup() |
||
35 | { |
||
36 | try { |
||
37 | $this->errors = new ConstraintViolationList(); |
||
38 | $this->entity = new class implements EntityInterface |
||
39 | { |
||
40 | public function getId() |
||
41 | { |
||
42 | return; |
||
43 | } |
||
44 | |||
45 | public static function loadMetadata(DoctrineClassMetaData $metadata): void |
||
46 | { |
||
47 | return; |
||
48 | } |
||
49 | |||
50 | public static function getPlural(): string |
||
51 | { |
||
52 | return ''; |
||
53 | } |
||
54 | |||
55 | public static function getSingular(): string |
||
56 | { |
||
57 | return ''; |
||
58 | } |
||
59 | |||
60 | public static function getIdField(): string |
||
61 | { |
||
62 | return ''; |
||
63 | } |
||
64 | |||
65 | public function getShortName(): string |
||
66 | { |
||
67 | return ''; |
||
68 | } |
||
69 | |||
70 | public function debug(int $level = 0): string |
||
71 | { |
||
72 | return ''; |
||
73 | } |
||
74 | |||
75 | public static function loadValidatorMetaData(ValidatorClassMetaData $metadata): void |
||
76 | { |
||
77 | return; |
||
78 | } |
||
79 | |||
80 | public function injectValidator(EntityValidatorInterface $validator) |
||
81 | { |
||
82 | return; |
||
83 | } |
||
84 | |||
85 | public function isValid(): bool |
||
86 | { |
||
87 | return false; |
||
88 | } |
||
89 | |||
90 | public function validate() |
||
91 | { |
||
92 | return; |
||
93 | } |
||
94 | |||
95 | public function validateProperty(string $propertyName) |
||
96 | { |
||
97 | return; |
||
98 | } |
||
99 | |||
100 | |||
101 | /** |
||
102 | * Adds a listener that wants to be notified about property changes. |
||
103 | * |
||
104 | * @param PropertyChangedListener $listener |
||
105 | * |
||
106 | * @return void |
||
107 | */ |
||
108 | public function addPropertyChangedListener(PropertyChangedListener $listener): void |
||
109 | { |
||
110 | return; |
||
111 | } |
||
112 | |||
113 | public function getGetters(): array |
||
114 | { |
||
115 | return []; |
||
116 | } |
||
117 | |||
118 | public function getSetters(): array |
||
119 | { |
||
120 | return []; |
||
121 | } |
||
122 | |||
123 | public function notifyEmbeddablePrefixedProperties( |
||
124 | string $embeddablePropertyName, |
||
125 | ?string $propName = null, |
||
126 | $oldValue = null, |
||
127 | $newValue = null |
||
128 | ): void { |
||
129 | return; |
||
130 | } |
||
131 | |||
132 | public function ensureMetaDataIsSet(EntityManagerInterface $entityManager): void |
||
133 | { |
||
134 | return; |
||
135 | } |
||
136 | }; |
||
137 | throw new ValidationException($this->errors, $this->entity); |
||
138 | } catch (ValidationException $e) { |
||
139 | $this->exception = $e; |
||
140 | } |
||
157 |