generate-api-docs.php
protected function template( $string, array $args ) {

		// Example data formats
		$string = str_replace( '@example', $this->getExample( $args ), $string );

		// Required or Optional
		$string = str_replace( '@required', ( empty( $args['required'] ) ? 'Optional.' : 'Required.' ), $string );

		// Vars from passed array
		foreach ( $args as $key => $value ) {
			if ( is_string( $value ) ) {
				$string = str_replace( '@' . $key, $value, $string );
			}
		}

		// Clear remaining variables
		$string = preg_replace( '/@[a-zA-Z0-9]+/', '', $string );

		return $string;
	}
protected function template( $string, array $args ) {

		// Example data formats
		$string = str_replace( '@example', $this->getExample( $args ), $string );

		// Required or Optional
		$string = str_replace( '@required', ( empty( $args['required'] ) ? 'Optional.' : 'Required.' ), $string );

		// Vars from passed array
		foreach ( $args as $key => $value ) {
			if ( is_string( $value ) ) {
				$string = str_replace( '@' . $key, $value, $string );
			}
		}

		// Clear remaining variables
		$string = preg_replace( '/@[a-zA-Z0-9]+/', '', $string );

		return $string;
	}
Replace @variables with values in template string.

@param  string $string Template string. @variable used for variables.
@param  array $args   Array with keys as variable name, values as value
@return string