Process method params.

@param array $method method
@param string $file file
@param string $name name

@return void
962315
protected function processMethodParams(array $method, string $file, string $name)
    {
        if (!empty($method['docblock']['inheritdoc'])) {
            return;
        }

        foreach ($method['params'] as $param => $type) {
            if (is_array($type)) {
                $type = implode('|', $type);
            }

            if (!isset($method['docblock']['params'][$param])) {
                $this->warnings[] = [
                    'type' => 'param-missing',
                    'file' => $file,
                    'class' => $name,
                    'method' => $name,
                    'line' => $method['line'],
                    'param' => $param,
                ];

                return;
            }

            if (empty($type)) {
                return;
            }

            $paramType = $method['docblock']['params'][$param];
            if ($paramType !== $type) {
                if (!($type == 'array' && substr($paramType, -2) == '[]')) {
                    $this->warnings[] = [
                        'type' => 'param-mismatch',
                        'file' => $file,
                        'class' => $name,
                        'method' => $name,
                        'line' => $method['line'],
                        'param' => $param,
                        'param-type' => $type,
                        'doc-type' => $method['docblock']['params'][$param],
                    ];
                }
            }
        }
    }
642229
public function setMethod($method)
    {
        $valid_methods = array(self::METHOD_POST, self::METHOD_GET);

        if (!in_array($method, $valid_methods)) {
            throw new SwatException("‘{$method}’ is not a valid form method.");
        }

        $this->method = $method;
    }
502174
protected function buildView($name, $method = null)
    {
        $replace = [];

        if ($this->option('parent')) {
            $replace = $this->buildParentReplacements();
        }

        if ($this->option('model')) {
            $replace = $this->buildModelReplacements($replace);
        }

        if ($this->option('parent')) {
            $replace['parent_dummy_view'] = $this->getParentViewName($name);
            $replace['parent_dummy_route'] = $this->getParentRouteName($name);
        }
        $replace['dummy_view'] = $this->getViewName($name);
        $replace['dummy_route'] = $this->getRouteName($name);

        return str_replace(array_keys($replace), array_values($replace), $this->files->get($this->getViewStub($method, $name)));
    }
1104800
public function setCustomMethod(Method $method)
    {
        $this->setMethod(self::METHOD_CUSTOM);
        $this->methods[$this->method] = get_object_vars($method);

        $this->loadSettings();
    }
273703
function _process_submission($method) {
        $submission = array();
        if (!empty($this->_ajaxformdata)) {
            $submission = $this->_ajaxformdata;
        } else if ($method == 'post') {
            if (!empty($_POST)) {
                $submission = $_POST;
            }
        } else {
            $submission = $_GET;
            merge_query_params($submission, $_POST); // Emulate handling of parameters in xxxx_param().
        }

        // following trick is needed to enable proper sesskey checks when using GET forms
        // the _qf__.$this->_formname serves as a marker that form was actually submitted
        if (array_key_exists('_qf__'.$this->_formname, $submission) and $submission['_qf__'.$this->_formname] == 1) {
            if (!confirm_sesskey()) {
                print_error('invalidsesskey');
            }
            $files = $_FILES;
        } else {
            $submission = array();
            $files = array();
        }
        $this->detectMissingSetType();

        $this->_form->updateSubmission($submission, $files);
    }
164390
public function log(string $name, string $message, array $data = []): void
    {
        $filename = $this->dir . '/' . $name . '-' . date('Y-m-d') . '.log';
        try {
            $microtime = microtime(true);
            $microtimeParts = explode('.', $microtime);
            $logData = date('H:i:s', $microtime) . ':' . (isset($microtimeParts[1]) ? $microtimeParts[1] : '0') . "\n" . trim($message) . (empty($data) ? '' : "\n" . trim(print_r($data, true))) . "\n\n";
            $fileHandler = fopen($filename, 'ab');
            fwrite($fileHandler, $logData);
            fclose($fileHandler);
        } catch (\Exception $e) {
            throw new \Exception('Cannot write log file (' . $filename . ')');
        }
    }
133601
public function isFile(String $name) : Bool
    {
        $file = Method::files($name);

        if( is_array($file) )
        {
            return (bool) $file[0];
        }

        return (bool) Method::files($name);
    }
577553
public function sendFile($file,$file_name=''){
        $this->hasSend=true;
        $this->swooleResponse->status($this->code);
        $this->fileToContentType($file,$file_name);
        if (!empty($this->header)) {
            // 发送头部信息
            foreach ($this->header as $name => $val) {
                $this->swooleResponse->header($name,$val);
            }
        }
        $this->swooleResponse->sendfile($file);
    }
