*/
class SimpleHandler extends Handler {
public function execute() {
- $params = array_values( $this->getRequest()->getPathParams() );
+ $paramSettings = $this->getParamSettings();
+ $validatedParams = $this->getValidatedParams();
+ $unvalidatedParams = [];
+ $params = [];
+ foreach ( $this->getRequest()->getPathParams() as $name => $value ) {
+ $source = $paramSettings[$name][self::PARAM_SOURCE] ?? 'unknown';
+ if ( $source !== 'path' ) {
+ $unvalidatedParams[] = $name;
+ $params[] = $value;
+ } else {
+ $params[] = $validatedParams[$name];
+ }
+ }
+
+ if ( $unvalidatedParams ) {
+ throw new \LogicException(
+ 'Path parameters were not validated: ' . implode( ', ', $unvalidatedParams )
+ );
+ }
+
// @phan-suppress-next-line PhanUndeclaredMethod
return $this->run( ...$params );
}