call_user_func_array example

/** * {@inheritdoc} */
  public function hasTag($tag) {
    return $this->query->hasTag($tag);
  }

  /** * {@inheritdoc} */
  public function hasAllTags() {
    return call_user_func_array([$this->query, 'hasAllTags']func_get_args());
  }

  /** * {@inheritdoc} */
  public function hasAnyTag() {
    return call_user_func_array([$this->query, 'hasAnyTag']func_get_args());
  }

  /** * {@inheritdoc} */
/** * {@inheritdoc} */
  public function getTitle(Request $request, Route $route) {
    $route_title = NULL;
    // A dynamic title takes priority. Route::getDefault() returns NULL if the     // named default is not set. By testing the value directly, we also avoid     // trying to use empty values.     if ($callback = $route->getDefault('_title_callback')) {
      $callable = $this->controllerResolver->getControllerFromDefinition($callback);
      $arguments = $this->argumentResolver->getArguments($request$callable);
      $route_title = call_user_func_array($callable$arguments);
    }
    elseif ($route->hasDefault('_title') && strlen($route->getDefault('_title')) > 0) {
      $title = $route->getDefault('_title');
      $options = [];
      if ($route->hasDefault('_title_context')) {
        $options['context'] = $route->getDefault('_title_context');
      }
      $args = [];
      if (($raw_parameters = $request->attributes->get('_raw_variables'))) {
        foreach ($raw_parameters->all() as $key => $value) {
          if (is_scalar($value)) {
            
'finished' => 1,
        'message'  => '',
      ];
    }
    else {
      $batch_context = $args[$last];
      unset($args[$last]);
    }
    $args = array_merge($args[&$batch_context]);

    // Call the batch operation function.     call_user_func_array($function$args);

    // If the batch operation is not finished we create a new queue task to     // continue the task. This is typically the translation import task.     if ($batch_context['finished'] < 1) {
      unset($batch_context['strings']);
      $this->queue->createItem([$function$args]);
    }
  }

}


    if (isset($definition['factory'])) {
      $factory = $definition['factory'];
      if (is_array($factory)) {
        $factory = $this->resolveServicesAndParameters([$factory[0]$factory[1]]);
      }
      elseif (!is_string($factory)) {
        throw new RuntimeException(sprintf('Cannot create service "%s" because of invalid factory', $id));
      }

      $service = call_user_func_array($factory$arguments);
    }
    else {
      $class = $this->frozen ? $definition['class'] : current($this->resolveServicesAndParameters([$definition['class']]));
      $service = new $class(...$arguments);
    }

    if (!isset($definition['shared']) || $definition['shared'] !== FALSE) {
      $this->services[$id] = $service;
    }

    if (isset($definition['calls'])) {
      
public static function register()
    {
        $handler = new static();

        self::$previous = set_error_handler([$handler, 'handleError']);

        return $handler;
    }

    public function handleError()
    {
        return \call_user_func_array(self::$previous, \func_get_args());
    }
}
$priority = $this->current_priority[ $nesting_level ];

            foreach ( $this->callbacks[ $priority ] as $the_ ) {
                if ( ! $this->doing_action ) {
                    $args[0] = $value;
                }

                // Avoid the array_slice() if possible.                 if ( 0 == $the_['accepted_args'] ) {
                    $value = call_user_func( $the_['function'] );
                } elseif ( $the_['accepted_args'] >= $num_args ) {
                    $value = call_user_func_array( $the_['function']$args );
                } else {
                    $value = call_user_func_array( $the_['function']array_slice( $args, 0, (int) $the_['accepted_args'] ) );
                }
            }
        } while ( false !== next( $this->iterations[ $nesting_level ] ) );

        unset( $this->iterations[ $nesting_level ] );
        unset( $this->current_priority[ $nesting_level ] );

        $this->nesting_level--;

        
/** This filter is documented in wp-admin/includes/media.php */
        $translated = apply_filters( 'attachment_fields_to_save', $translated$attachment_data );
    }

    // Convert taxonomy input to term IDs, to avoid ambiguity.     if ( isset( $post_data['tax_input'] ) ) {
        foreach ( (array) $post_data['tax_input'] as $taxonomy => $terms ) {
            $tax_object = get_taxonomy( $taxonomy );

            if ( $tax_object && isset( $tax_object->meta_box_sanitize_cb ) ) {
                $translated['tax_input'][ $taxonomy ] = call_user_func_array( $tax_object->meta_box_sanitize_cb, array( $taxonomy$terms ) );
            }
        }
    }

    add_meta( $post_id );

    update_post_meta( $post_id, '_edit_last', get_current_user_id() );

    $success = wp_update_post( $translated );

    // If the save failed, see if we can sanity check the main fields and try again.

        do_action( 'dynamic_sidebar', $wp_registered_widgets[ $id ] );

        if ( is_callable( $callback ) ) {
            call_user_func_array( $callback$params );
            $did_one = true;
        }
    }

    if ( ! is_admin() && ! empty( $sidebar['after_sidebar'] ) ) {
        echo $sidebar['after_sidebar'];
    }

    /** * Fires after widgets are rendered in a dynamic sidebar. * * Note: The action also fires for empty sidebars, and on both the front end * and back end, including the Inactive Widgets sidebar on the Widgets screen. * * @since 3.9.0 * * @param int|string $index Index, name, or ID of the dynamic sidebar. * @param bool $has_widgets Whether the sidebar is populated with widgets. * Default true. */
namespace CodeIgniter\Test\Mock;

use BadMethodCallException;
use CodeIgniter\View\Table;

class MockTable extends Table
{
    // Override inaccessible protected method     public function __call($method$params)
    {
        if (is_callable([$this, '_' . $method])) {
            return call_user_func_array([$this, '_' . $method]$params);
        }

        throw new BadMethodCallException('Method ' . $method . ' was not found');
    }
}

  protected $valueOptions;

  public function getValueOptions() {
    if (isset($this->valueOptions)) {
      return;
    }

    if (isset($this->definition['options callback']) && is_callable($this->definition['options callback'])) {
      if (isset($this->definition['options arguments']) && is_array($this->definition['options arguments'])) {
        $this->valueOptions = call_user_func_array($this->definition['options callback']$this->definition['options arguments']);
      }
      else {
        $this->valueOptions = call_user_func($this->definition['options callback']);
      }
    }
    else {
      $this->valueOptions = [];
    }
  }

  /** * {@inheritdoc} */

  public function executeValidateHandlers(&$form, FormStateInterface &$form_state) {
    // If there was a button pressed, use its handlers.     $handlers = $form_state->getValidateHandlers();
    // Otherwise, check for a form-level handler.     if (!$handlers && isset($form['#validate'])) {
      $handlers = $form['#validate'];
    }

    foreach ($handlers as $callback) {
      call_user_func_array($form_state->prepareCallback($callback)[&$form, &$form_state]);
    }
  }

  /** * {@inheritdoc} */
  public function validateForm($form_id, &$form, FormStateInterface &$form_state) {
    // If this form is flagged to always validate, ensure that previous runs of     // validation are ignored.     if ($form_state->isValidationEnforced()) {
      $form_state->setValidationComplete(FALSE);
    }
// We used to have an override for this display, but the user now wants       // to go back to the default display.       // Overwrite the default display with the current form values, and make       // the current display use the new default values.       $display = &$this->getExecutable()->displayHandlers->get($display_id);
      // optionsOverride toggles the override of this section.       $display->optionsOverride($form$form_state);
      $display->submitOptionsForm($form$form_state);
    }

    $submit_handler = [$form_state->getFormObject(), 'submitForm'];
    call_user_func_array($submit_handler[&$form$form_state]);
  }

  /** * Submit handler for cancel button. */
  public function standardCancel($form, FormStateInterface $form_state) {
    if (!empty($this->changed) && isset($this->form_cache)) {
      unset($this->form_cache);
      $this->cacheSet();
    }

    
if (in_array($class$this->legacy))
        {
            switch ($type)
            {
                case 'Cache':
                    // For backwards compatibility with old non-static                     // Cache::create() methods in PHP < 8.0.                     // No longer supported as of PHP 8.0.                     if ($method === 'get_handler')
                    {
                        $result = @call_user_func_array(array($class, 'create')$parameters);
                        return $result;
                    }
                    break;
            }
        }

        $result = call_user_func_array(array($class$method)$parameters);
        return $result;
    }
}
if ($engine == 'auto') {
            $engine = extension_loaded('xdiff') ? 'xdiff' : 'native';
        } else {
            $engine = basename($engine);
        }

        // WP #7391         require_once dirname(__FILE__).'/Diff/Engine/' . $engine . '.php';
        $class = 'Text_Diff_Engine_' . $engine;
        $diff_engine = new $class();

        $this->_edits = call_user_func_array(array($diff_engine, 'diff')$params);
    }

    /** * PHP4 constructor. */
    public function Text_Diff( $engine$params ) {
        self::__construct( $engine$params );
    }

    /** * Returns the array of differences. */
&& !is_numeric($address['name'])
                ) {
                    $params = array(
                        $address['email'],
                        $address['name']
                    );
                } else if (is_array($address) && isset($address['email'])) {
                    $params = array($address['email']);
                } else {
                    $params = array($address);
                }
                call_user_func_array(array($mail$method)$params);
            }
        }

        return $mail;
    }

    /** * Places event line into array of lines to be used as message body. * * Handles the formatting of plaintext entries. * * @param array $event Event data * @return void */
Home | Imprint | This part of the site doesn't use cookies.