117079
public function process_model($id, $method) {
        $model = $this->Model;
        $record = $this->AdminToolbar->getRecordById($model, $id);

        if (!$record) {
            throw new NotFoundException(__d('admin', '%s Not Found', $this->Model->singularName));
        }

        if ($model->hasMethod($method)) {
            $model->{$method}($id);

            $this->AdminToolbar->logAction(ActionLog::PROCESS, $model, $id, __d('admin', 'Triggered %s.%s() process', array($model->alias, $method)));
            $this->AdminToolbar->setFlashMessage(__d('admin', 'Processed %s.%s() for ID %s', array($model->alias, $method, $id)));

        } else {
            $this->AdminToolbar->setFlashMessage(__d('admin', '%s does not allow this process', $model->singularName), 'is-error');
        }

        $this->redirect($this->referer());
    }
1270570
private function executeMethod($method, $args = [])
    {
        if (method_exists($this, $method)) {
            return call_user_func_array([$this, $method], $args);
        }
    }
1016771
public function setMethod($method = null)
    {
        if ($method === null) {
            $method = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : null;
        }

        $this->method = $method;
    }
1073396
public function addMethod($method, $name = null)
    {
        if (is_array($method)) {
            require_once 'Zend/Server/Method/Definition.php';
            $method = new Zend_Server_Method_Definition($method);
        } elseif (!$method instanceof Zend_Server_Method_Definition) {
            require_once 'Zend/Server/Exception.php';
            throw new Zend_Server_Exception('Invalid method provided');
        }

        if (is_numeric($name)) {
            $name = null;
        }
        if (null !== $name) {
            $method->setName($name);
        } else {
            $name = $method->getName();
        }
        if (null === $name) {
            require_once 'Zend/Server/Exception.php';
            throw new Zend_Server_Exception('No method name provided');
        }

        if (!$this->_overwriteExistingMethods && array_key_exists($name, $this->_methods)) {
            require_once 'Zend/Server/Exception.php';
            throw new Zend_Server_Exception(sprintf('Method by name of "%s" already exists', $name));
        }
        $this->_methods[$name] = $method;
        return $this;
    }
1166742
protected function handle_request( $method, $request_method, array $arguments = [] ) {
		if ( empty( $method ) || 'page' === $method ) {
			$page = max( ( isset( $arguments[0] ) ? intval( $arguments[0] ) : 1 ), 1 );
			$this->pager( $page );
			exit;
		} else {
			// Call method if exists.
			if ( $this->invoke( $method, $request_method, $arguments ) ) {
				exit;
			} else {
				$this->method_not_found();
			}
		}
	}
1167061
protected function processField($method, array $field = array(), array $options = array())
    {
        $this->field  = $field;
        $this->method = strtolower($method);

        $this->editFieldhandlerMethod();

        foreach (array('name', 'value', 'type') as $key) {
            $this->editFieldhandlerAttribute($key);
        }

        $fieldhandler_results = $this->executeConstraint($options);

        $this->processConstraintResults($fieldhandler_results);

        return $this->field_value;
    }
1233387
public function isDefinedPush($array, $name, $variable, $method = null)
    {
        if ($method and $variable) {
            $array[$name] = $variable->$method();
        } elseif ($variable) {
            $array[$name] = $variable;
        }

        return $array;
    }
213519
public function beginForm(string $name, string $action): void
    {
        $this->formOptions = $this->getFormOptions($name);

        $form = "<form id=\"{$name}\" action=\"{$action}\" method=\"post\"";

        $usePjax = (isset($this->formOptions['use_pjax'])) ?
            filter_var($this->formOptions['use_pjax'], FILTER_VALIDATE_BOOLEAN)
            : true;

        $pjaxAttr = ($usePjax) ? 'data-pjax' : '';

        foreach ($this->formOptions as $attr => $value) {
            if (in_array($attr, ['use_pjax', 'use_csrf', 'fields'])) {
                continue;
            }

            $form .= " {$attr}=\"{$value}\"";
        }

        echo "$form $pjaxAttr>";
    }
