| Conditions | 2 |
| Total Lines | 71 |
| 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); |
||
| 29 | public function setup() |
||
| 30 | { |
||
| 31 | try { |
||
| 32 | $this->errors = new ConstraintViolationList(); |
||
| 33 | $this->entity = new class implements EntityInterface |
||
| 34 | { |
||
| 35 | public function getId() |
||
| 36 | { |
||
| 37 | // TODO: Implement getId() method. |
||
| 38 | } |
||
| 39 | |||
| 40 | public static function loadMetadata(DoctrineClassMetaData $metadata): void |
||
| 41 | { |
||
| 42 | // TODO: Implement loadMetadata() method. |
||
| 43 | } |
||
| 44 | |||
| 45 | public static function getPlural(): string |
||
| 46 | { |
||
| 47 | return ''; |
||
| 48 | } |
||
| 49 | |||
| 50 | public static function getSingular(): string |
||
| 51 | { |
||
| 52 | return ''; |
||
| 53 | } |
||
| 54 | |||
| 55 | public static function getIdField(): string |
||
| 56 | { |
||
| 57 | return ''; |
||
| 58 | } |
||
| 59 | |||
| 60 | public function getShortName(): string |
||
| 61 | { |
||
| 62 | return ''; |
||
| 63 | } |
||
| 64 | |||
| 65 | public function __toString(): string |
||
| 66 | { |
||
| 67 | return ''; |
||
| 68 | } |
||
| 69 | |||
| 70 | public static function loadValidatorMetaData(ValidatorClassMetaData $metadata): void |
||
| 71 | { |
||
| 72 | // TODO: Implement loadValidatorMetaData() method. |
||
| 73 | } |
||
| 74 | |||
| 75 | public function injectValidator(EntityValidatorInterface $validator) |
||
| 76 | { |
||
| 77 | // TODO: Implement injectValidator() method. |
||
| 78 | } |
||
| 79 | |||
| 80 | public function isValid(): bool |
||
| 81 | { |
||
| 82 | return false; |
||
| 83 | } |
||
| 84 | |||
| 85 | public function validate() |
||
| 86 | { |
||
| 87 | // TODO: Implement validate() method. |
||
| 88 | } |
||
| 89 | |||
| 90 | public function validateProperty(string $propertyName) |
||
| 91 | { |
||
| 92 | // TODO: Implement validateProperty() method. |
||
| 93 | } |
||
| 94 | |||
| 95 | |||
| 96 | }; |
||
| 97 | throw new ValidationException($this->errors, $this->entity); |
||
| 98 | } catch (ValidationException $e) { |
||
| 99 | $this->exception = $e; |
||
| 100 | } |
||
| 117 |