Skip to content

Commit

Permalink
refact: modified parameter names and used exception code
Browse files Browse the repository at this point in the history
  • Loading branch information
Gyula Szucs committed Jan 11, 2022
1 parent a1fbd2c commit 4a39d40
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 28 deletions.
8 changes: 4 additions & 4 deletions src/Serializer/LineItem/LineItemCollectionSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ class LineItemCollectionSerializer implements LineItemCollectionSerializerInterf
private $jsonSerializer;

public function __construct(
?LineItemFactoryInterface $factory = null,
?LineItemFactoryInterface $lineItemFactory = null,
?JsonSerializerInterface $jsonSerializer = null
) {
$this->lineItemFactory = $factory ?? new LineItemFactory();
$this->lineItemFactory = $lineItemFactory ?? new LineItemFactory();
$this->jsonSerializer = $jsonSerializer ?? new JsonSerializer();
}

Expand All @@ -58,7 +58,7 @@ public function serialize(LineItemCollectionInterface $collection): string
} catch (RuntimeException $exception) {
throw new LtiException(
sprintf('Error during line item collection serialization: %s', $exception->getMessage()),
0,
$exception->getCode(),
$exception
);
}
Expand All @@ -74,7 +74,7 @@ public function deserialize(string $data): LineItemCollectionInterface
} catch (RuntimeException $exception) {
throw new LtiException(
sprintf('Error during line item collection deserialization: %s', $exception->getMessage()),
0,
$exception->getCode(),
$exception
);
}
Expand Down
8 changes: 4 additions & 4 deletions src/Serializer/LineItem/LineItemContainerSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ class LineItemContainerSerializer implements LineItemContainerSerializerInterfac
private $jsonSerializer;

public function __construct(
?LineItemFactoryInterface $factory = null,
?LineItemFactoryInterface $lineItemFactory = null,
?JsonSerializerInterface $jsonSerializer = null
) {
$this->lineItemFactory = $factory ?? new LineItemFactory();
$this->lineItemFactory = $lineItemFactory ?? new LineItemFactory();
$this->jsonSerializer = $jsonSerializer ?? new JsonSerializer();
}

Expand All @@ -59,7 +59,7 @@ public function serialize(LineItemContainerInterface $container): string
} catch (RuntimeException $exception) {
throw new LtiException(
sprintf('Error during line item container serialization: %s', $exception->getMessage()),
0,
$exception->getCode(),
$exception
);
}
Expand All @@ -75,7 +75,7 @@ public function deserialize(string $data): LineItemContainerInterface
} catch (RuntimeException $exception) {
throw new LtiException(
sprintf('Error during line item container deserialization: %s', $exception->getMessage()),
0,
$exception->getCode(),
$exception
);
}
Expand Down
8 changes: 4 additions & 4 deletions src/Serializer/LineItem/LineItemSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ class LineItemSerializer implements LineItemSerializerInterface
private $jsonSerializer;

public function __construct(
?LineItemFactoryInterface $factory = null,
?LineItemFactoryInterface $lineItemFactory = null,
?JsonSerializerInterface $jsonSerializer = null
) {
$this->lineItemFactory = $factory ?? new LineItemFactory();
$this->lineItemFactory = $lineItemFactory ?? new LineItemFactory();
$this->jsonSerializer = $jsonSerializer ?? new JsonSerializer();
}

Expand All @@ -57,7 +57,7 @@ public function serialize(LineItemInterface $lineItem): string
} catch (RuntimeException $exception) {
throw new LtiException(
sprintf('Error during line item serialization: %s', $exception->getMessage()),
0,
$exception->getCode(),
$exception
);
}
Expand All @@ -73,7 +73,7 @@ public function deserialize(string $data): LineItemInterface
} catch (RuntimeException $exception) {
throw new LtiException(
sprintf('Error during line item deserialization: %s', $exception->getMessage()),
0,
$exception->getCode(),
$exception
);
}
Expand Down
8 changes: 4 additions & 4 deletions src/Serializer/Result/ResultCollectionSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ class ResultCollectionSerializer implements ResultCollectionSerializerInterface
private $jsonSerializer;

public function __construct(
?ResultFactoryInterface $factory = null,
?ResultFactoryInterface $resultFactory = null,
?JsonSerializerInterface $jsonSerializer = null
) {
$this->resultFactory = $factory ?? new ResultFactory();
$this->resultFactory = $resultFactory ?? new ResultFactory();
$this->jsonSerializer = $jsonSerializer ?? new JsonSerializer();
}

