Function __global->insert_code_after__by_command

Definitions

sources/override_api.php

  • Insert some code into a function in the given code snippet, by command (after command).
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: bool

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
&$code string Yes No required parameter N/A N/A The code
$function string No No required parameter N/A N/A Name of the function
$command string No No required parameter N/A N/A The command we're searching to insert by
$newcode string No No required parameter N/A N/A Code to insert
$instance_of_command integer No No 1 N/A N/A We are inserting at this instance of the line (i.e. takes into account a literal line of code may exist in other places in a function).
$fail_ok boolean No No False N/A N/A Whether a failure should attach a message (false: a failure should cause a critical error)

Returns

  • Success status
  • Type: boolean
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Insert some code into a function in the given code snippet, by command (after command).
 *
 * @param  string $code The code
 * @param  string $function Name of the function
 * @param  string $command The command we're searching to insert by
 * @param  string $newcode Code to insert
 * @param  integer $instance_of_command We are inserting at this instance of the line (i.e. takes into account a literal line of code may exist in other places in a function).
 * @param  boolean $fail_ok Whether a failure should attach a message (false: a failure should cause a critical error)
 * @return boolean Success status
 */

function insert_code_after__by_command(string &$code, string $function, string $command, string $newcode, int $instance_of_command = 1, bool $fail_ok = false) : bool