Minor code cleanup
This commit is contained in:
parent
69de4d2225
commit
17479e2bb5
@ -79,7 +79,7 @@ class ClassBuilder
|
|||||||
}
|
}
|
||||||
foreach ($this->methods as $method) {
|
foreach ($this->methods as $method) {
|
||||||
$lines = explode("\n", $method->getContent());
|
$lines = explode("\n", $method->getContent());
|
||||||
foreach ($lines as $i => $line) {
|
foreach ($lines as $line) {
|
||||||
$body .= ' '.$line."\n";
|
$body .= ' '.$line."\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -136,7 +136,7 @@ public function NAME(array $value = []): CLASS
|
|||||||
if (null === $this->PROPERTY) {
|
if (null === $this->PROPERTY) {
|
||||||
$this->PROPERTY = new CLASS($value);
|
$this->PROPERTY = new CLASS($value);
|
||||||
} elseif ([] !== $value) {
|
} elseif ([] !== $value) {
|
||||||
throw new InvalidConfigurationException(sprintf(\'The node created by "NAME()" has already been initialized. You cannot pass values the second time you call NAME().\'));
|
throw new InvalidConfigurationException(\'The node created by "NAME()" has already been initialized. You cannot pass values the second time you call NAME().\');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->PROPERTY;
|
return $this->PROPERTY;
|
||||||
@ -233,7 +233,7 @@ public function NAME(string $VAR, array $VALUE = []): CLASS
|
|||||||
return $this->PROPERTY[$VAR];
|
return $this->PROPERTY[$VAR];
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new InvalidConfigurationException(sprintf(\'The node created by "NAME()" has already been initialized. You cannot pass values the second time you call NAME().\'));
|
throw new InvalidConfigurationException(\'The node created by "NAME()" has already been initialized. You cannot pass values the second time you call NAME().\');
|
||||||
}';
|
}';
|
||||||
$class->addUse(InvalidConfigurationException::class);
|
$class->addUse(InvalidConfigurationException::class);
|
||||||
$class->addMethod($methodName, $body, ['PROPERTY' => $property->getName(), 'CLASS' => $childClass->getFqcn(), 'VAR' => '' === $key ? 'key' : $key, 'VALUE' => 'value' === $key ? 'data' : 'value']);
|
$class->addMethod($methodName, $body, ['PROPERTY' => $property->getName(), 'CLASS' => $childClass->getFqcn(), 'VAR' => '' === $key ? 'key' : $key, 'VALUE' => 'value' === $key ? 'data' : 'value']);
|
||||||
@ -300,7 +300,7 @@ public function NAME($value): self
|
|||||||
$comment .= ' * '.$info.\PHP_EOL;
|
$comment .= ' * '.$info.\PHP_EOL;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (((array) $node->getExample() ?? []) as $example) {
|
foreach ((array) ($node->getExample() ?? []) as $example) {
|
||||||
$comment .= ' * @example '.$example.\PHP_EOL;
|
$comment .= ' * @example '.$example.\PHP_EOL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -400,7 +400,7 @@ public function NAME(): array
|
|||||||
}
|
}
|
||||||
|
|
||||||
$body .= '
|
$body .= '
|
||||||
if ($value !== []) {
|
if ([] !== $value) {
|
||||||
throw new InvalidConfigurationException(sprintf(\'The following keys are not supported by "%s": \', __CLASS__).implode(\', \', array_keys($value)));
|
throw new InvalidConfigurationException(sprintf(\'The following keys are not supported by "%s": \', __CLASS__).implode(\', \', array_keys($value)));
|
||||||
}';
|
}';
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user