Skip to content

Commit

Permalink
Styles fix
Browse files Browse the repository at this point in the history
  • Loading branch information
galeaspablo committed Nov 29, 2019
1 parent f172efa commit 4a1b26d
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 56 deletions.
5 changes: 1 addition & 4 deletions Model/Builder/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,7 @@ public function getClassName(): string
public function setClassName(string $className): self
{
if (!class_exists($className)) {
throw new \InvalidArgumentException(sprintf(
'Class %s does not exist',
$className
));
throw new \InvalidArgumentException(sprintf('Class %s does not exist', $className));
}
$this->className = $className;

Expand Down
4 changes: 1 addition & 3 deletions Model/Filter/FilterInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,7 @@ public function setInputType(string $inputType): self
private function validate()
{
if (!in_array($this->inputType, self::VALID_INPUT_TYPES)) {
throw new \InvalidArgumentException(sprintf(
'%s is not a valid input type'
), $this->inputType);
throw new \InvalidArgumentException(sprintf('%s is not a valid input type'), $this->inputType);
}
}
}
4 changes: 1 addition & 3 deletions Model/Filter/FilterOperators.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,7 @@ public function clearOperators(): self
private function validateOperator(string $operator)
{
if (!in_array($operator, self::VALID_OPERATORS)) {
throw new \InvalidArgumentException(sprintf(
'%s is not a valid operator'
), $operator);
throw new \InvalidArgumentException(sprintf('%s is not a valid operator'), $operator);
}
}
}
12 changes: 2 additions & 10 deletions Service/JavascriptBuilders.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,21 +258,13 @@ private function validateValueCollectionAgainstInput(FilterValueCollection $coll
in_array($input->getInputType(), FilterInput::INPUT_TYPES_REQUIRE_NO_VALUES) &&
0 !== $collection->getFilterValues()->count()
) {
throw new \LogicException(sprintf(
'Too many values found, While building, Builder with ID %s and Filter with ID %s.',
$builderId,
$filterId
));
throw new \LogicException(sprintf('Too many values found, While building, Builder with ID %s and Filter with ID %s.', $builderId, $filterId));
}
if (
in_array($input->getInputType(), FilterInput::INPUT_TYPES_REQUIRE_MULTIPLE_VALUES) &&
0 === $collection->getFilterValues()->count()
) {
throw new \LogicException(sprintf(
'Not enough values found, While building, Builder with ID %s and Filter with ID %s.',
$builderId,
$filterId
));
throw new \LogicException(sprintf('Not enough values found, While building, Builder with ID %s and Filter with ID %s.', $builderId, $filterId));
}
}

Expand Down
5 changes: 1 addition & 4 deletions Service/JsonQueryParser/DoctrineORMParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,7 @@ public function parseJsonString(string $jsonString, string $entityClassName, arr
private function newParser(string $className)
{
if (!array_key_exists($className, $this->classNameToDoctrineParser)) {
throw new \DomainException(sprintf(
'You have requested a Doctrine Parser for %s, but you have not defined a mapping for it in your configuration',
$className
));
throw new \DomainException(sprintf('You have requested a Doctrine Parser for %s, but you have not defined a mapping for it in your configuration', $className));
}

return $this->classNameToDoctrineParser[$className];
Expand Down
38 changes: 6 additions & 32 deletions Util/Validator/BuildersToMappings.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,12 @@ final public static function validate(array $buildersConfig, array $classesAndMa
{
foreach ($buildersConfig as $builderId => $config) {
if (!array_key_exists('class', $config)) {
throw new \InvalidArgumentException(sprintf(
'Builders Configuration: Expected a class in builder with ID %s',
$builderId
));
throw new \InvalidArgumentException(sprintf('Builders Configuration: Expected a class in builder with ID %s', $builderId));
}
$builderClass = $config['class'];

if (!class_exists($builderClass)) {
throw new \InvalidArgumentException(sprintf(
'Builders Configuration: %s is not a valid class in builder with ID %s ',
$builderClass,
$builderId
));
throw new \InvalidArgumentException(sprintf('Builders Configuration: %s is not a valid class in builder with ID %s ', $builderClass, $builderId));
}

foreach ($config['result_columns'] as $column) {
Expand All @@ -47,32 +40,20 @@ final public static function validate(array $buildersConfig, array $classesAndMa

foreach ($config['filters'] as $filter) {
if (!array_key_exists($filter['id'], $mappingProperties)) {
throw new \InvalidArgumentException(sprintf(
'Builders Configuration: Invalid Mapping for filter with ID %s, in builder with ID %s ',
$filter['id'],
$builderId
));
throw new \InvalidArgumentException(sprintf('Builders Configuration: Invalid Mapping for filter with ID %s, in builder with ID %s ', $filter['id'], $builderId));
}
}

foreach ($config['result_columns'] as $column) {
if (!array_key_exists($column['column_machine_name'], $mappingProperties)) {
throw new \InvalidArgumentException(sprintf(
'Builders Configuration: Result Column with machine name %s, in builder with ID %s, must exist in mapping for class %s ',
$column['column_machine_name'],
$builderId,
$mappingClass
));
throw new \InvalidArgumentException(sprintf('Builders Configuration: Result Column with machine name %s, in builder with ID %s, must exist in mapping for class %s ', $column['column_machine_name'], $builderId, $mappingClass));
}
}
}
}

if (!$mappingClassFoundForBuilderClass) {
throw new \InvalidArgumentException(sprintf(
'Builder with class %s, but no corresponding mapping for this class',
$builderClass
));
throw new \InvalidArgumentException(sprintf('Builder with class %s, but no corresponding mapping for this class', $builderClass));
}
}
}
Expand All @@ -93,14 +74,7 @@ final private static function validateClassHasProperty(string $className, string

if (false === strpos($classProperty, '.')) { // not yet checking associations - Property Accessor can't do this
if (!in_array($classProperty, $properties)) {
throw new \InvalidArgumentException(
sprintf(
'Builder %s Bad Column Declared. Property %s is not accessible in %s.',
$builderId,
$classProperty,
$className
)
);
throw new \InvalidArgumentException(sprintf('Builder %s Bad Column Declared. Property %s is not accessible in %s.', $builderId, $classProperty, $className));
}
}
}
Expand Down

0 comments on commit 4a1b26d

Please sign in to comment.