Conditions | 1 |
Total Lines | 59 |
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); |
||
104 | public function thereCanBeMultipleOfTheSameArchetypeInAnEntity(): void |
||
105 | { |
||
106 | $priceTraitFqn = $this->getArchetypeEmbeddableGenerator() |
||
107 | ->setPathToProjectRoot(self::WORK_DIR) |
||
108 | ->setProjectRootNamespace(self::TEST_PROJECT_ROOT_NAMESPACE) |
||
109 | ->createFromArchetype( |
||
110 | MoneyEmbeddable::class, |
||
111 | 'PriceEmbeddable' |
||
112 | ); |
||
113 | $this->getEntityEmbeddableSetter() |
||
114 | ->setPathToProjectRoot(self::WORK_DIR) |
||
115 | ->setProjectRootNamespace(self::TEST_PROJECT_ROOT_NAMESPACE) |
||
116 | ->setEntityHasEmbeddable(self::TEST_ENTITY, $priceTraitFqn); |
||
117 | $this->copyAndSetEntityFqn(); |
||
118 | $this->recreateDtos(); |
||
119 | $entity = $this->createEntity($this->entityFqn); |
||
120 | $entity->update( |
||
121 | new class($this->entityFqn, $entity->getId()) extends AbstractEntityUpdateDto |
||
122 | { |
||
123 | public function getMoneyEmbeddable(): MoneyEmbeddableInterface |
||
124 | { |
||
125 | return new MoneyEmbeddable( |
||
126 | new Money( |
||
127 | 100, |
||
128 | new Currency(MoneyEmbeddableInterface::DEFAULT_CURRENCY_CODE) |
||
129 | ) |
||
130 | ); |
||
131 | } |
||
132 | } |
||
133 | |||
134 | ); |
||
135 | $entity->update( |
||
136 | new class($this->entityFqn, $entity->getId()) extends AbstractEntityUpdateDto |
||
137 | { |
||
138 | public function getPriceEmbeddable() |
||
139 | { |
||
140 | return new PriceEmbeddable( |
||
141 | new Money( |
||
142 | 200, |
||
143 | new Currency(MoneyEmbeddableInterface::DEFAULT_CURRENCY_CODE) |
||
144 | ) |
||
145 | ); |
||
146 | } |
||
147 | } |
||
148 | |||
149 | ); |
||
150 | $this->getEntitySaver()->save($entity); |
||
151 | |||
152 | /** |
||
153 | * @var AbstractEntityRepository $repo |
||
154 | */ |
||
155 | $repo = $this->getRepositoryFactory()->getRepository($this->entityFqn); |
||
156 | $loaded = $repo->findAll()[0]; |
||
157 | $expected = '100'; |
||
158 | $actual = $loaded->getMoneyEmbeddable()->getMoney()->getAmount(); |
||
159 | self::assertSame($expected, $actual); |
||
160 | $expected = '200'; |
||
161 | $actual = $loaded->getPriceEmbeddable()->getMoney()->getAmount(); |
||
162 | self::assertSame($expected, $actual); |
||
163 | } |
||
165 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths