_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 33 8k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q256900 | Papi_Entry_Type.convert_properties | test | protected function convert_properties( $properties ) {
if ( is_array( $properties ) ) {
if ( isset( $properties['type'] ) ) {
$properties = [$properties];
} else if ( isset( $properties[0] ) && $properties[0] instanceof Papi_Core_Tab ) {
foreach ( $properties as $items ) {
$items->properties = arra... | php | {
"resource": ""
} |
q256901 | Papi_Entry_Type.get_body_classes | test | public function get_body_classes() {
$arr = $this->body_classes();
$arr = is_string( $arr ) ? [$arr] : $arr;
| php | {
"resource": ""
} |
q256902 | Papi_Entry_Type.get_boxes | test | public function get_boxes() {
if ( empty( $this->boxes ) && $this->load_boxes === false ) {
if ( ! method_exists( $this, 'register' ) ) {
return [];
}
$this->load_boxes = true;
$this->call_parent_register();
$this->register();
}
// Merge boxes, e.g a parent box with a child box.
$this->box... | php | {
"resource": ""
} |
q256903 | Papi_Entry_Type.get_property | test | public function get_property( $slug, $child_slug = '' ) {
$boxes = $this->get_boxes();
$parts = preg_match( '/\[\d+\]/', $slug ) ? preg_split( '/\[\d+\]/', $slug ) : explode( '[', $slug );
$parts = array_map( function ( $part ) {
return preg_replace( '/(\[|\])/', '', $part );
}, $parts );
if ( count( $par... | php | {
"resource": ""
} |
q256904 | Papi_Entry_Type.get_properties | test | public function get_properties() {
$boxes = $this->get_boxes();
$list = [];
foreach ( $boxes as $box ) {
| php | {
"resource": ""
} |
q256905 | Papi_Entry_Type.merge_boxes | test | protected function merge_boxes( array $boxes ) {
$result = [];
foreach ( $boxes as $box ) {
if ( ! isset( $result[$box->id] ) ) {
$result[$box->id] = $box;
| php | {
"resource": ""
} |
q256906 | Papi_Entry_Type.setup | test | public function setup() {
add_action( 'in_admin_header', [$this, 'add_help_tabs'] );
add_filter( 'screen_options_show_screen', function () {
return $this->show_screen_options;
} );
// @codeCoverageIgnoreStart
if ( ! method_exists( $this, 'register' ) | php | {
"resource": ""
} |
q256907 | Papi_Entry_Type.tab | test | protected function tab( $file_or_options = [], $properties = [] ) {
if ( ! is_string( $file_or_options ) && ! is_array( $file_or_options ) ) { | php | {
"resource": ""
} |
q256908 | Papi_Property_Link.load_value | test | public function load_value( $value, $slug, $post_id ) {
if ( is_array( $value ) || is_object( $value ) ) {
$values = $value;
} else {
$values = $this->link_fields;
foreach ( $values as $index => $key ) {
$values[$key] = papi_data_get(
$post_id,
sprintf( '%s_%s', $slug, $key ),
| php | {
"resource": ""
} |
q256909 | Papi_Property_Link.prepare_link_array | test | protected function prepare_link_array( $link, $slug ) {
$array = is_array( $link );
$values = (array) $link;
foreach ( $values as $key => $val ) {
unset( $values[$key] );
$key = preg_replace( '/^' . $slug . '\_/', '', $key );
$values[$key] = $val;
}
$link = (object) $values;
// Don't continue w... | php | {
"resource": ""
} |
q256910 | Papi_Property_Link.update_value | test | public function update_value( $values, $slug, $post_id ) {
if ( is_object( $values ) ) {
$values = (array) $values;
}
if ( ! isset( $values['url'] ) ) {
$values = $this->link_fields;
foreach ( $values as $index => $key ) {
$values[sprintf( '%s_%s', $slug, $key )] = '';
unset( $values[$index] );... | php | {
"resource": ""
} |
q256911 | Papi_Taxonomy_Type.allowed | test | public function allowed() {
$args = func_get_args();
if ( empty( $args ) ) | php | {
"resource": ""
} |
q256912 | Papi_Taxonomy_Type.edit_form | test | public function edit_form() {
?>
<div id="papi-hidden-editor" class="hide-if-js">
<?php wp_editor( '', 'papiHiddenEditor' ); ?>
</div>
<div id="poststuff">
<div id="post-body">
<?php
| php | {
"resource": ""
} |
q256913 | Papi_REST_API_Post.get_post | test | public function get_post( WP_Post $post ) {
if ( ! ( $page_type = papi_get_entry_type_by_meta_id( $post->ID ) ) ) {
return $post;
}
// Register all properties fields with register meta.
foreach ( $page_type->get_properties() as $property ) {
$property->register();
} | php | {
"resource": ""
} |
q256914 | Papi_REST_API_Post.prepare_response | test | public function prepare_response( $response ) {
if ( ! isset( $response->data['meta'] ) ) {
return $response;
}
foreach ( $response->data['meta'] as $key => $value ) {
| php | {
"resource": ""
} |
q256915 | Papi_REST_API_Post.setup_fields | test | public function setup_fields() {
if ( ! function_exists( 'register_rest_field' ) ) {
return;
}
$post_types = papi_get_post_types();
foreach ( $post_types as $post_type | php | {
"resource": ""
} |
q256916 | Papi_CLI_Command.get_format_args | test | protected function get_format_args( $assoc_args ) {
$format_args = [
'fields' => $this->get_default_format_fields(),
'field' => null,
'format' => 'table',
];
if ( isset( $assoc_args['fields'] ) ) {
$format_args['fields'] = $assoc_args['fields']; | php | {
"resource": ""
} |
q256917 | Papi_Admin_View.render | test | public function render( $file ) {
if ( ! empty( $file | php | {
"resource": ""
} |
q256918 | Papi_Core_Box.get_option | test | public function get_option( $key ) {
return | php | {
"resource": ""
} |
q256919 | Papi_Core_Conditional_Rules.convert_prop | test | protected function convert_prop( $value, Papi_Core_Conditional_Rule $rule ) {
$meta_id = papi_get_meta_id();
$meta_type = papi_get_meta_type();
$entry_type = papi_get_entry_type_by_meta_id( $meta_id, $meta_type );
if ( ! papi_is_empty( $value ) && $entry_type instanceof Papi_Entry_Type !== false ) {
$pr... | php | {
"resource": ""
} |
q256920 | Papi_Core_Conditional_Rules.get_converted_value | test | protected function get_converted_value( Papi_Core_Conditional_Rule $rule ) {
$value = $this->get_value( $rule );
// Convert numeric values.
if ( is_numeric( $value ) && is_numeric( $rule->value ) ) {
return [
$this->convert_number( $value ),
$this->convert_number( $rule->value )
];
}
// Conver... | php | {
"resource": ""
} |
q256921 | Papi_Core_Conditional_Rules.get_deep_value | test | protected function get_deep_value( $slug, $value ) {
$slugs = explode( '.', $slug );
array_shift( $slugs );
| php | {
"resource": ""
} |
q256922 | Papi_Core_Conditional_Rules.get_value | test | protected function get_value( Papi_Core_Conditional_Rule $rule ) {
if ( papi_doing_ajax() ) {
$source = $rule->get_source();
$meta_id = papi_get_meta_id();
$entry_type = papi_get_entry_type_by_meta_id( $meta_id );
if ( ! papi_is_empty( $source ) && $entry_type instanceof Papi_Entry_Type !== false ... | php | {
"resource": ""
} |
q256923 | Papi_Core_Conditional_Rules.rule_equal | test | public function rule_equal( Papi_Core_Conditional_Rule $rule ) {
list( $value, $rule_value ) = | php | {
"resource": ""
} |
q256924 | Papi_Core_Conditional_Rules.rule_not_equal | test | public function rule_not_equal( Papi_Core_Conditional_Rule $rule ) {
list( $value, $rule_value | php | {
"resource": ""
} |
q256925 | Papi_Core_Conditional_Rules.rule_greater_then | test | public function rule_greater_then( Papi_Core_Conditional_Rule $rule ) {
$value = $this->get_value( $rule );
if ( is_array( $value ) ) {
$value = count( $value );
}
if ( ! is_numeric( | php | {
"resource": ""
} |
q256926 | Papi_Core_Conditional_Rules.rule_not_in | test | public function rule_not_in( Papi_Core_Conditional_Rule $rule ) {
list( $value, $rule_value ) = $this->get_converted_value( $rule );
if ( ! is_array( | php | {
"resource": ""
} |
q256927 | Papi_Core_Conditional_Rules.rule_like | test | public function rule_like( Papi_Core_Conditional_Rule $rule ) {
$value = $this->get_value( $rule );
if ( ! is_string( $value ) ) {
$value = papi_convert_to_string( $value );
}
if ( papi_is_empty( | php | {
"resource": ""
} |
q256928 | Papi_Core_Conditional_Rules.get_between_values | test | protected function get_between_values( Papi_Core_Conditional_Rule $rule ) {
$value = $this->get_value( $rule );
if ( ! is_array( $rule->value ) ) {
return [$rule, false];
}
foreach ( $rule->value as $index => $v ) {
$v = $this->convert_number( $v );
if ( is_numeric( $v ) ) {
$rule->value[$index]... | php | {
"resource": ""
} |
q256929 | Papi_Core_Conditional_Rules.rule_between | test | public function rule_between( Papi_Core_Conditional_Rule $rule ) {
list( $rule, $value ) = $this->get_between_values( $rule | php | {
"resource": ""
} |
q256930 | Papi_Core_Conditional_Rules.rule_not_between | test | public function rule_not_between( Papi_Core_Conditional_Rule $rule ) {
list( $rule, $value ) = $this->get_between_values( $rule );
if ( $value === false ) {
return false;
| php | {
"resource": ""
} |
q256931 | Papi_Property_Relationship.get_sort_option | test | public function get_sort_option( $post_id ) {
$slug = $this->html_id( 'sort_option' );
$slug = str_replace( '][', '_', | php | {
"resource": ""
} |
q256932 | Papi_Property_Relationship.get_sort_options | test | public static function get_sort_options() {
$sort_options = [];
$sort_options[__( 'Select', 'papi' )] = null;
$sort_options[__( 'Name (alphabetically)', 'papi' )] = function ( $a, $b ) {
// Backwards compatibility with both `post_title` and `title`.
return strcmp(
strtolower( isset( $a->post_title ) ?... | php | {
"resource": ""
} |
q256933 | Papi_Property_Relationship.get_items | test | protected function get_items( $settings ) {
if ( is_array( $settings->items ) && ! empty( $settings->items ) ) {
$mapping = function ( $item ) {
return is_array( $item ) ?
isset( $item['id'], $item['title'] ) :
isset( $item->id, $item->title );
};
return array_map(
'papi_maybe_convert_to_o... | php | {
"resource": ""
} |
q256934 | Papi_Property_Relationship.sort_value | test | public function sort_value( $values, $slug, $post_id ) {
$sort_option = $this->get_sort_option( $post_id );
$sort_options = static::get_sort_options();
| php | {
"resource": ""
} |
q256935 | Papi_Property_Relationship.update_value | test | public function update_value( $values, $slug, $post_id ) {
$values = $this->format_value( $values, $slug, $post_id );
$values = array_map( function ( $item ) {
| php | {
"resource": ""
} |
q256936 | Papi_CLI_Type_Command.get_meta_type_value | test | protected function get_meta_type_value( $entry_type ) {
if ( in_array( $entry_type->get_type(), ['attachment'], true ) ) {
return $entry_type->get_type();
}
switch ( papi_get_meta_type( $entry_type->get_type() ) ) {
case 'post': | php | {
"resource": ""
} |
q256937 | Papi_CLI_Type_Command.list_ | test | public function list_( $args, $assoc_args ) {
// Get all entry types.
$entry_types = papi_get_all_entry_types();
if ( empty( $entry_types ) ) {
WP_CLI::error( 'No Papi types exists.' );
}
// Create type item with the fields that
// will be displayed.
$entry_types = array_map( function( $entry_type ) ... | php | {
"resource": ""
} |
q256938 | Papi_Admin_Meta_Box_Tabs.html | test | protected function html() {
?>
<div class="papi-tabs-wrapper">
<div class="papi-tabs-table-back"></div>
<div class="papi-tabs-back"></div>
<ul class="papi-tabs">
<?php
foreach ( $this->tabs as $tab ):
$css_classes = $this->tabs[0] === $tab ? 'active ' : '';
if ( empty( $tab->background )... | php | {
"resource": ""
} |
q256939 | Papi_Property_Flexible.get_json_id | test | protected function get_json_id( $key, $extra = '' ) {
return $this->get_slug() . '_' . | php | {
"resource": ""
} |
q256940 | Papi_Property_Flexible.get_layout | test | protected function get_layout( $slug ) {
$layouts = $this->get_settings_layouts();
| php | {
"resource": ""
} |
q256941 | Papi_Property_Flexible.load_value | test | public function load_value( $value, $repeater_slug, $post_id ) {
if ( is_array( $value ) ) {
return $value;
}
list( $results, $trash ) = $this->get_results( $value, $repeater_slug, $post_id );
// Will not need this array.
unset( $trash );
$store | php | {
"resource": ""
} |
q256942 | Papi_Property_Flexible.prepare_properties | test | protected function prepare_properties( $layouts ) {
$layouts = array_map( function ( $layout ) {
return (array) $layout;
}, $layouts );
foreach ( $layouts as $index => $layout ) {
if ( ! $this->valid_layout( $layout ) ) {
if ( is_array( $layout ) ) {
unset( $layout[$index] );
} else {
uns... | php | {
"resource": ""
} |
q256943 | Papi_Property_Flexible.render_layout_input | test | protected function render_layout_input( $value ) {
$slug = sprintf( '%s[%d][%s]', $this->get_slug(), $this->counter, $this->layout_key );
?>
<input type="hidden" | php | {
"resource": ""
} |
q256944 | Papi_Property_Flexible.render_repeater_row | test | protected function render_repeater_row() {
$layouts = $this->get_settings_layouts();
$values = $this->get_value();
// Fetch all slugs in all layouts.
$slugs = [];
foreach ( $layouts as $index => $layout ) {
foreach ( $layout['items'] as $item ) {
$slugs[] = unpapify( $item->slug );
}
}
// Rem... | php | {
"resource": ""
} |
q256945 | Papi_Admin_Entry_Taxonomy.add_form_fields | test | public function add_form_fields() {
$html_name = esc_attr( papi_get_page_type_key() );
$taxonomy = papi_get_qs( 'taxonomy' );
$taxonomy_object = get_taxonomy( $taxonomy );
// Get only the taxonomy types that has the taxonomy.
$taxonomy_types = array_filter( $this->taxonomy_types, function ( $tax... | php | {
"resource": ""
} |
q256946 | Papi_Admin_Entry_Taxonomy.prepare_taxonomy_types | test | protected function prepare_taxonomy_types( array $taxonomy_types ) {
$taxonomy = papi_get_qs( 'taxonomy' );
if ( papi_filter_settings_show_standard_taxonomy_type( $taxonomy ) ) {
$id = sprintf( 'papi-standard-%s-type', $taxonomy );
$taxonomy_type = new Papi_Taxonomy_Type( $id )... | php | {
"resource": ""
} |
q256947 | Papi_Admin_Entry_Taxonomy.setup_taxonomies_hooks | test | public function setup_taxonomies_hooks() {
$this->taxonomy_types = papi_get_all_entry_types( [
'types' => 'taxonomy'
] );
$taxonomies = array_reduce( $this->taxonomy_types, function ( $taxonomies, $taxonomy_type ) {
return array_merge( $taxonomies, $taxonomy_type->taxonomy );
}, [] );
$taxonomies | php | {
"resource": ""
} |
q256948 | Papi_Admin_Ajax.ajax_url | test | public function ajax_url() {
if ( empty( $this->structure ) ) {
$url = esc_url( home_url( 'index.php', is_ssl() ? 'https' : 'http' ) );
} else {
$url = esc_url( home_url( '/papi-ajax/', is_ssl() ? 'https' : 'http' ) );
| php | {
"resource": ""
} |
q256949 | Papi_Admin_Ajax.handle_papi_ajax | test | public function handle_papi_ajax() {
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
return;
}
$ajax_action = '';
if ( ! empty( $_GET['action'] ) ) {
$ajax_action = sanitize_text_field( $_GET['action'] );
}
if ( is_user_logged_in() && has_action( $this->action_prefix . $ajax_action ) !== false ) {
... | php | {
"resource": ""
} |
q256950 | Papi_Admin_Ajax.get_entry_type | test | public function get_entry_type() {
$entry_type_id = papi_get_qs( 'entry_type' );
$entry_type = papi_get_entry_type_by_id( $entry_type_id | php | {
"resource": ""
} |
q256951 | Papi_Admin_Ajax.get_posts | test | public function get_posts() {
$args = papi_get_qs( 'query' ) ?: [];
$args = is_array( $args ) ? $args : [];
$fields = papi_get_qs( 'fields' ) ?: [];
$fields = is_array( $fields ) ? $fields : [];
$posts = ( new WP_Query( array_merge( [
'posts_per_page' => -1,
'post_status' => 'any... | php | {
"resource": ""
} |
q256952 | Papi_Admin_Ajax.get_property | test | public function get_property() {
$default_options = Papi_Core_Property::factory()->get_options();
$keys = array_keys( get_object_vars( $default_options ) );
$options = papi_get_qs( $keys, | php | {
"resource": ""
} |
q256953 | Papi_Admin_Ajax.get_properties | test | public function get_properties() {
if ( ! papi_get_sanitized_post( 'properties' ) ) {
$this->render_error( 'No properties found' );
return;
}
$items = json_decode( stripslashes( $_POST['properties'] ), true );
if ( empty( $items ) || ! is_array( $items ) ) {
$this->render_error( 'No properties found... | php | {
"resource": ""
} |
q256954 | Papi_Admin_Ajax.get_rules_result | test | public function get_rules_result() {
if ( ! papi_get_sanitized_post( 'data' ) ) {
$this->render_error( 'No rule found' );
return;
}
$data = json_decode( stripslashes( papi_get_sanitized_post( 'data' ) ), true );
if ( empty( $data ) || ! is_array( $data ) || ! isset( $data['slug'] ) ) {
$this->render... | php | {
"resource": ""
} |
q256955 | Papi_Admin_Ajax.get_shortcode | test | public function get_shortcode() {
$shortcode = papi_get_qs( 'shortcode' ) ?: '';
$shortcode = | php | {
"resource": ""
} |
q256956 | Papi_Admin_Ajax.get_terms | test | public function get_terms() {
$query = papi_get_qs( 'query' ) ?: [];
$query = is_array( $query ) ? $query : [];
$taxonomy = papi_get_qs( 'taxonomy' ) | php | {
"resource": ""
} |
q256957 | Papi_CLI_Term_Command.get | test | public function get( $args, $assoc_args ) {
try {
// Set query string that we need.
$_GET['meta_type'] = 'term';
// Get the taxonomy type that the term has.
$entry_type = papi_get_entry_type_by_meta_id( $args[0] );
if ( empty( $entry_type ) || $entry_type instanceof Papi_Taxonomy_Type === false ) {
... | php | {
"resource": ""
} |
q256958 | Papi_CLI_Term_Command.rename | test | public function rename( $args, $assoc_args ) {
$type = $args[0];
$old_key = $args[1];
$new_key = $args[2];
$terms = ( new Papi_Query( [
'entry_type' => $type,
'fields' => 'ids'
] ) )->get_result();
if ( empty( $terms ) ) {
WP_CLI::error( 'No terms found' );
}
foreach ( $terms as $term... | php | {
"resource": ""
} |
q256959 | Papi_Admin_Columns.manage_page_type_posts_columns | test | public function manage_page_type_posts_columns( array $defaults = [] ) {
if ( ! in_array( $this->post_type, papi_get_post_types(), true ) && ! in_array( $this->taxonomy, papi_get_taxonomies(), true ) ) {
return $defaults;
}
/**
* Hide column for post or taxonomy type. Default is false.
*
* @param str... | php | {
"resource": ""
} |
q256960 | Papi_Admin_Columns.manage_page_type_posts_custom_column | test | public function manage_page_type_posts_custom_column( $column_name, $post_id, $term_id = null ) {
if ( ! in_array( $this->post_type, papi_get_post_types(), true ) && ! in_array( $this->taxonomy, papi_get_taxonomies(), true ) ) {
return;
}
/**
* Hide column for post type. Default is false.
*
* @param ... | php | {
"resource": ""
} |
q256961 | Papi_Admin_Columns.manage_page_type_sortable_columns | test | public function manage_page_type_sortable_columns( $columns ) {
if ( in_array( $this->post_type, papi_get_post_types(), true ) || in_array( | php | {
"resource": ""
} |
q256962 | Papi_Admin_Columns.pre_get_posts | test | public function pre_get_posts( WP_Query $query ) {
global $pagenow;
if ( $pagenow === 'edit.php' && ! is_null( papi_get_qs( 'page_type' ) ) ) {
if ( papi_get_qs( 'page_type' ) === 'papi-standard-page' ) {
$query->set( 'meta_query', [
[
'key' => papi_get_page_type_key(),
'compare' => 'NO... | php | {
"resource": ""
} |
q256963 | Papi_Admin_Columns.restrict_page_types | test | public function restrict_page_types() {
$post_types = papi_get_post_types();
if ( in_array( $this->post_type, $post_types, true ) ) {
$page_types = papi_get_all_page_types( $this->post_type );
$page_types = array_map( function ( $page_type ) {
return [
'name' => $page_type->name,
'value' => $p... | php | {
"resource": ""
} |
q256964 | Papi_Property_Term.format_value | test | public function format_value( $value, $slug, $term_id ) {
$meta_key = $this->get_setting( 'meta_key' );
if ( empty( $meta_key ) ) {
if ( is_numeric( $value ) && intval( $value ) !== 0 ) {
$term_id = $value;
}
} else {
$args = [
'fields' => 'ids',
'meta_key' => $meta_key,
'meta_valu... | php | {
"resource": ""
} |
q256965 | Papi_Property_Term.get_labels | test | protected function get_labels() {
$results = [];
foreach ( $this->get_taxonomies() as $taxonomy ) {
if ( taxonomy_exists( $taxonomy ) ) {
$taxonomy_object = get_taxonomy( $taxonomy );
| php | {
"resource": ""
} |
q256966 | Papi_Property_Term.get_terms | test | protected function get_terms( $taxonomy ) {
// Prepare arguments for get_terms.
$query = $this->get_setting( 'query' );
$args = array_merge( $query, [
'fields' => 'id=>name'
] );
| php | {
"resource": ""
} |
q256967 | Papi_Property_Term.get_term_value | test | protected function get_term_value( $term ) {
$meta_key = $this->get_setting( 'meta_key' );
if ( is_numeric( $term ) ) {
$term_id = $term;
} else {
$term = get_term( $term );
if ( $term instanceof WP_Term === false ) {
return 0;
}
$term_id = $term->term_id;
}
| php | {
"resource": ""
} |
q256968 | Papi_Property_Bool.prepare_value | test | protected function prepare_value( $value ) {
if ( is_string( $value ) && ( $value === 'true' || $value === 'on' | php | {
"resource": ""
} |
q256969 | ApiClient.search | test | public function search($searchTerm)
{
$url = 'https://finance.yahoo.com/_finance_doubledown/api/resource/searchassist;gossipConfig=%7B%22queryKey%22:%22query%22,%22resultAccessor%22:%22ResultSet.Result%22,%22suggestionTitleAccessor%22:%22symbol%22,%22suggestionMeta%22:[%22symbol%22],%22url%22:%7B%22query%22... | php | {
"resource": ""
} |
q256970 | ApiClient.getHistoricalData | test | public function getHistoricalData($symbol, $interval, \DateTime $startDate, \DateTime $endDate)
{
$allowedIntervals = [self::INTERVAL_1_DAY, self::INTERVAL_1_WEEK, self::INTERVAL_1_MONTH];
if (!in_array($interval, $allowedIntervals)) {
throw new \InvalidArgumentException('Interval must b... | php | {
"resource": ""
} |
q256971 | ApiClient.getQuote | test | public function getQuote($symbol)
{
$list = $this->fetchQuotes([$symbol]);
| php | {
"resource": ""
} |
q256972 | ApiClient.getExchangeRate | test | public function getExchangeRate($currency1, $currency2)
{
$list | php | {
"resource": ""
} |
q256973 | ApiClient.getExchangeRates | test | public function getExchangeRates(array $currencyPairs)
{
$currencySymbols = array_map(function (array $currencies) {
| php | {
"resource": ""
} |
q256974 | ApiClient.fetchQuotes | test | private function fetchQuotes(array $symbols)
{
$url = 'https://query1.finance.yahoo.com/v7/finance/quote?symbols='.urlencode(implode(',', $symbols));
| php | {
"resource": ""
} |
q256975 | BaseColumn.getAttributesForHeader | test | protected function getAttributesForHeader()
{
$attributes = [];
if ( ! $this->isSortable())
{
$attributes['data-sortable'] = | php | {
"resource": ""
} |
q256976 | BaseColumn.render | test | public function render($instance, $totalCount, $content = null)
{
if (is_null($content))
{
$content = $this->valueFromInstance($instance, $this->name);
}
$content = $this->renderAppends($instance, | php | {
"resource": ""
} |
q256977 | BaseColumn.renderAppends | test | protected function renderAppends($instance, $totalCount, $content)
{
$appends = [$content];
foreach ($this->appends as $append)
{ | php | {
"resource": ""
} |
q256978 | ImagesController.getAll | test | public function getAll()
{
$files = $this->getAllFiles();
$result = []; | php | {
"resource": ""
} |
q256979 | ModelItem.with | test | public function with($params = null)
{
if ( ! is_array($params))
{
$params = func_get_args(); | php | {
"resource": ""
} |
q256980 | Form.setDefaults | test | public function setDefaults()
{
foreach ($this->items as $item)
{
$name = $item->getName();
if ( ! is_null($name) && ! | php | {
"resource": ""
} |
q256981 | Title.get | test | public function get($parameter)
{
if ( ! is_null($this->staticTitle)) return $this->staticTitle;
if (is_null($this->from))
{
throw new TitleNotFormattedException;
}
$from = $this->from;
$property = $this->field;
$model = new $this->from;
| php | {
"resource": ""
} |
q256982 | FormBuilder.makeGroup | test | protected function makeGroup($name, $label, $formElement)
{
$content = '';
$content .= $this->label($name, $label);
$content .= | php | {
"resource": ""
} |
q256983 | FormBuilder.wrapContent | test | protected function wrapContent($name, $content)
{
$content .= $this->errors->first($name, $this->getErrorTemplate());
$class | php | {
"resource": ""
} |
q256984 | FormBuilder.wrapGroup | test | protected function wrapGroup($content, array $options = [])
{
$options = $this->addClassToOptions($this->getFormGroupClass(), | php | {
"resource": ""
} |
q256985 | FormBuilder.addClassToOptions | test | protected function addClassToOptions($classToAdd, array $options = [])
{
$class = array_get($options, 'class', '');
if (is_array($class))
{
$class[] = $classToAdd;
} elseif ( ! empty($class))
| php | {
"resource": ""
} |
q256986 | Router.registerRoutes | test | public function registerRoutes()
{
$this->registerAssetsRoutes();
$this->registerAuthRoutes();
$this->registerImageCacheRoute();
$models = Admin::instance()->models->getAllAliases();
$this->laravelRouter->group([
'prefix' => $this->prefix,
'before' => $this->getBeforeFilters(),
'namespace' =... | php | {
"resource": ""
} |
q256987 | Router.registerAssetsRoutes | test | protected function registerAssetsRoutes()
{
# CKEditor file listing and upload
$this->laravelRouter->group([
'before' => $this->getBeforeFilters(),
'prefix' => 'images',
'namespace' => 'SleepingOwl\Admin\Controllers'
], function ()
{
$this->laravelRouter->get('all', 'ImagesController@getAll')... | php | {
"resource": ""
} |
q256988 | Router.registerAuthRoutes | test | protected function registerAuthRoutes()
{
$this->laravelRouter->group([
'prefix' => $this->prefix,
'namespace' => 'SleepingOwl\Admin\Controllers'
], function ()
{
$this->laravelRouter->get('login', [
'as' => $this->routePrefix . '.login', | php | {
"resource": ""
} |
q256989 | ProcessSet.add | test | public function add(ProcessWrapper $processWrapper): void
{
$className = $processWrapper->getClassName();
if (isset($this->processes[$className])) {
throw new \InvalidArgumentException(
sprintf(
'Testcase with name "%s" was already added, make sure you... | php | {
"resource": ""
} |
q256990 | ProcessSet.get | test | public function get(string $status): array
{
Assertion::choice($status, ProcessWrapper::PROCESS_STATUSES);
$return = [];
foreach ($this->processes as $className => $processWrapper) {
| php | {
"resource": ""
} |
q256991 | ProcessSet.buildTree | test | public function buildTree(): OutTree
{
if ($this->tree === null) {
$root = $this->graph->createVertex(0);
// Create edges directed from the root node
foreach ($this->processes as $className => $processWrapper) {
$vertex = $this->graph->getVertex($classNam... | php | {
"resource": ""
} |
q256992 | ProcessSet.optimizeOrder | test | public function optimizeOrder(OptimizeOrderInterface $optimizeStrategy): void
{
$optimizedOrder = $optimizeStrategy->optimize($this->buildTree());
// Sort the $optimizedOrder array to have the same order as corresponding array of processes
// (so that the array could be passed to array_mult... | php | {
"resource": ""
} |
q256993 | ProcessSet.countStatuses | test | public function countStatuses(): array
{
$statusesCount = [];
foreach (ProcessWrapper::PROCESS_STATUSES as | php | {
"resource": ""
} |
q256994 | ProcessSet.countResults | test | public function countResults(): array
{
$done = $this->get(ProcessWrapper::PROCESS_STATUS_DONE);
$doneClasses = [];
$resultsCount = [
ProcessWrapper::PROCESS_RESULT_PASSED => 0,
ProcessWrapper::PROCESS_RESULT_FAILED => 0,
ProcessWrapper::PROCESS_RESULT_FAT... | php | {
"resource": ""
} |
q256995 | ProcessSet.failDependants | test | public function failDependants(string $className): array
{
$descendantProcesses = $this->getDependencyTree($className);
$failedProcesses = [];
foreach ($descendantProcesses as $processClassName => $processWrapper) {
| php | {
"resource": ""
} |
q256996 | ProcessSet.getDependencyTree | test | protected function getDependencyTree(string $className): array
{
Assertion::notEmpty($this->tree, 'Cannot get dependency tree - the tree was not yet build using buildTree()');
$descendants = $this->tree->getVerticesDescendant($this->graph->getVertex($className));
/** @var ProcessWrapper[] ... | php | {
"resource": ""
} |
q256997 | StewardStyle.output | test | public function output(string $output, string $identifier): void
{
if (empty($output)) {
return;
}
$lines = explode("\n", $output);
foreach ($lines as $line) {
// color lines containing "[WARN]" or "[DEBUG]"
if (mb_strpos($line, '[WARN]') !== fal... | php | {
"resource": ""
} |
q256998 | StewardStyle.errorOutput | test | public function errorOutput(string $output, string $identifier): void
{
$output = rtrim($output);
if (empty($output)) {
return;
}
$lines = explode("\n", $output);
| php | {
"resource": ""
} |
q256999 | RunCommand.initialize | test | protected function initialize(InputInterface $input, OutputInterface $output): void
{
parent::initialize($input, $output);
$output->writeln(
sprintf(
'<info>Steward</info> <comment>%s</comment> is running the tests...%s',
$this->getApplication()->getVersi... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.