878987
private void processMethod(final Method method) {
    CommandArgument annotation = method.getAnnotation(CommandArgument.class);
    if (annotation != null) {
      final String name = method.getName();
      final Class<?>[] paramTypes = method.getParameterTypes();
      final Annotation[][] paramAnnotations = method.getParameterAnnotations();
      final ArgumentProcessor<Object[]> argProcessor = new ArgumentProcessor<Object[]>();
      final Object[] defaultParams = new Object[paramTypes.length];
      final List<Integer> positionalParams = new ArrayList<Integer>();

      String key = annotation.value();
      if (key.equals("")) {
        key = name;
      }

      for (int i = 0; i < paramAnnotations.length; i++) {
        Class<?> paramType = paramTypes[i];
        if (paramType == Integer.class || paramType == int.class) {
          defaultParams[i] = 0;
        } else if (paramType == Long.class || paramType == long.class) {
            defaultParams[i] = 0L;
        } else if (paramType == Double.class || paramType == double.class) {
          defaultParams[i] = 0.0;
        } else if (paramType == Float.class || paramType == float.class) {
          defaultParams[i] = (float) 0.0;
        } else if (paramType == String.class) {
          defaultParams[i] = "";
        } else if (paramType == File.class) {
          defaultParams[i] = null;
        } else if (paramType == Boolean.class || paramType == boolean.class) {
          defaultParams[i] = false;
        } else {
          throw new IllegalArgumentException("Invalid type (" + paramType.getCanonicalName() + ") for option parameter: method=" + method.getDeclaringClass().getCanonicalName() + "." + name);
        }

        int j;
        for (j = 0; j < paramAnnotations[i].length; j++) {
          if (paramAnnotations[i][j] instanceof OptionArgument) {
            OptionArgument optAnnotation = (OptionArgument) paramAnnotations[i][j];
            String optKey = optAnnotation.value();
            if (optKey.equals("")) {
              throw new IllegalArgumentException("OptionArgument on parameter requires key (method=`" + method.getDeclaringClass().getCanonicalName() + "." + name + "').");
            }

            char optShortKey = optAnnotation.shortKey();
            if (optShortKey == '\0') {
              optShortKey = optKey.charAt(0);
            }

            final int index = i;
            if (paramType == Integer.class || paramType == int.class) {
              argProcessor.addOption(optKey, optShortKey, new Command<Object[]>() {
                public void process(Queue<String> argq,
                    Object[] state) {
                  state[index] = Integer.parseInt(argq.remove());
                }
              });
            } else if (paramType == Long.class || paramType == long.class) {
              argProcessor.addOption(optKey, optShortKey, new Command<Object[]>() {
                public void process(Queue<String> argq,
                    Object[] state) {
                  state[index] = Long.parseLong(argq.remove());
                }
              });
            } else if (paramType == Boolean.class || paramType == boolean.class) {
              argProcessor.addOption(optKey, optShortKey, new Command<Object[]>() {
                public void process(Queue<String> argq,
                    Object[] state) {
                  state[index] = true;
                }
              });
            } else if (paramType == String.class) {
              argProcessor.addOption(optKey, optShortKey, new Command<Object[]>() {
                public void process(Queue<String> argq,
                    Object[] state) {
                  state[index] = argq.remove();
                }
              });
            } else if (paramType == Double.class || paramType == double.class) {
              argProcessor.addOption(optKey, optShortKey, new Command<Object[]>() {
                public void process(Queue<String> argq,
                    Object[] state) {
                  state[index] = Double.parseDouble(argq.remove());
                }
              });
            } else if (paramType == Float.class || paramType == float.class) {
              argProcessor.addOption(optKey, optShortKey, new Command<Object[]>() {
                public void process(Queue<String> argq,
                    Object[] state) {
                  state[index] = Float.parseFloat(argq.remove());
                }
              });
            } else if (paramType == File.class) {
              argProcessor.addOption(optKey, optShortKey, new Command<Object[]>() {
                public void process(Queue<String> argq,
                    Object[] state) {
                  state[index] = new File(argq.remove());
                }
              });
            }

            break;
          }
        }

        // If there is no OptionArgument annotation, treat it as a
        // positional parameter.
        if (j >= paramAnnotations[i].length) {
          positionalParams.add(i);
        }
      }

      // The default command will parse out all the positional parameters
      // from what's left over after all the options have been processed.
      argProcessor.setDefaultCommand(new Command<Object[]>() {
        public void process(Queue<String> argq, Object[] state) {
          for (int index : positionalParams) {
            if (argq.isEmpty()) {
              break;
            }
            Class<?> paramType = paramTypes[index];
            if (paramType == Integer.class || paramType == int.class) {
              state[index] = Integer.parseInt(argq.remove());
            } else if (paramType == Long.class || paramType == long.class) {
              state[index] = Long.parseLong(argq.remove());
            } else if (paramType == Double.class || paramType == double.class) {
              state[index] = Double.parseDouble(argq.remove());
            } else if (paramType == Float.class || paramType == float.class) {
              state[index] = Float.parseFloat(argq.remove());
            } else if (paramType == String.class) {
              state[index] = argq.remove();
            } else if (paramType == File.class) {
              state[index] = new File(argq.remove());
            } else if (paramType == Boolean.class || paramType == boolean.class) {
              state[index] = Boolean.parseBoolean(argq.remove());
            } else {
              throw new UnexpectedException();
            }
          }
        }
      });

      // Add the command that processes its arguments and invokes the
      // method.
      addCommand(key, new Command<T>(){
        public void process(Queue<String> argq, T state) {
          Object[] params = defaultParams.clone();
          argProcessor.process(argq, params);
          try {
            method.invoke(state, params);
          } catch (IllegalArgumentException e) {
            throw new UnexpectedException(e);
          } catch (IllegalAccessException e) {
            throw new UnexpectedException(e);
          } catch (InvocationTargetException e) {
            throw new UnexpectedException(e);
          }
        }
      });
    }
  }