440 |
440 |
|
441 |
441 |
// The following three checks are only done *in an uncached template*, and not needed anymore in the cached version
|
442 |
442 |
$expectedViewHelperArguments = $viewHelper->prepareArguments();
|
443 |
|
$this->abortIfUnregisteredArgumentsExist($expectedViewHelperArguments, $argumentsObjectTree);
|
444 |
|
$this->abortIfRequiredArgumentsAreMissing($expectedViewHelperArguments, $argumentsObjectTree);
|
445 |
|
$this->rewriteBooleanNodesInArgumentsObjectTree($expectedViewHelperArguments, $argumentsObjectTree);
|
|
443 |
$this->abortIfUnregisteredArgumentsExist($expectedViewHelperArguments, $argumentsObjectTree, $namespaceIdentifier, $methodIdentifier,$argumentsObjectTree);
|
|
444 |
$this->abortIfRequiredArgumentsAreMissing($expectedViewHelperArguments, $argumentsObjectTree, $namespaceIdentifier, $methodIdentifier);
|
|
445 |
$this->rewriteBooleanNodesInArgumentsObjectTree($expectedViewHelperArguments, $argumentsObjectTree, $namespaceIdentifier, $methodIdentifier);
|
446 |
446 |
|
447 |
447 |
$currentViewHelperNode = $this->objectManager->create('Tx_Fluid_Core_Parser_SyntaxTree_ViewHelperNode', $viewHelper, $argumentsObjectTree);
|
448 |
448 |
|
... | ... | |
470 |
470 |
*
|
471 |
471 |
* @param array $expectedArguments Array of Tx_Fluid_Core_ViewHelper_ArgumentDefinition of all expected arguments
|
472 |
472 |
* @param array $actualArguments Actual arguments
|
|
473 |
* @param string $namespaceIdentifier Namespace identifier - being looked up in $this->namespaces
|
|
474 |
* @param string $methodIdentifier Method identifier
|
473 |
475 |
* @throws Tx_Fluid_Core_Parser_Exception
|
474 |
476 |
*/
|
475 |
|
protected function abortIfUnregisteredArgumentsExist($expectedArguments, $actualArguments) {
|
|
477 |
protected function abortIfUnregisteredArgumentsExist($expectedArguments, $actualArguments, $namespaceIdentifier, $methodIdentifier) {
|
476 |
478 |
$expectedArgumentNames = array();
|
477 |
479 |
foreach ($expectedArguments as $expectedArgument) {
|
478 |
480 |
$expectedArgumentNames[] = $expectedArgument->getName();
|
... | ... | |
480 |
482 |
|
481 |
483 |
foreach (array_keys($actualArguments) as $argumentName) {
|
482 |
484 |
if (!in_array($argumentName, $expectedArgumentNames)) {
|
483 |
|
throw new Tx_Fluid_Core_Parser_Exception('Argument "' . $argumentName . '" was not registered.', 1237823695);
|
|
485 |
$errorMessage = sprintf('Argument "%s" was not registered for "%s:%s".', $argumentName,$namespaceIdentifier, $methodIdentifier);
|
|
486 |
throw new Tx_Fluid_Core_Parser_Exception($errorMessage, 1322054931);
|
484 |
487 |
}
|
485 |
488 |
}
|
486 |
489 |
}
|
... | ... | |
490 |
493 |
*
|
491 |
494 |
* @param array $expectedArguments Array of Tx_Fluid_Core_ViewHelper_ArgumentDefinition of all expected arguments
|
492 |
495 |
* @param array $actualArguments Actual arguments
|
|
496 |
* @param string $namespaceIdentifier Namespace identifier - being looked up in $this->namespaces
|
|
497 |
* @param string $methodIdentifier Method identifier
|
493 |
498 |
* @throws Tx_Fluid_Core_Parser_Exception
|
494 |
499 |
*/
|
495 |
|
protected function abortIfRequiredArgumentsAreMissing($expectedArguments, $actualArguments) {
|
|
500 |
protected function abortIfRequiredArgumentsAreMissing($expectedArguments, $actualArguments, $namespaceIdentifier, $methodIdentifier) {
|
496 |
501 |
$actualArgumentNames = array_keys($actualArguments);
|
497 |
502 |
foreach ($expectedArguments as $expectedArgument) {
|
498 |
503 |
if ($expectedArgument->isRequired() && !in_array($expectedArgument->getName(), $actualArgumentNames)) {
|
499 |
|
throw new Tx_Fluid_Core_Parser_Exception('Required argument "' . $expectedArgument->getName() . '" was not supplied.', 1237823699);
|
|
504 |
$errorMessage = sprintf('Required argument "%s" was not supplied for "%s:%s".', $expectedArgument->getName(), $namespaceIdentifier, $methodIdentifier);
|
|
505 |
throw new Tx_Fluid_Core_Parser_Exception($errorMessage, 1322054932);
|
500 |
506 |
}
|
501 |
507 |
}
|
502 |
508 |
}
|