Conditions | 1 |
Paths | 1 |
Total Lines | 63 |
Code Lines | 40 |
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 |
||
114 | public static function loadMetadata(Mapping\ClassMetadata $metadata) |
||
115 | { |
||
116 | $fieldMetadata = new Mapping\FieldMetadata('id'); |
||
117 | $fieldMetadata->setType(Type::getType('integer')); |
||
118 | $fieldMetadata->setColumnName('user_id'); |
||
119 | $fieldMetadata->setPrimaryKey(true); |
||
120 | |||
121 | $metadata->addProperty($fieldMetadata); |
||
122 | |||
123 | $fieldMetadata = new Mapping\FieldMetadata('name'); |
||
124 | $fieldMetadata->setType(Type::getType('string')); |
||
125 | $fieldMetadata->setLength(250); |
||
126 | $fieldMetadata->setColumnName('user_name'); |
||
127 | $fieldMetadata->setNullable(true); |
||
128 | $fieldMetadata->setUnique(false); |
||
129 | |||
130 | $metadata->addProperty($fieldMetadata); |
||
131 | |||
132 | $joinColumns = []; |
||
133 | |||
134 | $joinColumn = new Mapping\JoinColumnMetadata(); |
||
135 | |||
136 | $joinColumn->setColumnName('address_id'); |
||
137 | $joinColumn->setReferencedColumnName('id'); |
||
138 | |||
139 | $joinColumns[] = $joinColumn; |
||
140 | |||
141 | $association = new Mapping\ManyToOneAssociationMetadata('address'); |
||
142 | |||
143 | $association->setJoinColumns($joinColumns); |
||
144 | $association->setTargetEntity('DDC964Address'); |
||
145 | $association->setCascade(['persist']); |
||
146 | |||
147 | $metadata->addProperty($association); |
||
148 | |||
149 | $joinTable = new Mapping\JoinTableMetadata(); |
||
150 | $joinTable->setName('ddc964_users_groups'); |
||
151 | |||
152 | $joinColumn = new Mapping\JoinColumnMetadata(); |
||
153 | |||
154 | $joinColumn->setColumnName('user_id'); |
||
155 | $joinColumn->setReferencedColumnName('id'); |
||
156 | |||
157 | $joinTable->addJoinColumn($joinColumn); |
||
158 | |||
159 | $joinColumn = new Mapping\JoinColumnMetadata(); |
||
160 | |||
161 | $joinColumn->setColumnName('group_id'); |
||
162 | $joinColumn->setReferencedColumnName('id'); |
||
163 | |||
164 | $joinTable->addInverseJoinColumn($joinColumn); |
||
165 | |||
166 | $association = new Mapping\ManyToManyAssociationMetadata('groups'); |
||
167 | |||
168 | $association->setJoinTable($joinTable); |
||
169 | $association->setTargetEntity('DDC964Group'); |
||
170 | $association->setInversedBy('users'); |
||
171 | $association->setCascade(['persist']); |
||
172 | |||
173 | $metadata->addProperty($association); |
||
174 | |||
175 | $metadata->setIdGeneratorType(Mapping\GeneratorType::AUTO); |
||
|
|||
176 | } |
||
177 | } |
||
178 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.