Expand All @@ -58,7 +58,7 @@ public function serialize(ResultCollectionInterface $collection): string
} catch (RuntimeException $exception) {
throw new LtiException(
sprintf('Error during result collection serialization: %s', $exception->getMessage()),
0,
$exception->getCode(),
$exception
);
}
Expand All @@ -74,7 +74,7 @@ public function deserialize(string $data): ResultCollectionInterface
} catch (RuntimeException $exception) {
throw new LtiException(
sprintf('Error during result collection deserialization: %s', $exception->getMessage()),
0,
$exception->getCode(),
$exception
);
}
Expand Down
8 changes: 4 additions & 4 deletions src/Serializer/Result/ResultContainerSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ class ResultContainerSerializer implements ResultContainerSerializerInterface
private $jsonSerializer;

public function __construct(
?ResultFactoryInterface $factory = null,
?ResultFactoryInterface $resultFactory = null,
?JsonSerializerInterface $jsonSerializer = null
) {
$this->resultFactory = $factory ?? new ResultFactory();
$this->resultFactory = $resultFactory ?? new ResultFactory();
$this->jsonSerializer = $jsonSerializer ?? new JsonSerializer();
}

Expand All @@ -59,7 +59,7 @@ public function serialize(ResultContainerInterface $container): string
} catch (RuntimeException $exception) {
throw new LtiException(
sprintf('Error during result container serialization: %s', $exception->getMessage()),
0,
$exception->getCode(),
$exception
);
}
Expand All @@ -75,7 +75,7 @@ public function deserialize(string $data): ResultContainerInterface
} catch (RuntimeException $exception) {
throw new LtiException(
sprintf('Error during result container deserialization: %s', $exception->getMessage()),
0,
$exception->getCode(),
$exception
);
}
Expand Down
8 changes: 4 additions & 4 deletions src/Serializer/Result/ResultSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ class ResultSerializer implements ResultSerializerInterface
private $jsonSerializer;

public function __construct(
?ResultFactoryInterface $factory = null,
?ResultFactoryInterface $resultFactory = null,
?JsonSerializerInterface $jsonSerializer = null
) {
$this->resultFactory = $factory ?? new ResultFactory();
$this->resultFactory = $resultFactory ?? new ResultFactory();
$this->jsonSerializer = $jsonSerializer ?? new JsonSerializer();
}

Expand All @@ -57,7 +57,7 @@ public function serialize(ResultInterface $result): string
} catch (RuntimeException $exception) {
throw new LtiException(
sprintf('Error during result serialization: %s', $exception->getMessage()),
0,
$exception->getCode(),
$exception
);
}
Expand All @@ -73,7 +73,7 @@ public function deserialize(string $data): ResultInterface
} catch (RuntimeException $exception) {
throw new LtiException(
sprintf('Error during result deserialization: %s', $exception->getMessage()),
0,
$exception->getCode(),
$exception
);
}
Expand Down
8 changes: 4 additions & 4 deletions src/Serializer/Score/ScoreSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ class ScoreSerializer implements ScoreSerializerInterface
private $jsonSerializer;

public function __construct(
?ScoreFactoryInterface $factory = null,
?ScoreFactoryInterface $scoreFactory = null,
?JsonSerializerInterface $jsonSerializer = null
) {
$this->scoreFactory = $factory ?? new ScoreFactory();
$this->scoreFactory = $scoreFactory ?? new ScoreFactory();
$this->jsonSerializer = $jsonSerializer ?? new JsonSerializer();
}

Expand All @@ -57,7 +57,7 @@ public function serialize(ScoreInterface $score): string
} catch (RuntimeException $exception) {
throw new LtiException(
sprintf('Error during score serialization: %s', $exception->getMessage()),
0,
$exception->getCode(),
$exception
);
}
Expand All @@ -73,7 +73,7 @@ public function deserialize(string $data): ScoreInterface
} catch (RuntimeException $exception) {
throw new LtiException(
sprintf('Error during score deserialization: %s', $exception->getMessage()),
0,
$exception->getCode(),
$exception
);
}
Expand Down

0 comments on commit 4a39d40

Please sign in to comment.