php/WP_CLI/SynopsisValidator.php
public function validate_assoc( $assoc_args ) {
		$assoc_spec = $this->query_spec(
			array(
				'type' => 'assoc',
			)
		);

		$errors = array(
			'fatal'   => array(),
			'warning' => array(),
		);

		$to_unset = array();

		foreach ( $assoc_spec as $param ) {
			$key = $param['name'];

			if ( ! isset( $assoc_args[ $key ] ) ) {
				if ( ! $param['optional'] ) {
					$errors['fatal'][ $key ] = "missing --$key parameter";
				}
			} else {
				if ( true === $assoc_args[ $key ] && ! $param['value']['optional'] ) {
					$error_type                    = ( ! $param['optional'] ) ? 'fatal' : 'warning';
					$errors[ $error_type ][ $key ] = "--$key parameter needs a value";

					$to_unset[] = $key;
				}
			}
		}

		return array( $errors, $to_unset );
	}
public function validate_assoc( $assoc_args ) {
		$assoc_spec = $this->query_spec(
			array(
				'type' => 'assoc',
			)
		);

		$errors = array(
			'fatal'   => array(),
			'warning' => array(),
		);

		$to_unset = array();

		foreach ( $assoc_spec as $param ) {
			$key = $param['name'];

			if ( ! isset( $assoc_args[ $key ] ) ) {
				if ( ! $param['optional'] ) {
					$errors['fatal'][ $key ] = "missing --$key parameter";
				}
			} else {
				if ( true === $assoc_args[ $key ] && ! $param['value']['optional'] ) {
					$error_type                    = ( ! $param['optional'] ) ? 'fatal' : 'warning';
					$errors[ $error_type ][ $key ] = "--$key parameter needs a value";

					$to_unset[] = $key;
				}
			}
		}

		return array( $errors, $to_unset );
	}
public function validate_assoc ( $ assoc_args ) { $ assoc_spec = $ this -> query_spec ( array ( 'type' => 'assoc' , ) ) ; $ errors = array ( 'fatal' => array ( ) , 'warning' => array ( ) , ) ; $ to_unset = array ( ) ; foreach ( $ assoc_spec as $ param ) { $ key = $ param [ 'name' ] ; if ( ! isset ( $ assoc_args [ $ key ] ) ) { if ( ! $ param [ 'optional' ] ) { $ errors [ 'fatal' ] [ $ key ] = "missing --$key parameter" ; } } else { if ( true === $ assoc_args [ $ key ] && ! $ param [ 'value' ] [ 'optional' ] ) { $ error_type = ( ! $ param [ 'optional' ] ) ? 'fatal' : 'warning' ; $ errors [ $ error_type ] [ $ key ] = "--$key parameter needs a value" ; $ to_unset [ ] = $ key ; } } } return array ( $ errors , $ to_unset ) ; }
Check that all required keys are present and that they have values.

@param array $assoc_args Parameters passed to command.
@return array
Check that all required keys are present and that they have values .