You are here

protected function RESTServer::checkNumberOfArguments in Services 7.3

Count possible numbers of 'path' arguments of the method.

1 call to RESTServer::checkNumberOfArguments()
RESTServer::resolveController in servers/rest_server/includes/RESTServer.inc
Determine controller.

File

servers/rest_server/includes/RESTServer.inc, line 630
Class for handling REST calls.

Class

RESTServer
@file Class for handling REST calls.

Code

protected function checkNumberOfArguments($args_number, $resource_operation, $required_args = 0) {
  $not_required_args = 0;
  if (isset($resource_operation['args'])) {
    foreach ($resource_operation['args'] as $argument) {
      if (isset($argument['source']) && is_array($argument['source']) && isset($argument['source']['path'])) {
        if (!empty($argument['optional'])) {
          $not_required_args++;
        }
        else {
          $required_args++;
        }
      }
    }
  }
  return $args_number >= $required_args && $args_number <= $required_args + $not_required_args;
}