Skip to content

Commit

Permalink
TASK: Unify exception codes in AbstractTemplateView.php
Browse files Browse the repository at this point in the history
Exception codes are supposed to be unique, so this makes
sure those four places get a code of their own.
  • Loading branch information
kdambekalns authored Nov 7, 2024
1 parent 8f2b430 commit 7091f57
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Neos.FluidAdaptor/Classes/View/AbstractTemplateView.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,15 +216,15 @@ protected function validateOptions(array $options)
{
// check for options given but not supported
if (($unsupportedOptions = array_diff_key($options, $this->supportedOptions)) !== []) {
throw new Exception(sprintf('The view options "%s" you\'re trying to set don\'t exist in class "%s".', implode(',', array_keys($unsupportedOptions)), get_class($this)), 1359625876);
throw new Exception(sprintf('The view options "%s" you\'re trying to set don\'t exist in class "%s".', implode(',', array_keys($unsupportedOptions)), get_class($this)), 1359625880);
}

// check for required options being set
array_walk(
$this->supportedOptions,
function ($supportedOptionData, $supportedOptionName, $options) {
if (isset($supportedOptionData[3]) && !array_key_exists($supportedOptionName, $options)) {
throw new Exception('Required view option not set: ' . $supportedOptionName, 1359625876);
throw new Exception('Required view option not set: ' . $supportedOptionName, 1359625881);
}
},
$options
Expand Down Expand Up @@ -261,7 +261,7 @@ function ($value) {
public function getOption($optionName)
{
if (!array_key_exists($optionName, $this->supportedOptions)) {
throw new \Neos\Flow\Mvc\Exception(sprintf('The view option "%s" you\'re trying to get doesn\'t exist in class "%s".', $optionName, get_class($this)), 1359625876);
throw new \Neos\Flow\Mvc\Exception(sprintf('The view option "%s" you\'re trying to get doesn\'t exist in class "%s".', $optionName, get_class($this)), 1359625882);
}

return $this->options[$optionName];
Expand All @@ -278,7 +278,7 @@ public function getOption($optionName)
public function setOption($optionName, $value)
{
if (!array_key_exists($optionName, $this->supportedOptions)) {
throw new \Neos\Flow\Mvc\Exception(sprintf('The view option "%s" you\'re trying to set doesn\'t exist in class "%s".', $optionName, get_class($this)), 1359625876);
throw new \Neos\Flow\Mvc\Exception(sprintf('The view option "%s" you\'re trying to set doesn\'t exist in class "%s".', $optionName, get_class($this)), 1359625883);
}

$this->options[$optionName] = $value;
Expand Down

0 comments on commit 7091f57

Please sign in to comment.