code
stringlengths
17
247k
docstring
stringlengths
30
30.3k
func_name
stringlengths
1
89
language
stringclasses
1 value
repo
stringlengths
7
63
path
stringlengths
7
153
url
stringlengths
51
209
license
stringclasses
4 values
public static function stack() { return self::$data; }
Return the current header stack @return string[][]
stack
php
zendframework/zend-diactoros
test/TestAsset/HeaderStack.php
https://github.com/zendframework/zend-diactoros/blob/master/test/TestAsset/HeaderStack.php
BSD-3-Clause
public static function has($header) { foreach (self::$data as $item) { if ($item['header'] === $header) { return true; } } return false; }
Verify if there's a header line on the stack @param string $header @return bool
has
php
zendframework/zend-diactoros
test/TestAsset/HeaderStack.php
https://github.com/zendframework/zend-diactoros/blob/master/test/TestAsset/HeaderStack.php
BSD-3-Clause
function report_batch_operation_results( $noun, $verb, $total, $successes, $failures ) { $plural_noun = $noun . 's'; $past_tense_verb = past_tense_verb( $verb ); $past_tense_verb_upper = ucfirst( $past_tense_verb ); if ( $failures ) { if ( $successes ) { WP_CLI::error( "Only {$past_tense_verb} {$successes} of {$total} {$plural_noun}." ); } else { WP_CLI::error( "No {$plural_noun} {$past_tense_verb}." ); } } else { if ( $successes ) { WP_CLI::success( "{$past_tense_verb_upper} {$successes} of {$total} {$plural_noun}." ); } else { $message = $total > 1 ? ucfirst( $plural_noun ) : ucfirst( $noun ); WP_CLI::success( "{$message} already {$past_tense_verb}." ); } } }
Report the results of the same operation against multiple resources. @access public @category Input @param string $noun Resource being affected (e.g. plugin) @param string $verb Type of action happening to the noun (e.g. activate) @param integer $total Total number of resource being affected. @param integer $successes Number of successful operations. @param integer $failures Number of failures.
report_batch_operation_results
php
10up/MU-Migration
features/bootstrap/utils.php
https://github.com/10up/MU-Migration/blob/master/features/bootstrap/utils.php
MIT
function is_bundled_command( $command ) { static $classes; if ( null === $classes ) { $classes = array(); $class_map = WP_CLI_VENDOR_DIR . '/composer/autoload_commands_classmap.php'; if ( file_exists( WP_CLI_VENDOR_DIR . '/composer/') ) { $classes = include $class_map; } } if ( is_object( $command ) ) { $command = get_class( $command ); } return is_string( $command ) ? array_key_exists( $command, $classes ) : false; }
Check whether a given Command object is part of the bundled set of commands. This function accepts both a fully qualified class name as a string as well as an object that extends `WP_CLI\Dispatcher\CompositeCommand`. @param \WP_CLI\Dispatcher\CompositeCommand|string $command @return bool
is_bundled_command
php
10up/MU-Migration
features/bootstrap/utils.php
https://github.com/10up/MU-Migration/blob/master/features/bootstrap/utils.php
MIT
private static function get_process_env_variables() { // Ensure we're using the expected `wp` binary $bin_dir = getenv( 'WP_CLI_BIN_DIR' ) ?: realpath( __DIR__ . '/../../bin' ); $vendor_dir = realpath( __DIR__ . '/../../vendor/bin' ); $env = array( 'PATH' => $bin_dir . ':' . $vendor_dir . ':' . getenv( 'PATH' ), 'BEHAT_RUN' => 1, 'HOME' => sys_get_temp_dir() . '/wp-cli-home', ); if ( $config_path = getenv( 'WP_CLI_CONFIG_PATH' ) ) { $env['WP_CLI_CONFIG_PATH'] = $config_path; } if ( $term = getenv( 'TERM' ) ) { $env['TERM'] = $term; } if ( $php_args = getenv( 'WP_CLI_PHP_ARGS' ) ) { $env['WP_CLI_PHP_ARGS'] = $php_args; } if ( $travis_build_dir = getenv( 'TRAVIS_BUILD_DIR' ) ) { $env['TRAVIS_BUILD_DIR'] = $travis_build_dir; } if ( $github_token = getenv( 'GITHUB_TOKEN' ) ) { $env['GITHUB_TOKEN'] = $github_token; } return $env; }
Get the environment variables required for launched `wp` processes
get_process_env_variables
php
10up/MU-Migration
features/bootstrap/FeatureContext.php
https://github.com/10up/MU-Migration/blob/master/features/bootstrap/FeatureContext.php
MIT
private static function cache_wp_files() { $wp_version_suffix = ( $wp_version = getenv( 'WP_VERSION' ) ) ? "-$wp_version" : ''; self::$cache_dir = sys_get_temp_dir() . '/wp-cli-test-core-download-cache' . $wp_version_suffix; if ( is_readable( self::$cache_dir . '/wp-config-sample.php' ) ) return; $cmd = Utils\esc_cmd( 'wp core download --force --path=%s', self::$cache_dir ); if ( $wp_version ) { $cmd .= Utils\esc_cmd( ' --version=%s', $wp_version ); } Process::create( $cmd, null, self::get_process_env_variables() )->run_check(); }
We cache the results of `wp core download` to improve test performance. Ideally, we'd cache at the HTTP layer for more reliable tests.
cache_wp_files
php
10up/MU-Migration
features/bootstrap/FeatureContext.php
https://github.com/10up/MU-Migration/blob/master/features/bootstrap/FeatureContext.php
MIT
public static function create_cache_dir() { if ( self::$suite_cache_dir ) { self::remove_dir( self::$suite_cache_dir ); } self::$suite_cache_dir = sys_get_temp_dir() . '/' . uniqid( 'wp-cli-test-suite-cache-' . self::$temp_dir_infix . '-', TRUE ); mkdir( self::$suite_cache_dir ); return self::$suite_cache_dir; }
Create a temporary WP_CLI_CACHE_DIR. Exposed as SUITE_CACHE_DIR in "Given an empty cache" step.
create_cache_dir
php
10up/MU-Migration
features/bootstrap/FeatureContext.php
https://github.com/10up/MU-Migration/blob/master/features/bootstrap/FeatureContext.php
MIT
public function __construct( array $parameters ) { if ( getenv( 'WP_CLI_TEST_DBUSER' ) ) { self::$db_settings['dbuser'] = getenv( 'WP_CLI_TEST_DBUSER' ); } if ( false !== getenv( 'WP_CLI_TEST_DBPASS' ) ) { self::$db_settings['dbpass'] = getenv( 'WP_CLI_TEST_DBPASS' ); } if ( getenv( 'WP_CLI_TEST_DBHOST' ) ) { self::$db_settings['dbhost'] = getenv( 'WP_CLI_TEST_DBHOST' ); } //load constants require_once 'mu-migration.php'; $this->drop_db(); $this->set_cache_dir(); $this->variables['CORE_CONFIG_SETTINGS'] = Utils\assoc_args_to_str( self::$db_settings ); $this->variables['MU_MIGRATION_VERSION'] = TENUP_MU_MIGRATION_VERSION; }
Initializes context. Every scenario gets its own context object. @param array $parameters context parameters (set them up through behat.yml)
__construct
php
10up/MU-Migration
features/bootstrap/FeatureContext.php
https://github.com/10up/MU-Migration/blob/master/features/bootstrap/FeatureContext.php
MIT
public function replace_variables( $str ) { $ret = preg_replace_callback( '/\{([A-Z_]+)\}/', array( $this, '_replace_var' ), $str ); if ( false !== strpos( $str, '{WP_VERSION-' ) ) { $ret = $this->_replace_wp_versions( $ret ); } return $ret; }
Replace {VARIABLE_NAME}. Note that variable names can only contain uppercase letters and underscores (no numbers).
replace_variables
php
10up/MU-Migration
features/bootstrap/FeatureContext.php
https://github.com/10up/MU-Migration/blob/master/features/bootstrap/FeatureContext.php
MIT
public function create_run_dir() { if ( !isset( $this->variables['RUN_DIR'] ) ) { self::$run_dir = $this->variables['RUN_DIR'] = sys_get_temp_dir() . '/' . uniqid( 'wp-cli-test-run-' . self::$temp_dir_infix . '-', TRUE ); mkdir( $this->variables['RUN_DIR'] ); } }
Create the RUN_DIR directory, unless already set for this scenario.
create_run_dir
php
10up/MU-Migration
features/bootstrap/FeatureContext.php
https://github.com/10up/MU-Migration/blob/master/features/bootstrap/FeatureContext.php
MIT
private function set_cache_dir() { $path = sys_get_temp_dir() . '/wp-cli-test-cache'; if ( ! file_exists( $path ) ) { mkdir( $path ); } $this->variables['CACHE_DIR'] = $path; }
CACHE_DIR is a cache for downloaded test data such as images. Lives until manually deleted.
set_cache_dir
php
10up/MU-Migration
features/bootstrap/FeatureContext.php
https://github.com/10up/MU-Migration/blob/master/features/bootstrap/FeatureContext.php
MIT
public static function remove_dir( $dir ) { Process::create( Utils\esc_cmd( 'rm -rf %s', $dir ) )->run_check(); }
Remove a directory (recursive).
remove_dir
php
10up/MU-Migration
features/bootstrap/FeatureContext.php
https://github.com/10up/MU-Migration/blob/master/features/bootstrap/FeatureContext.php
MIT
public static function copy_dir( $src_dir, $dest_dir ) { Process::create( Utils\esc_cmd( "cp -r %s/* %s", $src_dir, $dest_dir ) )->run_check(); }
Copy a directory (recursive). Destination directory must exist.
copy_dir
php
10up/MU-Migration
features/bootstrap/FeatureContext.php
https://github.com/10up/MU-Migration/blob/master/features/bootstrap/FeatureContext.php
MIT
private static function log_run_times_before_scenario( $event ) { if ( $scenario_key = self::get_scenario_key( $event ) ) { self::$scenario_run_times[ $scenario_key ] = -microtime( true ); } }
Record the start time of the scenario into the `$scenario_run_times` array.
log_run_times_before_scenario
php
10up/MU-Migration
features/bootstrap/FeatureContext.php
https://github.com/10up/MU-Migration/blob/master/features/bootstrap/FeatureContext.php
MIT
private static function log_run_times_after_scenario( $event ) { if ( $scenario_key = self::get_scenario_key( $event ) ) { self::$scenario_run_times[ $scenario_key ] += microtime( true ); self::$scenario_count++; if ( count( self::$scenario_run_times ) > self::$num_top_scenarios ) { arsort( self::$scenario_run_times ); array_pop( self::$scenario_run_times ); } } }
Save the run time of the scenario into the `$scenario_run_times` array. Only the top `self::$num_top_scenarios` are kept.
log_run_times_after_scenario
php
10up/MU-Migration
features/bootstrap/FeatureContext.php
https://github.com/10up/MU-Migration/blob/master/features/bootstrap/FeatureContext.php
MIT
private static function get_scenario_key( $event ) { $scenario_key = ''; if ( $file = self::get_event_file( $event, $line ) ) { $scenario_grandparent = Utils\basename( dirname( dirname( $file ) ) ); $scenario_key = $scenario_grandparent . ' ' . Utils\basename( $file ) . ':' . $line; } return $scenario_key; }
Get the scenario key used for `$scenario_run_times` array. Format "<grandparent-dir> <feature-file>:<line-number>", eg "core-command core-update.feature:221".
get_scenario_key
php
10up/MU-Migration
features/bootstrap/FeatureContext.php
https://github.com/10up/MU-Migration/blob/master/features/bootstrap/FeatureContext.php
MIT
private static function log_proc_method_run_time( $key, $start_time ) { $run_time = microtime( true ) - $start_time; if ( ! isset( self::$proc_method_run_times[ $key ] ) ) { self::$proc_method_run_times[ $key ] = array( 0, 0 ); } self::$proc_method_run_times[ $key ][0] += $run_time; self::$proc_method_run_times[ $key ][1]++; }
Log the run time of a proc method (one that doesn't use Process but does (use a function that does) a `proc_open()`).
log_proc_method_run_time
php
10up/MU-Migration
features/bootstrap/FeatureContext.php
https://github.com/10up/MU-Migration/blob/master/features/bootstrap/FeatureContext.php
MIT
function is_woocommerce_active() { return in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ); }
Checks if WooCommerce is active. @return bool
is_woocommerce_active
php
10up/MU-Migration
includes/helpers.php
https://github.com/10up/MU-Migration/blob/master/includes/helpers.php
MIT
function is_zip_file( $filename ) { $fh = fopen( $filename, 'r' ); if ( ! $fh ) { return false; } $blob = fgets( $fh, 5 ); fclose( $fh ); if ( strpos( $blob, 'PK' ) !== false ) { return true; } else { return false; } }
Checks if $filename is a zip file by checking it's first few bytes sequence. @param string $filename @return bool
is_zip_file
php
10up/MU-Migration
includes/helpers.php
https://github.com/10up/MU-Migration/blob/master/includes/helpers.php
MIT
function parse_url_for_search_replace( $url ) { $parsed_url = parse_url( esc_url( $url ) ); $path = isset( $parsed_url['path'] ) ? $parsed_url['path'] : ''; return $parsed_url['host'] . $path; }
Parses a url for use in search-replace by removing its protocol. @param string $url @return string
parse_url_for_search_replace
php
10up/MU-Migration
includes/helpers.php
https://github.com/10up/MU-Migration/blob/master/includes/helpers.php
MIT
function move_folder( $source, $dest ) { if ( ! file_exists( $dest ) ) { mkdir( $dest ); } foreach ( $iterator = new \RecursiveIteratorIterator( new \RecursiveDirectoryIterator( $source, \RecursiveDirectoryIterator::SKIP_DOTS ), \RecursiveIteratorIterator::SELF_FIRST ) as $item ) { if ( $item->isDir() ) { $dir = $dest . DIRECTORY_SEPARATOR . $iterator->getSubPathName(); if ( ! file_exists( $dir ) ) { mkdir( $dir ); } } else { $dest_file = $dest . DIRECTORY_SEPARATOR . $iterator->getSubPathName(); if ( ! file_exists( $dest_file ) ) { rename( $item, $dest_file ); } } } }
Recursively copies a directory and its files. @param string $source @param string $dest
move_folder
php
10up/MU-Migration
includes/helpers.php
https://github.com/10up/MU-Migration/blob/master/includes/helpers.php
MIT
function get_db_prefix( $blog_id ) { global $wpdb; if ( $blog_id > 1 ) { $new_db_prefix = $wpdb->base_prefix . $blog_id . '_'; } else { $new_db_prefix = $wpdb->prefix; } return $new_db_prefix; }
Retrieves the db prefix based on the $blog_id. @uses wpdb @param int $blog_id @return string
get_db_prefix
php
10up/MU-Migration
includes/helpers.php
https://github.com/10up/MU-Migration/blob/master/includes/helpers.php
MIT
function light_add_user_to_blog( $blog_id, $user_id, $role ) { $user = get_userdata( $user_id ); if ( ! $user ) { restore_current_blog(); return new \WP_Error( 'user_does_not_exist', __( 'The requested user does not exist.' ) ); } if ( ! get_user_meta( $user_id, 'primary_blog', true ) ) { update_user_meta( $user_id, 'primary_blog', $blog_id ); $details = get_blog_details( $blog_id ); update_user_meta( $user_id, 'source_domain', $details->domain ); } $user->set_role( $role ); /** * Fires immediately after a user is added to a site. * * @since MU * * @param int $user_id User ID. * @param string $role User role. * @param int $blog_id Blog ID. */ do_action( 'add_user_to_blog', $user_id, $role, $blog_id ); wp_cache_delete( $user_id, 'users' ); wp_cache_delete( $blog_id . '_user_count', 'blog-details' ); }
Does the same thing that add_user_to_blog does, but without calling switch_to_blog(). @param int $blog_id @param int $user_id @param string $role @return \WP_Error
light_add_user_to_blog
php
10up/MU-Migration
includes/helpers.php
https://github.com/10up/MU-Migration/blob/master/includes/helpers.php
MIT
function stop_the_insanity() { global $wpdb, $wp_actions, $wp_filter, $wp_object_cache; //reset queries $wpdb->queries = array(); // Prevent wp_actions from growing out of control $wp_actions = array(); if ( is_object( $wp_object_cache ) ) { $wp_object_cache->group_ops = array(); $wp_object_cache->stats = array(); $wp_object_cache->memcache_debug = array(); $wp_object_cache->cache = array(); if ( method_exists( $wp_object_cache, '__remoteset' ) ) { $wp_object_cache->__remoteset(); } } /* * The WP_Query class hooks a reference to one of its own methods * onto filters if update_post_term_cache or * update_post_meta_cache are true, which prevents PHP's garbage * collector from cleaning up the WP_Query instance on long- * running processes. * * By manually removing these callbacks (often created by things * like get_posts()), we're able to properly unallocate memory * once occupied by a WP_Query object. * */ if ( isset( $wp_filter['get_term_metadata'] ) ) { /* * WordPress 4.7 has a new Hook infrastructure, so we need to make sure * we're accessing the global array properly. */ if ( class_exists( 'WP_Hook' ) && $wp_filter['get_term_metadata'] instanceof \WP_Hook ) { $filter_callbacks = &$wp_filter['get_term_metadata']->callbacks; } else { $filter_callbacks = &$wp_filter['get_term_metadata']; } if ( isset( $filter_callbacks[10] ) ) { foreach ( $filter_callbacks[10] as $hook => $content ) { if ( preg_match( '#^[0-9a-f]{32}lazyload_term_meta$#', $hook ) ) { unset( $filter_callbacks[10][ $hook ] ); } } } } }
Frees up memory for long running processes.
stop_the_insanity
php
10up/MU-Migration
includes/helpers.php
https://github.com/10up/MU-Migration/blob/master/includes/helpers.php
MIT
function addTransaction( $orig_filename ) { $context = stream_context_create(); $orig_file = fopen( $orig_filename, 'r', 1, $context ); $temp_filename = tempnam( sys_get_temp_dir(), 'php_prepend_' ); file_put_contents( $temp_filename, 'START TRANSACTION;' . PHP_EOL ); file_put_contents( $temp_filename, $orig_file, FILE_APPEND ); file_put_contents( $temp_filename, 'COMMIT;', FILE_APPEND ); fclose( $orig_file ); unlink( $orig_filename ); rename( $temp_filename, $orig_filename ); }
Add START TRANSACTION and COMMIT to the sql export. shamelessly stolen from http://stackoverflow.com/questions/1760525/need-to-write-at-beginning-of-file-with-php @param string $orig_filename SQL dump file name.
addTransaction
php
10up/MU-Migration
includes/helpers.php
https://github.com/10up/MU-Migration/blob/master/includes/helpers.php
MIT
function maybe_switch_to_blog( $blog_id ) { if ( is_multisite() ) { switch_to_blog( $blog_id ); } }
Switches to another blog if on Multisite @param $blog_id
maybe_switch_to_blog
php
10up/MU-Migration
includes/helpers.php
https://github.com/10up/MU-Migration/blob/master/includes/helpers.php
MIT
function maybe_restore_current_blog() { if ( is_multisite() ) { restore_current_blog(); } }
Restore the current blog if on multisite
maybe_restore_current_blog
php
10up/MU-Migration
includes/helpers.php
https://github.com/10up/MU-Migration/blob/master/includes/helpers.php
MIT
function extract( $filename, $dest_dir ) { $zippy = Zippy::load(); $site_package = $zippy->open( $filename ); mkdir( $dest_dir ); $site_package->extract( $dest_dir ); }
Extracts a zip file to the $dest_dir. @uses Zippy @param string $filename @param string $dest_dir
extract
php
10up/MU-Migration
includes/helpers.php
https://github.com/10up/MU-Migration/blob/master/includes/helpers.php
MIT
function zip( $zip_file, $files_to_zip ) { return Zippy::load()->create( $zip_file, $files_to_zip, true ); }
Creates a zip files with the provided files/folder to zip @param string $zip_files The name of the zip file @param array $files_to_zip The files to include in the zip file @return void
zip
php
10up/MU-Migration
includes/helpers.php
https://github.com/10up/MU-Migration/blob/master/includes/helpers.php
MIT
public static function getCSVHeaders() { $headers = array( // General Info. 'ID', 'user_login', 'user_pass', 'user_nicename', 'user_email', 'user_url', 'user_registered', 'role', 'user_status', 'display_name', // User Meta. 'rich_editing', 'admin_color', 'show_admin_bar_front', 'first_name', 'last_name', 'nickname', 'aim', 'yim', 'jabber', 'description', ); $custom_headers = apply_filters( 'mu_migration/export/user/headers', array() ); if ( ! empty( $custom_headers ) ) { $headers = array_merge( $headers, $custom_headers ); } return $headers; }
Returns the Headers (first row) for the CSV export file. @return array @internal
getCSVHeaders
php
10up/MU-Migration
includes/commands/class-mu-migration-export.php
https://github.com/10up/MU-Migration/blob/master/includes/commands/class-mu-migration-export.php
MIT
private function move_uploads( $uploads_dir, $blog_id ) { if ( file_exists( $uploads_dir ) ) { \WP_CLI::log( __( 'Moving Uploads...', 'mu-migration' ) ); Helpers\maybe_switch_to_blog( $blog_id ); $dest_uploads_dir = wp_upload_dir(); Helpers\maybe_restore_current_blog(); Helpers\move_folder( $uploads_dir, $dest_uploads_dir['basedir'] ); } }
Moves the uploads folder to the right location. @param string $uploads_dir @param int $blog_id
move_uploads
php
10up/MU-Migration
includes/commands/class-mu-migration-import.php
https://github.com/10up/MU-Migration/blob/master/includes/commands/class-mu-migration-import.php
MIT
private function move_themes( $themes_dir ) { if ( file_exists( $themes_dir ) ) { WP_CLI::log( __( 'Moving Themes...', 'mu-migration' ) ); $themes = new \DirectoryIterator( $themes_dir ); $installed_themes = get_theme_root(); foreach ( $themes as $theme ) { if ( $theme->isDir() ) { $fullPluginPath = $themes_dir . '/' . $theme->getFilename(); if ( ! file_exists( $installed_themes . '/' . $theme->getFilename() ) ) { WP_CLI::log( sprintf( __( 'Moving %s to themes folder' ), $theme->getFilename() ) ); rename( $fullPluginPath, $installed_themes . '/' . $theme->getFilename() ); Helpers\runcommand( 'theme enable', [ $theme->getFilename() ] ); } } } } }
Moves the themes to the right location. @param string $themes_dir
move_themes
php
10up/MU-Migration
includes/commands/class-mu-migration-import.php
https://github.com/10up/MU-Migration/blob/master/includes/commands/class-mu-migration-import.php
MIT
private function create_new_site( $meta_data ) { $parsed_url = parse_url( esc_url( $meta_data->url ) ); $site_id = get_main_network_id(); $parsed_url['path'] = isset( $parsed_url['path'] ) ? $parsed_url['path'] : '/'; if ( domain_exists( $parsed_url['host'], $parsed_url['path'], $site_id ) ) { return false; } $blog_id = insert_blog( $parsed_url['host'], $parsed_url['path'], $site_id ); if ( ! $blog_id ) { return false; } return $blog_id; }
Creates a new site within multisite. @param object $meta_data @return bool|false|int
create_new_site
php
10up/MU-Migration
includes/commands/class-mu-migration-import.php
https://github.com/10up/MU-Migration/blob/master/includes/commands/class-mu-migration-import.php
MIT
private function check_for_sed_presence( $exit_on_error = false ) { $sed = \WP_CLI::launch( 'echo "wp_" | sed "s/wp_/wp_5_/g"', false, true ); if ( 'wp_5_' !== trim( $sed->stdout, "\x0A" ) ) { if ( $exit_on_error ) { \WP_CLI::error( __( 'sed not present, please install sed', 'mu-migration' ) ); } return false; } return true; }
Checks whether sed is available or not. @param bool $exit_on_error If set to true the script will be terminated if sed is not available. @return bool
check_for_sed_presence
php
10up/MU-Migration
includes/commands/class-mu-migration-import.php
https://github.com/10up/MU-Migration/blob/master/includes/commands/class-mu-migration-import.php
MIT
private function send_reset_link( $user_data ) { $user_login = $user_data->user_login; $user_email = $user_data->user_email; $key = get_password_reset_key( $user_data ); if ( is_wp_error( $key ) ) { return $key; } $message = __( 'A password reset has been requested for the following account:' ) . "\r\n\r\n"; $message .= network_home_url( '/' ) . "\r\n\r\n"; $message .= sprintf( __( 'Username: %s' ), $user_login ) . "\r\n\r\n"; $message .= __( 'In order to log in again you have to reset your password.' ) . "\r\n\r\n"; $message .= __( 'To reset your password, visit the following address:' ) . "\r\n\r\n"; $message .= '<' . network_site_url( "wp-login.php?action=rp&key=$key&login=" . rawurlencode( $user_login ), 'login' ) . ">\r\n"; if ( is_multisite() ) { $blogname = $GLOBALS['current_site']->site_name; } else { /* * The blogname option is escaped with esc_html on the way into the database * in sanitize_option we want to reverse this for the plain text arena of emails. */ $blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ); } $title = sprintf( __( '[%s] Password Reset' ), $blogname ); /** * Filters the subject of the password reset email. * * @since 2.8.0 * @since 4.4.0 Added the `$user_login` and `$user_data` parameters. * * @param string $title Default email title. * @param string $user_login The username for the user. * @param \WP_User $user_data WP_User object. */ $title = apply_filters( 'retrieve_password_title', $title, $user_login, $user_data ); /** * Filters the message body of the password reset mail. * * @since 2.8.0 * @since 4.1.0 Added `$user_login` and `$user_data` parameters. * * @param string $message Default mail message. * @param string $key The activation key. * @param string $user_login The username for the user. * @param \WP_User $user_data WP_User object. */ $message = apply_filters( 'retrieve_password_message', $message, $key, $user_login, $user_data ); if ( $message && ! wp_mail( $user_email, wp_specialchars_decode( $title ), $message ) ) { WP_CLI::log( __( 'The email could not be sent', 'mu-migration' ) ); } return true; }
Handles sending password retrieval email to user (based on retrieve_password). @param $user_data @return bool|\WP_Error
send_reset_link
php
10up/MU-Migration
includes/commands/class-mu-migration-users.php
https://github.com/10up/MU-Migration/blob/master/includes/commands/class-mu-migration-users.php
MIT
protected function all_posts( $query_args, $callback, $verbose = true ) { if ( ! is_callable( $callback ) ) { self::error( __( "The provided callback is invalid", 'mu-migration' ) ); } $default_args = array( 'post_type' => 'post', 'posts_per_page' => 1000, 'post_status' => array( 'publish', 'pending', 'draft', 'future', 'private' ), 'cache_results ' => false, 'update_post_meta_cache' => false, 'update_post_term_cache' => false, 'offset' => 0, ); /** * Filters the default args for querying posts in the all_posts method. * * @since 0.2.0 * * @param array $default_args */ $default_args = apply_filters( 'mu-migration/all_posts/default_args', $default_args ); $query_args = wp_parse_args( $query_args, $default_args ); $query = new \WP_Query( $query_args ); $counter = 0; $found_posts = 0; while ( $query->have_posts() ) { $query->the_post(); $callback(); if ( 0 === $counter ) { $found_posts = $query->found_posts; } $counter++; if ( 0 === $counter % $query_args['posts_per_page'] ) { Helpers\stop_the_insanity(); $this->log( sprintf( __( 'Posts Updated: %d/%d', 'mu-migration' ), $counter, $found_posts ), true ); $query_args['offset'] += $query_args['posts_per_page']; $query = new \WP_Query( $query_args ); } } wp_reset_postdata(); $this->success( sprintf( __( '%d posts were updated', 'mu-migration' ), $counter ), $verbose ); }
Runs through all posts and executes the provided callback for each post. @param array $query_args @param callable $callback @param bool $verbose
all_posts
php
10up/MU-Migration
includes/commands/class-mu-migration-base.php
https://github.com/10up/MU-Migration/blob/master/includes/commands/class-mu-migration-base.php
MIT
public function __invoke( $args, $assoc_args ) { \cli\line( 'MU-Migration version: %Yv' . TENUP_MU_MIGRATION_VERSION . '%n' ); \cli\line(); \cli\line( 'Created by Nícholas André at 10up' ); \cli\line( 'Github: https://github.com/10up/MU-Migration' ); \cli\line(); }
Displays General Info about MU-Migration and WordPress @param array $args @param array $assoc_args
__invoke
php
10up/MU-Migration
includes/commands/class-mu-migration.php
https://github.com/10up/MU-Migration/blob/master/includes/commands/class-mu-migration.php
MIT
private static function _get_field_type($flags) { static $map; isset($map) OR $map = array( MYSQLI_TYPE_DECIMAL => 'decimal', MYSQLI_TYPE_BIT => 'bit', MYSQLI_TYPE_TINY => 'tinyint', MYSQLI_TYPE_SHORT => 'smallint', MYSQLI_TYPE_INT24 => 'mediumint', MYSQLI_TYPE_LONG => 'int', MYSQLI_TYPE_LONGLONG => 'bigint', MYSQLI_TYPE_FLOAT => 'float', MYSQLI_TYPE_DOUBLE => 'double', MYSQLI_TYPE_TIMESTAMP => 'timestamp', MYSQLI_TYPE_DATE => 'date', MYSQLI_TYPE_TIME => 'time', MYSQLI_TYPE_DATETIME => 'datetime', MYSQLI_TYPE_YEAR => 'year', MYSQLI_TYPE_NEWDATE => 'date', MYSQLI_TYPE_INTERVAL => 'interval', MYSQLI_TYPE_ENUM => 'enum', MYSQLI_TYPE_SET => 'set', MYSQLI_TYPE_TINY_BLOB => 'tinyblob', MYSQLI_TYPE_MEDIUM_BLOB => 'mediumblob', MYSQLI_TYPE_BLOB => 'blob', MYSQLI_TYPE_LONG_BLOB => 'longblob', MYSQLI_TYPE_STRING => 'char', MYSQLI_TYPE_VAR_STRING => 'varchar', MYSQLI_TYPE_GEOMETRY => 'geometry' ); foreach ($map as $flag => $name) { if ($flags & $flag) { return $name; } } return $flags; }
Get field type Extracts field type info from the bitflags returned by mysqli_result::fetch_fields() @used-by CI_DB_mysqli_result::field_data() @param int $flags @return string
_get_field_type
php
ronknight/InventorySystem
system/database/drivers/mysqli/mysqli_result.php
https://github.com/ronknight/InventorySystem/blob/master/system/database/drivers/mysqli/mysqli_result.php
MIT
public function getPageNumber() { return $this->page_number; }
Page number of the [text_segment][google.cloud.automl.v1.Document.Layout.text_segment] in the original document, starts from 1. Generated from protobuf field <code>int32 page_number = 2;</code> @return int
getPageNumber
php
googleapis/google-cloud-php
AutoMl/src/V1/Document/Layout.php
https://github.com/googleapis/google-cloud-php/blob/master/AutoMl/src/V1/Document/Layout.php
Apache-2.0
public function setPageNumber($var) { GPBUtil::checkInt32($var); $this->page_number = $var; return $this; }
Page number of the [text_segment][google.cloud.automl.v1.Document.Layout.text_segment] in the original document, starts from 1. Generated from protobuf field <code>int32 page_number = 2;</code> @param int $var @return $this
setPageNumber
php
googleapis/google-cloud-php
AutoMl/src/V1/Document/Layout.php
https://github.com/googleapis/google-cloud-php/blob/master/AutoMl/src/V1/Document/Layout.php
Apache-2.0
public function getBoundingPoly() { return $this->bounding_poly; }
The position of the [text_segment][google.cloud.automl.v1.Document.Layout.text_segment] in the page. Contains exactly 4 [normalized_vertices][google.cloud.automl.v1p1beta.BoundingPoly.normalized_vertices] and they are connected by edges in the order provided, which will represent a rectangle parallel to the frame. The [NormalizedVertex-s][google.cloud.automl.v1p1beta.NormalizedVertex] are relative to the page. Coordinates are based on top-left as point (0,0). Generated from protobuf field <code>.google.cloud.automl.v1.BoundingPoly bounding_poly = 3;</code> @return \Google\Cloud\AutoMl\V1\BoundingPoly|null
getBoundingPoly
php
googleapis/google-cloud-php
AutoMl/src/V1/Document/Layout.php
https://github.com/googleapis/google-cloud-php/blob/master/AutoMl/src/V1/Document/Layout.php
Apache-2.0
public function setBoundingPoly($var) { GPBUtil::checkMessage($var, \Google\Cloud\AutoMl\V1\BoundingPoly::class); $this->bounding_poly = $var; return $this; }
The position of the [text_segment][google.cloud.automl.v1.Document.Layout.text_segment] in the page. Contains exactly 4 [normalized_vertices][google.cloud.automl.v1p1beta.BoundingPoly.normalized_vertices] and they are connected by edges in the order provided, which will represent a rectangle parallel to the frame. The [NormalizedVertex-s][google.cloud.automl.v1p1beta.NormalizedVertex] are relative to the page. Coordinates are based on top-left as point (0,0). Generated from protobuf field <code>.google.cloud.automl.v1.BoundingPoly bounding_poly = 3;</code> @param \Google\Cloud\AutoMl\V1\BoundingPoly $var @return $this
setBoundingPoly
php
googleapis/google-cloud-php
AutoMl/src/V1/Document/Layout.php
https://github.com/googleapis/google-cloud-php/blob/master/AutoMl/src/V1/Document/Layout.php
Apache-2.0
public function getTextSegmentType() { return $this->text_segment_type; }
The type of the [text_segment][google.cloud.automl.v1.Document.Layout.text_segment] in document. Generated from protobuf field <code>.google.cloud.automl.v1.Document.Layout.TextSegmentType text_segment_type = 4;</code> @return int
getTextSegmentType
php
googleapis/google-cloud-php
AutoMl/src/V1/Document/Layout.php
https://github.com/googleapis/google-cloud-php/blob/master/AutoMl/src/V1/Document/Layout.php
Apache-2.0
public function setTextSegmentType($var) { GPBUtil::checkEnum($var, \Google\Cloud\AutoMl\V1\Document\Layout\TextSegmentType::class); $this->text_segment_type = $var; return $this; }
The type of the [text_segment][google.cloud.automl.v1.Document.Layout.text_segment] in document. Generated from protobuf field <code>.google.cloud.automl.v1.Document.Layout.TextSegmentType text_segment_type = 4;</code> @param int $var @return $this
setTextSegmentType
php
googleapis/google-cloud-php
AutoMl/src/V1/Document/Layout.php
https://github.com/googleapis/google-cloud-php/blob/master/AutoMl/src/V1/Document/Layout.php
Apache-2.0
public function setChunkContents($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DiscoveryEngine\V1\SearchResponse\Summary\Reference\ChunkContent::class); $this->chunk_contents = $arr; return $this; }
List of cited chunk contents derived from document content. Generated from protobuf field <code>repeated .google.cloud.discoveryengine.v1.SearchResponse.Summary.Reference.ChunkContent chunk_contents = 4;</code> @param array<\Google\Cloud\DiscoveryEngine\V1\SearchResponse\Summary\Reference\ChunkContent>|\Google\Protobuf\Internal\RepeatedField $var @return $this
setChunkContents
php
googleapis/google-cloud-php
DiscoveryEngine/src/V1/SearchResponse/Summary/Reference.php
https://github.com/googleapis/google-cloud-php/blob/master/DiscoveryEngine/src/V1/SearchResponse/Summary/Reference.php
Apache-2.0
public function getTargetSslProxyResource() { return $this->target_ssl_proxy_resource; }
The body resource for this request Generated from protobuf field <code>.google.cloud.compute.v1.TargetSslProxy target_ssl_proxy_resource = 142016192 [(.google.api.field_behavior) = REQUIRED];</code> @return \Google\Cloud\Compute\V1\TargetSslProxy|null
getTargetSslProxyResource
php
googleapis/google-cloud-php
Compute/src/V1/InsertTargetSslProxyRequest.php
https://github.com/googleapis/google-cloud-php/blob/master/Compute/src/V1/InsertTargetSslProxyRequest.php
Apache-2.0
public function setTargetSslProxyResource($var) { GPBUtil::checkMessage($var, \Google\Cloud\Compute\V1\TargetSslProxy::class); $this->target_ssl_proxy_resource = $var; return $this; }
The body resource for this request Generated from protobuf field <code>.google.cloud.compute.v1.TargetSslProxy target_ssl_proxy_resource = 142016192 [(.google.api.field_behavior) = REQUIRED];</code> @param \Google\Cloud\Compute\V1\TargetSslProxy $var @return $this
setTargetSslProxyResource
php
googleapis/google-cloud-php
Compute/src/V1/InsertTargetSslProxyRequest.php
https://github.com/googleapis/google-cloud-php/blob/master/Compute/src/V1/InsertTargetSslProxyRequest.php
Apache-2.0
public function getOrgPolicyResults() { return $this->org_policy_results; }
The organization policies under the [AnalyzeOrgPoliciesRequest.scope][google.cloud.asset.v1.AnalyzeOrgPoliciesRequest.scope] with the [AnalyzeOrgPoliciesRequest.constraint][google.cloud.asset.v1.AnalyzeOrgPoliciesRequest.constraint]. Generated from protobuf field <code>repeated .google.cloud.asset.v1.AnalyzeOrgPoliciesResponse.OrgPolicyResult org_policy_results = 1;</code> @return \Google\Protobuf\Internal\RepeatedField
getOrgPolicyResults
php
googleapis/google-cloud-php
Asset/src/V1/AnalyzeOrgPoliciesResponse.php
https://github.com/googleapis/google-cloud-php/blob/master/Asset/src/V1/AnalyzeOrgPoliciesResponse.php
Apache-2.0
public function setOrgPolicyResults($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Asset\V1\AnalyzeOrgPoliciesResponse\OrgPolicyResult::class); $this->org_policy_results = $arr; return $this; }
The organization policies under the [AnalyzeOrgPoliciesRequest.scope][google.cloud.asset.v1.AnalyzeOrgPoliciesRequest.scope] with the [AnalyzeOrgPoliciesRequest.constraint][google.cloud.asset.v1.AnalyzeOrgPoliciesRequest.constraint]. Generated from protobuf field <code>repeated .google.cloud.asset.v1.AnalyzeOrgPoliciesResponse.OrgPolicyResult org_policy_results = 1;</code> @param array<\Google\Cloud\Asset\V1\AnalyzeOrgPoliciesResponse\OrgPolicyResult>|\Google\Protobuf\Internal\RepeatedField $var @return $this
setOrgPolicyResults
php
googleapis/google-cloud-php
Asset/src/V1/AnalyzeOrgPoliciesResponse.php
https://github.com/googleapis/google-cloud-php/blob/master/Asset/src/V1/AnalyzeOrgPoliciesResponse.php
Apache-2.0
public function getConstraint() { return $this->constraint; }
The definition of the constraint in the request. Generated from protobuf field <code>.google.cloud.asset.v1.AnalyzerOrgPolicyConstraint constraint = 2;</code> @return \Google\Cloud\Asset\V1\AnalyzerOrgPolicyConstraint|null
getConstraint
php
googleapis/google-cloud-php
Asset/src/V1/AnalyzeOrgPoliciesResponse.php
https://github.com/googleapis/google-cloud-php/blob/master/Asset/src/V1/AnalyzeOrgPoliciesResponse.php
Apache-2.0
public function setConstraint($var) { GPBUtil::checkMessage($var, \Google\Cloud\Asset\V1\AnalyzerOrgPolicyConstraint::class); $this->constraint = $var; return $this; }
The definition of the constraint in the request. Generated from protobuf field <code>.google.cloud.asset.v1.AnalyzerOrgPolicyConstraint constraint = 2;</code> @param \Google\Cloud\Asset\V1\AnalyzerOrgPolicyConstraint $var @return $this
setConstraint
php
googleapis/google-cloud-php
Asset/src/V1/AnalyzeOrgPoliciesResponse.php
https://github.com/googleapis/google-cloud-php/blob/master/Asset/src/V1/AnalyzeOrgPoliciesResponse.php
Apache-2.0
public function getCommitTimestamp() { return $this->commit_timestamp; }
The Cloud Spanner timestamp at which the transaction committed. Generated from protobuf field <code>.google.protobuf.Timestamp commit_timestamp = 1;</code> @return \Google\Protobuf\Timestamp|null
getCommitTimestamp
php
googleapis/google-cloud-php
Spanner/src/V1/CommitResponse.php
https://github.com/googleapis/google-cloud-php/blob/master/Spanner/src/V1/CommitResponse.php
Apache-2.0
public function setCommitTimestamp($var) { GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); $this->commit_timestamp = $var; return $this; }
The Cloud Spanner timestamp at which the transaction committed. Generated from protobuf field <code>.google.protobuf.Timestamp commit_timestamp = 1;</code> @param \Google\Protobuf\Timestamp $var @return $this
setCommitTimestamp
php
googleapis/google-cloud-php
Spanner/src/V1/CommitResponse.php
https://github.com/googleapis/google-cloud-php/blob/master/Spanner/src/V1/CommitResponse.php
Apache-2.0
public function getCommitStats() { return $this->commit_stats; }
The statistics about this Commit. Not returned by default. For more information, see [CommitRequest.return_commit_stats][google.spanner.v1.CommitRequest.return_commit_stats]. Generated from protobuf field <code>.google.spanner.v1.CommitResponse.CommitStats commit_stats = 2;</code> @return \Google\Cloud\Spanner\V1\CommitResponse\CommitStats|null
getCommitStats
php
googleapis/google-cloud-php
Spanner/src/V1/CommitResponse.php
https://github.com/googleapis/google-cloud-php/blob/master/Spanner/src/V1/CommitResponse.php
Apache-2.0
public function setCommitStats($var) { GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\CommitResponse\CommitStats::class); $this->commit_stats = $var; return $this; }
The statistics about this Commit. Not returned by default. For more information, see [CommitRequest.return_commit_stats][google.spanner.v1.CommitRequest.return_commit_stats]. Generated from protobuf field <code>.google.spanner.v1.CommitResponse.CommitStats commit_stats = 2;</code> @param \Google\Cloud\Spanner\V1\CommitResponse\CommitStats $var @return $this
setCommitStats
php
googleapis/google-cloud-php
Spanner/src/V1/CommitResponse.php
https://github.com/googleapis/google-cloud-php/blob/master/Spanner/src/V1/CommitResponse.php
Apache-2.0
public function getPrecommitToken() { return $this->readOneof(4); }
If specified, transaction has not committed yet. Clients must retry the commit with the new precommit token. Generated from protobuf field <code>.google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 4;</code> @return \Google\Cloud\Spanner\V1\MultiplexedSessionPrecommitToken|null
getPrecommitToken
php
googleapis/google-cloud-php
Spanner/src/V1/CommitResponse.php
https://github.com/googleapis/google-cloud-php/blob/master/Spanner/src/V1/CommitResponse.php
Apache-2.0
public function setPrecommitToken($var) { GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\MultiplexedSessionPrecommitToken::class); $this->writeOneof(4, $var); return $this; }
If specified, transaction has not committed yet. Clients must retry the commit with the new precommit token. Generated from protobuf field <code>.google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 4;</code> @param \Google\Cloud\Spanner\V1\MultiplexedSessionPrecommitToken $var @return $this
setPrecommitToken
php
googleapis/google-cloud-php
Spanner/src/V1/CommitResponse.php
https://github.com/googleapis/google-cloud-php/blob/master/Spanner/src/V1/CommitResponse.php
Apache-2.0
public function getExecutionId() { return $this->execution_id; }
The unique ID of the command execution for polling. Generated from protobuf field <code>string execution_id = 1;</code> @return string
getExecutionId
php
googleapis/google-cloud-php
OrchestrationAirflow/src/V1/ExecuteAirflowCommandResponse.php
https://github.com/googleapis/google-cloud-php/blob/master/OrchestrationAirflow/src/V1/ExecuteAirflowCommandResponse.php
Apache-2.0
public function setExecutionId($var) { GPBUtil::checkString($var, True); $this->execution_id = $var; return $this; }
The unique ID of the command execution for polling. Generated from protobuf field <code>string execution_id = 1;</code> @param string $var @return $this
setExecutionId
php
googleapis/google-cloud-php
OrchestrationAirflow/src/V1/ExecuteAirflowCommandResponse.php
https://github.com/googleapis/google-cloud-php/blob/master/OrchestrationAirflow/src/V1/ExecuteAirflowCommandResponse.php
Apache-2.0
public function getPod() { return $this->pod; }
The name of the pod where the command is executed. Generated from protobuf field <code>string pod = 2;</code> @return string
getPod
php
googleapis/google-cloud-php
OrchestrationAirflow/src/V1/ExecuteAirflowCommandResponse.php
https://github.com/googleapis/google-cloud-php/blob/master/OrchestrationAirflow/src/V1/ExecuteAirflowCommandResponse.php
Apache-2.0
public function setPod($var) { GPBUtil::checkString($var, True); $this->pod = $var; return $this; }
The name of the pod where the command is executed. Generated from protobuf field <code>string pod = 2;</code> @param string $var @return $this
setPod
php
googleapis/google-cloud-php
OrchestrationAirflow/src/V1/ExecuteAirflowCommandResponse.php
https://github.com/googleapis/google-cloud-php/blob/master/OrchestrationAirflow/src/V1/ExecuteAirflowCommandResponse.php
Apache-2.0
public function getPodNamespace() { return $this->pod_namespace; }
The namespace of the pod where the command is executed. Generated from protobuf field <code>string pod_namespace = 3;</code> @return string
getPodNamespace
php
googleapis/google-cloud-php
OrchestrationAirflow/src/V1/ExecuteAirflowCommandResponse.php
https://github.com/googleapis/google-cloud-php/blob/master/OrchestrationAirflow/src/V1/ExecuteAirflowCommandResponse.php
Apache-2.0
public function setPodNamespace($var) { GPBUtil::checkString($var, True); $this->pod_namespace = $var; return $this; }
The namespace of the pod where the command is executed. Generated from protobuf field <code>string pod_namespace = 3;</code> @param string $var @return $this
setPodNamespace
php
googleapis/google-cloud-php
OrchestrationAirflow/src/V1/ExecuteAirflowCommandResponse.php
https://github.com/googleapis/google-cloud-php/blob/master/OrchestrationAirflow/src/V1/ExecuteAirflowCommandResponse.php
Apache-2.0
public function setCustomer($var) { GPBUtil::checkMessage($var, \Google\Cloud\Channel\V1\Customer::class); $this->customer = $var; return $this; }
Required. The customer to create. Generated from protobuf field <code>.google.cloud.channel.v1.Customer customer = 2 [(.google.api.field_behavior) = REQUIRED];</code> @param \Google\Cloud\Channel\V1\Customer $var @return $this
setCustomer
php
googleapis/google-cloud-php
Channel/src/V1/CreateCustomerRequest.php
https://github.com/googleapis/google-cloud-php/blob/master/Channel/src/V1/CreateCustomerRequest.php
Apache-2.0
public function getVersionId() { return $this->version_id; }
Output only. Immutable. The version ID of the PublisherModel. A new version is committed when a new model version is uploaded under an existing model id. It is an auto-incrementing decimal number in string representation. Generated from protobuf field <code>string version_id = 2 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OUTPUT_ONLY];</code> @return string
getVersionId
php
googleapis/google-cloud-php
AiPlatform/src/V1/PublisherModel.php
https://github.com/googleapis/google-cloud-php/blob/master/AiPlatform/src/V1/PublisherModel.php
Apache-2.0
public function setVersionId($var) { GPBUtil::checkString($var, True); $this->version_id = $var; return $this; }
Output only. Immutable. The version ID of the PublisherModel. A new version is committed when a new model version is uploaded under an existing model id. It is an auto-incrementing decimal number in string representation. Generated from protobuf field <code>string version_id = 2 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OUTPUT_ONLY];</code> @param string $var @return $this
setVersionId
php
googleapis/google-cloud-php
AiPlatform/src/V1/PublisherModel.php
https://github.com/googleapis/google-cloud-php/blob/master/AiPlatform/src/V1/PublisherModel.php
Apache-2.0
public function getOpenSourceCategory() { return $this->open_source_category; }
Required. Indicates the open source category of the publisher model. Generated from protobuf field <code>.google.cloud.aiplatform.v1.PublisherModel.OpenSourceCategory open_source_category = 7 [(.google.api.field_behavior) = REQUIRED];</code> @return int
getOpenSourceCategory
php
googleapis/google-cloud-php
AiPlatform/src/V1/PublisherModel.php
https://github.com/googleapis/google-cloud-php/blob/master/AiPlatform/src/V1/PublisherModel.php
Apache-2.0
public function setOpenSourceCategory($var) { GPBUtil::checkEnum($var, \Google\Cloud\AIPlatform\V1\PublisherModel\OpenSourceCategory::class); $this->open_source_category = $var; return $this; }
Required. Indicates the open source category of the publisher model. Generated from protobuf field <code>.google.cloud.aiplatform.v1.PublisherModel.OpenSourceCategory open_source_category = 7 [(.google.api.field_behavior) = REQUIRED];</code> @param int $var @return $this
setOpenSourceCategory
php
googleapis/google-cloud-php
AiPlatform/src/V1/PublisherModel.php
https://github.com/googleapis/google-cloud-php/blob/master/AiPlatform/src/V1/PublisherModel.php
Apache-2.0
public function getSupportedActions() { return $this->supported_actions; }
Optional. Supported call-to-action options. Generated from protobuf field <code>.google.cloud.aiplatform.v1.PublisherModel.CallToAction supported_actions = 19 [(.google.api.field_behavior) = OPTIONAL];</code> @return \Google\Cloud\AIPlatform\V1\PublisherModel\CallToAction|null
getSupportedActions
php
googleapis/google-cloud-php
AiPlatform/src/V1/PublisherModel.php
https://github.com/googleapis/google-cloud-php/blob/master/AiPlatform/src/V1/PublisherModel.php
Apache-2.0
public function setSupportedActions($var) { GPBUtil::checkMessage($var, \Google\Cloud\AIPlatform\V1\PublisherModel\CallToAction::class); $this->supported_actions = $var; return $this; }
Optional. Supported call-to-action options. Generated from protobuf field <code>.google.cloud.aiplatform.v1.PublisherModel.CallToAction supported_actions = 19 [(.google.api.field_behavior) = OPTIONAL];</code> @param \Google\Cloud\AIPlatform\V1\PublisherModel\CallToAction $var @return $this
setSupportedActions
php
googleapis/google-cloud-php
AiPlatform/src/V1/PublisherModel.php
https://github.com/googleapis/google-cloud-php/blob/master/AiPlatform/src/V1/PublisherModel.php
Apache-2.0
public function getFrameworks() { return $this->frameworks; }
Optional. Additional information about the model's Frameworks. Generated from protobuf field <code>repeated string frameworks = 23 [(.google.api.field_behavior) = OPTIONAL];</code> @return \Google\Protobuf\Internal\RepeatedField
getFrameworks
php
googleapis/google-cloud-php
AiPlatform/src/V1/PublisherModel.php
https://github.com/googleapis/google-cloud-php/blob/master/AiPlatform/src/V1/PublisherModel.php
Apache-2.0
public function setFrameworks($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); $this->frameworks = $arr; return $this; }
Optional. Additional information about the model's Frameworks. Generated from protobuf field <code>repeated string frameworks = 23 [(.google.api.field_behavior) = OPTIONAL];</code> @param array<string>|\Google\Protobuf\Internal\RepeatedField $var @return $this
setFrameworks
php
googleapis/google-cloud-php
AiPlatform/src/V1/PublisherModel.php
https://github.com/googleapis/google-cloud-php/blob/master/AiPlatform/src/V1/PublisherModel.php
Apache-2.0
public function getLaunchStage() { return $this->launch_stage; }
Optional. Indicates the launch stage of the model. Generated from protobuf field <code>.google.cloud.aiplatform.v1.PublisherModel.LaunchStage launch_stage = 29 [(.google.api.field_behavior) = OPTIONAL];</code> @return int
getLaunchStage
php
googleapis/google-cloud-php
AiPlatform/src/V1/PublisherModel.php
https://github.com/googleapis/google-cloud-php/blob/master/AiPlatform/src/V1/PublisherModel.php
Apache-2.0
public function setLaunchStage($var) { GPBUtil::checkEnum($var, \Google\Cloud\AIPlatform\V1\PublisherModel\LaunchStage::class); $this->launch_stage = $var; return $this; }
Optional. Indicates the launch stage of the model. Generated from protobuf field <code>.google.cloud.aiplatform.v1.PublisherModel.LaunchStage launch_stage = 29 [(.google.api.field_behavior) = OPTIONAL];</code> @param int $var @return $this
setLaunchStage
php
googleapis/google-cloud-php
AiPlatform/src/V1/PublisherModel.php
https://github.com/googleapis/google-cloud-php/blob/master/AiPlatform/src/V1/PublisherModel.php
Apache-2.0
public function getVersionState() { return $this->version_state; }
Optional. Indicates the state of the model version. Generated from protobuf field <code>.google.cloud.aiplatform.v1.PublisherModel.VersionState version_state = 37 [(.google.api.field_behavior) = OPTIONAL];</code> @return int
getVersionState
php
googleapis/google-cloud-php
AiPlatform/src/V1/PublisherModel.php
https://github.com/googleapis/google-cloud-php/blob/master/AiPlatform/src/V1/PublisherModel.php
Apache-2.0
public function setVersionState($var) { GPBUtil::checkEnum($var, \Google\Cloud\AIPlatform\V1\PublisherModel\VersionState::class); $this->version_state = $var; return $this; }
Optional. Indicates the state of the model version. Generated from protobuf field <code>.google.cloud.aiplatform.v1.PublisherModel.VersionState version_state = 37 [(.google.api.field_behavior) = OPTIONAL];</code> @param int $var @return $this
setVersionState
php
googleapis/google-cloud-php
AiPlatform/src/V1/PublisherModel.php
https://github.com/googleapis/google-cloud-php/blob/master/AiPlatform/src/V1/PublisherModel.php
Apache-2.0
public function getPublisherModelTemplate() { return $this->publisher_model_template; }
Optional. Output only. Immutable. Used to indicate this model has a publisher model and provide the template of the publisher model resource name. Generated from protobuf field <code>string publisher_model_template = 30 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OUTPUT_ONLY];</code> @return string
getPublisherModelTemplate
php
googleapis/google-cloud-php
AiPlatform/src/V1/PublisherModel.php
https://github.com/googleapis/google-cloud-php/blob/master/AiPlatform/src/V1/PublisherModel.php
Apache-2.0
public function setPublisherModelTemplate($var) { GPBUtil::checkString($var, True); $this->publisher_model_template = $var; return $this; }
Optional. Output only. Immutable. Used to indicate this model has a publisher model and provide the template of the publisher model resource name. Generated from protobuf field <code>string publisher_model_template = 30 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OUTPUT_ONLY];</code> @param string $var @return $this
setPublisherModelTemplate
php
googleapis/google-cloud-php
AiPlatform/src/V1/PublisherModel.php
https://github.com/googleapis/google-cloud-php/blob/master/AiPlatform/src/V1/PublisherModel.php
Apache-2.0
public function getPredictSchemata() { return $this->predict_schemata; }
Optional. The schemata that describes formats of the PublisherModel's predictions and explanations as given and returned via [PredictionService.Predict][google.cloud.aiplatform.v1.PredictionService.Predict]. Generated from protobuf field <code>.google.cloud.aiplatform.v1.PredictSchemata predict_schemata = 31 [(.google.api.field_behavior) = OPTIONAL];</code> @return \Google\Cloud\AIPlatform\V1\PredictSchemata|null
getPredictSchemata
php
googleapis/google-cloud-php
AiPlatform/src/V1/PublisherModel.php
https://github.com/googleapis/google-cloud-php/blob/master/AiPlatform/src/V1/PublisherModel.php
Apache-2.0
public function setPredictSchemata($var) { GPBUtil::checkMessage($var, \Google\Cloud\AIPlatform\V1\PredictSchemata::class); $this->predict_schemata = $var; return $this; }
Optional. The schemata that describes formats of the PublisherModel's predictions and explanations as given and returned via [PredictionService.Predict][google.cloud.aiplatform.v1.PredictionService.Predict]. Generated from protobuf field <code>.google.cloud.aiplatform.v1.PredictSchemata predict_schemata = 31 [(.google.api.field_behavior) = OPTIONAL];</code> @param \Google\Cloud\AIPlatform\V1\PredictSchemata $var @return $this
setPredictSchemata
php
googleapis/google-cloud-php
AiPlatform/src/V1/PublisherModel.php
https://github.com/googleapis/google-cloud-php/blob/master/AiPlatform/src/V1/PublisherModel.php
Apache-2.0
public function getParameterValue() { return $this->parameter_value; }
Required. The value mutation to perform. * Must be less than 100 characters. * To specify a constant value for the param, use the value's string. * To copy value from another parameter, use syntax like "[[other_parameter]]" For more details, see this [help center article](https://support.google.com/analytics/answer/10085872#modify-an-event&zippy=%2Cin-this-article%2Cmodify-parameters). Generated from protobuf field <code>string parameter_value = 2 [(.google.api.field_behavior) = REQUIRED];</code> @return string
getParameterValue
php
googleapis/google-cloud-php
AnalyticsAdmin/src/V1alpha/ParameterMutation.php
https://github.com/googleapis/google-cloud-php/blob/master/AnalyticsAdmin/src/V1alpha/ParameterMutation.php
Apache-2.0
public function setParameterValue($var) { GPBUtil::checkString($var, True); $this->parameter_value = $var; return $this; }
Required. The value mutation to perform. * Must be less than 100 characters. * To specify a constant value for the param, use the value's string. * To copy value from another parameter, use syntax like "[[other_parameter]]" For more details, see this [help center article](https://support.google.com/analytics/answer/10085872#modify-an-event&zippy=%2Cin-this-article%2Cmodify-parameters). Generated from protobuf field <code>string parameter_value = 2 [(.google.api.field_behavior) = REQUIRED];</code> @param string $var @return $this
setParameterValue
php
googleapis/google-cloud-php
AnalyticsAdmin/src/V1alpha/ParameterMutation.php
https://github.com/googleapis/google-cloud-php/blob/master/AnalyticsAdmin/src/V1alpha/ParameterMutation.php
Apache-2.0
public function setGcsSource($var) { GPBUtil::checkMessage($var, \Google\Cloud\AutoMl\V1\GcsSource::class); $this->writeOneof(1, $var); return $this; }
Required. The Google Cloud Storage location for the input content. Generated from protobuf field <code>.google.cloud.automl.v1.GcsSource gcs_source = 1 [(.google.api.field_behavior) = REQUIRED];</code> @param \Google\Cloud\AutoMl\V1\GcsSource $var @return $this
setGcsSource
php
googleapis/google-cloud-php
AutoMl/src/V1/BatchPredictInputConfig.php
https://github.com/googleapis/google-cloud-php/blob/master/AutoMl/src/V1/BatchPredictInputConfig.php
Apache-2.0
public function setConfig($var) { GPBUtil::checkMessage($var, \Google\Cloud\Compute\V1\SecurityPolicyRuleMatcherConfig::class); $this->config = $var; return $this; }
The configuration options available when specifying versioned_expr. This field must be specified if versioned_expr is specified and cannot be specified if versioned_expr is not specified. Generated from protobuf field <code>optional .google.cloud.compute.v1.SecurityPolicyRuleMatcherConfig config = 255820610;</code> @param \Google\Cloud\Compute\V1\SecurityPolicyRuleMatcherConfig $var @return $this
setConfig
php
googleapis/google-cloud-php
Compute/src/V1/SecurityPolicyRuleMatcher.php
https://github.com/googleapis/google-cloud-php/blob/master/Compute/src/V1/SecurityPolicyRuleMatcher.php
Apache-2.0
public function getExpr() { return $this->expr; }
User defined CEVAL expression. A CEVAL expression is used to specify match criteria such as origin.ip, source.region_code and contents in the request header. Expressions containing `evaluateThreatIntelligence` require Cloud Armor Managed Protection Plus tier and are not supported in Edge Policies nor in Regional Policies. Expressions containing `evaluatePreconfiguredExpr('sourceiplist-*')` require Cloud Armor Managed Protection Plus tier and are only supported in Global Security Policies. Generated from protobuf field <code>optional .google.cloud.compute.v1.Expr expr = 3127797;</code> @return \Google\Cloud\Compute\V1\Expr|null
getExpr
php
googleapis/google-cloud-php
Compute/src/V1/SecurityPolicyRuleMatcher.php
https://github.com/googleapis/google-cloud-php/blob/master/Compute/src/V1/SecurityPolicyRuleMatcher.php
Apache-2.0
public function setExpr($var) { GPBUtil::checkMessage($var, \Google\Cloud\Compute\V1\Expr::class); $this->expr = $var; return $this; }
User defined CEVAL expression. A CEVAL expression is used to specify match criteria such as origin.ip, source.region_code and contents in the request header. Expressions containing `evaluateThreatIntelligence` require Cloud Armor Managed Protection Plus tier and are not supported in Edge Policies nor in Regional Policies. Expressions containing `evaluatePreconfiguredExpr('sourceiplist-*')` require Cloud Armor Managed Protection Plus tier and are only supported in Global Security Policies. Generated from protobuf field <code>optional .google.cloud.compute.v1.Expr expr = 3127797;</code> @param \Google\Cloud\Compute\V1\Expr $var @return $this
setExpr
php
googleapis/google-cloud-php
Compute/src/V1/SecurityPolicyRuleMatcher.php
https://github.com/googleapis/google-cloud-php/blob/master/Compute/src/V1/SecurityPolicyRuleMatcher.php
Apache-2.0
public function getExprOptions() { return $this->expr_options; }
The configuration options available when specifying a user defined CEVAL expression (i.e., 'expr'). Generated from protobuf field <code>optional .google.cloud.compute.v1.SecurityPolicyRuleMatcherExprOptions expr_options = 486220372;</code> @return \Google\Cloud\Compute\V1\SecurityPolicyRuleMatcherExprOptions|null
getExprOptions
php
googleapis/google-cloud-php
Compute/src/V1/SecurityPolicyRuleMatcher.php
https://github.com/googleapis/google-cloud-php/blob/master/Compute/src/V1/SecurityPolicyRuleMatcher.php
Apache-2.0
public function setExprOptions($var) { GPBUtil::checkMessage($var, \Google\Cloud\Compute\V1\SecurityPolicyRuleMatcherExprOptions::class); $this->expr_options = $var; return $this; }
The configuration options available when specifying a user defined CEVAL expression (i.e., 'expr'). Generated from protobuf field <code>optional .google.cloud.compute.v1.SecurityPolicyRuleMatcherExprOptions expr_options = 486220372;</code> @param \Google\Cloud\Compute\V1\SecurityPolicyRuleMatcherExprOptions $var @return $this
setExprOptions
php
googleapis/google-cloud-php
Compute/src/V1/SecurityPolicyRuleMatcher.php
https://github.com/googleapis/google-cloud-php/blob/master/Compute/src/V1/SecurityPolicyRuleMatcher.php
Apache-2.0
public function getVersionedExpr() { return isset($this->versioned_expr) ? $this->versioned_expr : ''; }
Preconfigured versioned expression. If this field is specified, config must also be specified. Available preconfigured expressions along with their requirements are: SRC_IPS_V1 - must specify the corresponding src_ip_range field in config. Check the VersionedExpr enum for the list of possible values. Generated from protobuf field <code>optional string versioned_expr = 322286013;</code> @return string
getVersionedExpr
php
googleapis/google-cloud-php
Compute/src/V1/SecurityPolicyRuleMatcher.php
https://github.com/googleapis/google-cloud-php/blob/master/Compute/src/V1/SecurityPolicyRuleMatcher.php
Apache-2.0
public function setVersionedExpr($var) { GPBUtil::checkString($var, True); $this->versioned_expr = $var; return $this; }
Preconfigured versioned expression. If this field is specified, config must also be specified. Available preconfigured expressions along with their requirements are: SRC_IPS_V1 - must specify the corresponding src_ip_range field in config. Check the VersionedExpr enum for the list of possible values. Generated from protobuf field <code>optional string versioned_expr = 322286013;</code> @param string $var @return $this
setVersionedExpr
php
googleapis/google-cloud-php
Compute/src/V1/SecurityPolicyRuleMatcher.php
https://github.com/googleapis/google-cloud-php/blob/master/Compute/src/V1/SecurityPolicyRuleMatcher.php
Apache-2.0
public function getRoleId() { return $this->role_id; }
Output only. `Role` ID. Generated from protobuf field <code>int64 role_id = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> @return int|string
getRoleId
php
googleapis/google-cloud-php
AdsAdManager/src/V1/Role.php
https://github.com/googleapis/google-cloud-php/blob/master/AdsAdManager/src/V1/Role.php
Apache-2.0
public function setRoleId($var) { GPBUtil::checkInt64($var); $this->role_id = $var; return $this; }
Output only. `Role` ID. Generated from protobuf field <code>int64 role_id = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> @param int|string $var @return $this
setRoleId
php
googleapis/google-cloud-php
AdsAdManager/src/V1/Role.php
https://github.com/googleapis/google-cloud-php/blob/master/AdsAdManager/src/V1/Role.php
Apache-2.0
public function getBuiltIn() { return $this->built_in; }
Output only. Whether the `Role` is a built-in or custom user role. Generated from protobuf field <code>bool built_in = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> @return bool
getBuiltIn
php
googleapis/google-cloud-php
AdsAdManager/src/V1/Role.php
https://github.com/googleapis/google-cloud-php/blob/master/AdsAdManager/src/V1/Role.php
Apache-2.0
public function setBuiltIn($var) { GPBUtil::checkBool($var); $this->built_in = $var; return $this; }
Output only. Whether the `Role` is a built-in or custom user role. Generated from protobuf field <code>bool built_in = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> @param bool $var @return $this
setBuiltIn
php
googleapis/google-cloud-php
AdsAdManager/src/V1/Role.php
https://github.com/googleapis/google-cloud-php/blob/master/AdsAdManager/src/V1/Role.php
Apache-2.0
public function setStatus($var) { GPBUtil::checkEnum($var, \Google\Ads\AdManager\V1\RoleStatusEnum\RoleStatus::class); $this->status = $var; return $this; }
Output only. The status of the `Role`. Generated from protobuf field <code>.google.ads.admanager.v1.RoleStatusEnum.RoleStatus status = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> @param int $var @return $this
setStatus
php
googleapis/google-cloud-php
AdsAdManager/src/V1/Role.php
https://github.com/googleapis/google-cloud-php/blob/master/AdsAdManager/src/V1/Role.php
Apache-2.0
public function setOperations($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\LongRunning\Operation::class); $this->operations = $arr; return $this; }
The list of matching instance configuration long-running operations. Each operation's name will be prefixed by the name of the instance configuration. The operation's metadata field type `metadata.type_url` describes the type of the metadata. Generated from protobuf field <code>repeated .google.longrunning.Operation operations = 1;</code> @param array<\Google\LongRunning\Operation>|\Google\Protobuf\Internal\RepeatedField $var @return $this
setOperations
php
googleapis/google-cloud-php
Spanner/src/Admin/Instance/V1/ListInstanceConfigOperationsResponse.php
https://github.com/googleapis/google-cloud-php/blob/master/Spanner/src/Admin/Instance/V1/ListInstanceConfigOperationsResponse.php
Apache-2.0
public function getFederationId() { return $this->federation_id; }
Required. The ID of the metastore federation, which is used as the final component of the metastore federation's name. This value must be between 2 and 63 characters long inclusive, begin with a letter, end with a letter or number, and consist of alpha-numeric ASCII characters or hyphens. Generated from protobuf field <code>string federation_id = 2 [(.google.api.field_behavior) = REQUIRED];</code> @return string
getFederationId
php
googleapis/google-cloud-php
DataprocMetastore/src/V1beta/CreateFederationRequest.php
https://github.com/googleapis/google-cloud-php/blob/master/DataprocMetastore/src/V1beta/CreateFederationRequest.php
Apache-2.0
public function setFederationId($var) { GPBUtil::checkString($var, True); $this->federation_id = $var; return $this; }
Required. The ID of the metastore federation, which is used as the final component of the metastore federation's name. This value must be between 2 and 63 characters long inclusive, begin with a letter, end with a letter or number, and consist of alpha-numeric ASCII characters or hyphens. Generated from protobuf field <code>string federation_id = 2 [(.google.api.field_behavior) = REQUIRED];</code> @param string $var @return $this
setFederationId
php
googleapis/google-cloud-php
DataprocMetastore/src/V1beta/CreateFederationRequest.php
https://github.com/googleapis/google-cloud-php/blob/master/DataprocMetastore/src/V1beta/CreateFederationRequest.php
Apache-2.0
public function getFederation() { return $this->federation; }
Required. The Metastore Federation to create. The `name` field is ignored. The ID of the created metastore federation must be provided in the request's `federation_id` field. Generated from protobuf field <code>.google.cloud.metastore.v1beta.Federation federation = 3 [(.google.api.field_behavior) = REQUIRED];</code> @return \Google\Cloud\Metastore\V1beta\Federation|null
getFederation
php
googleapis/google-cloud-php
DataprocMetastore/src/V1beta/CreateFederationRequest.php
https://github.com/googleapis/google-cloud-php/blob/master/DataprocMetastore/src/V1beta/CreateFederationRequest.php
Apache-2.0
public function setFederation($var) { GPBUtil::checkMessage($var, \Google\Cloud\Metastore\V1beta\Federation::class); $this->federation = $var; return $this; }
Required. The Metastore Federation to create. The `name` field is ignored. The ID of the created metastore federation must be provided in the request's `federation_id` field. Generated from protobuf field <code>.google.cloud.metastore.v1beta.Federation federation = 3 [(.google.api.field_behavior) = REQUIRED];</code> @param \Google\Cloud\Metastore\V1beta\Federation $var @return $this
setFederation
php
googleapis/google-cloud-php
DataprocMetastore/src/V1beta/CreateFederationRequest.php
https://github.com/googleapis/google-cloud-php/blob/master/DataprocMetastore/src/V1beta/CreateFederationRequest.php
Apache-2.0