Mega hacky magic to work around crazy Oracle NULL concats.
@param array $args
@return string
426919
protected function recursive_concat(array $args) {
        $count = count($args);
        if ($count == 1) {
            $arg = reset($args);
            return $arg;
        }
        if ($count == 2) {
            $args[] = "' '";
            // No return here intentionally.
        }
        $first = array_shift($args);
        $second = array_shift($args);
        $third = $this->recursive_concat($args);
        return "MOODLELIB.TRICONCAT($first, $second, $third)";
    }
611210
public static function dump(...$args)
    {
        ob_start();

        foreach ($args as $v) {
            var_dump($v);
        }

        $dump = ob_get_contents();
        ob_end_clean();

        return $dump;
    }
698245
protected function getSafeArguments(array $args)
    {
        $argsSafe = [];
        foreach ($args as $arg) {
            $type = gettype($arg);
            switch ($type) {
                case 'string':
                    $argsSafe[] = sprintf('<span>"%s"</span>', Html::trimText($arg, 30));
                    break;

                case 'integer':
                case 'float':
                    $argsSafe[] = sprintf('<span>%s</span>', $arg);
                    break;

                case 'object':
                    $className = get_class($arg);
                    $shortName = (new \ReflectionClass($arg))->getShortName();
                    $argsSafe[] = sprintf('<abbr title="%s">%s</abbr>', $className, $shortName);
                    break;

                case 'boolean':
                    $argsSafe[] = $arg ? '[true]' : '[false]';
                    break;

                default:
                    $argsSafe[] = '[' . $type . ']';
            }
        }

        return $argsSafe;
    }
193365
public function update( array $args ) {

		/** @var array $EZSQL_ERROR */
		global $EZSQL_ERROR;
		if ( empty( $EZSQL_ERROR ) ) {
			return new NullLog();
		}

		$errors  = $EZSQL_ERROR;
		$last    = end( $errors );
		$context = [ 'last_query' => $last[ 'query' ], 'errors' => $errors, ];

		return new Error( $last[ 'error_str' ], Channels::DB, $context );
	}
961865
private function dumpArgs($args)
    {
        foreach ($args as $key => $arg) {
            if (is_object($arg)) {
                $v = '{' . get_class($arg) . '}';
            }
            else if (is_array($arg)) {
                $v = '[' . $this->dumpArgs($arg) . ']';
            }
            else if (is_string($arg)) {
                $v = '"' . (strlen($arg) <= 16 ? $arg : trim(substr($arg, 0, 15)) . '...') . '"';
            }
            else if (is_bool($arg)) {
                $v = $arg ? 'true' : 'false';
            }
            else if ($arg === null) {
                $v = 'null';
            }
            else {
                $v = $arg;
            }

            $args[$key] = is_string($key) ? '"' . $key . '" => ' . $v : $v;
        }

        return implode(', ', $args);
    }
210895
private static function formatArgsForExpression(array $args)
    {
        $mapping = [];
        foreach ($args as $name => $config) {
            $mapping[] = \sprintf('%s: "%s"', $name, $config['type']);
        }

        return \sprintf('arguments({%s}, args)', \implode(', ', $mapping));
    }
698663
public function getCommand( $args )
    {
        $class = strtoupper( substr( $args[ 1 ], 0, 1 ) ) . substr( $args[ 1 ], 1 );
        $class .= 'Command';

        /** @var Command $command */
        $command = NULL;

        if ( class_exists( $class ) )
        {
            $command = new $class();
        }

        if ( NULL === $command && !empty( $this->namespaces ) )
        {
            foreach ( $this->namespaces as $ns )
            {
                $name = $ns . $class;

                if ( class_exists( $name ) )
                {
                    $command = new $name();
                    $command->init( $args );

                    break;
                }
            }
        }

        if ( NULL !== $command )
        {
            $command->configure();
        }

        return $command;
    }
377638
public static function parseArgs(array $args)
    {
        $result = [
            'name'   => null,
            'work'   => null,
            'weight' => 1,
            'backup' => false,
        ];
        foreach ($args as $arg) {
            //find work
            if (is_callable($arg)) {
                $result['work'] = $arg;
            }
            //find weight, backup, name
            if (is_string($arg) || is_numeric($arg)) {
                $arg = preg_replace('/\s+/', ' ', "$arg");
                $subArgs = explode(' ', trim($arg));
                foreach ($subArgs as $subArg) {
                    if (preg_match('/^[0-9]+$/', $subArg)) {
                        $result['weight'] = intval($subArg);
                    } elseif (preg_match('/(backup)/', strtolower($subArg))) {
                        $result['backup'] = true;
                    } else {
                        $result['name'] = $subArg;
                    }
                }
            }
        }

        return $result;
    }
1126795
public function selectOptions(array $args = []): string
    {
        // Establish args.

        $default_args = [
            // Unique.
            'allow_empty'      => true,
            'allow_arbitrary'  => true,
            'option_formatter' => null,
            'current_caps'     => null,

            // Used by {@link all()}.
            'max'         => 1000,
            'fail_on_max' => true,

            // Used by {@link total()}.
            // Used by {@link all()}.
            'include'                   => [],
            'exclude'                   => [],
            'exclude_deprecated_levels' => true,
            'no_cache'                  => false,
        ];
        $args = array_merge($default_args, $args);
        $args = array_intersect_key($args, $default_args);

        // Unique.
        $args['allow_empty']      = (bool) $args['allow_empty'];
        $args['allow_arbitrary']  = (bool) $args['allow_arbitrary'];
        $args['option_formatter'] = is_callable($args['option_formatter']) ? $args['option_formatter'] : null;
        $args['current_caps']     = isset($args['current_caps']) ? (array) $args['current_caps'] : null;
        $args['current_caps']     = $this->c::removeEmptys(array_map('strval', $args['current_caps']));

        // Used by {@link all()}.
        $args['max']         = max(1, (int) $args['max']);
        $args['fail_on_max'] = (bool) $args['fail_on_max'];

        // Used by {@link total()}.
        // Used by {@link all()}.
        $args['include']                   = (array) $args['include'];
        $args['exclude']                   = (array) $args['exclude'];
        $args['exclude_deprecated_levels'] = (bool) $args['exclude_deprecated_levels'];
        $args['no_cache']                  = (bool) $args['no_cache'];

        // Check for nothing being available (or too many).

        if (!($caps = $this->all($args))) {
            return ''; // None available.
        }
        // Initialize several working variables.

        $options        = ''; // Initialize.
        $available_caps = []; // Initialize.
        $selected_caps  = []; // Initialize.

        // Build & return all `<option>` tags.

        if ($args['allow_empty']) { // Allow ``?
            $options = '<option value=""></option>';
        }
        foreach ($caps as $_cap) { // Key/value the same at this time.
            $available_caps[] = $_cap; // Record all available.

            if (isset($args['current_caps']) && in_array($_cap, $args['current_caps'], true)) {
                $selected_caps[$_cap] = $_cap; // Flag selected cap.
            }
            $_cap_selected_attr = isset($selected_caps[$_cap]) ? ' selected' : '';

            // Format `<option>` tag w/ a custom formatter?

            if ($args['option_formatter']) {
                $options .= $args['option_formatter']($_cap, [
                        'cap_selected_attr' => $_cap_selected_attr,
                    ], $args); // ↑ This allows for a custom option formatter.
                    // The formatter must always return an `<option></option>` tag.

            // Else format the `<option>` tag using a default behavior.
            } else { // Both front & back-end displays are the same for caps.
                $options .= '<option value="'.esc_attr($_cap).'"'.$_cap_selected_attr.'>'.
                                esc_html($_cap).
                            '</option>';
            }
        } // unset($_cap, $_cap_selected_attr); // Housekeeping.

        if ($args['allow_arbitrary'] && $args['current_caps']) { // Allow arbitrary select `<option>`s?
            foreach (array_diff($args['current_caps'], $available_caps) as $_arbitrary_cap) {
                $options .= '<option value="'.esc_attr($_arbitrary_cap).'" selected>'.
                                esc_html($_arbitrary_cap).
                            '</option>';
            } // unset($_arbitrary_cap); // Housekeeping.
        }
        return $options; // HTML markup.
    }
515806
public static function arguments(array $args) : array
    {
        putenv("CODGER_DRY=1");
        foreach ($args as $key => $value) {
            if ($value === '-w') {
                putenv("CODGER_DRY=0");
                unset($args[$key]);
            }
            if ($value === '-o') {
                putenv("CODGER_OVERWRITE=1");
                putenv("CODGER_DRY=0");
                unset($args[$key]);
            }
            if ($value === '-d') {
                putenv("CODGER_OVERWRITE=0");
                putenv("CODGER_DUMP=1");
                putenv("CODGER_DRY=0");
                unset($args[$key]);
            }
            if ($value === '-s') {
                putenv("CODGER_OVERWRITE=0");
                putenv("CODGER_SKIP=1");
                putenv("CODGER_DRY=0");
                unset($args[$key]);
            }
        }
        return array_values($args);
    }
345993
public function output($args = null) {
        $i = 0;
        foreach ($this->jobs as $job)
            if($job['function']($job['msg']) === TRUE)
                $i++;

        $this->jobs = [];
        return $i;
    }
470483
public function url( array $args = [] ) {
		$url = get_permalink( $this->ID );
		if ( $args ) {
			$url = add_query_arg( $args, $url );
		}

		return $url;

	}
614028
public static function dumpVars(...$args): string
    {
        \ob_start();
        \var_dump(...$args);
        $string = \ob_get_clean();

        return \preg_replace("/=>\n\s+/", '=> ', $string);
    }
747560
public function decode(array $args)
    {
        $decoded = [];

        foreach ($args as $arg) {

            if (!is_string($arg)) {
                $decoded[] = $arg;
                continue;
            }

            $decoded[] = $this->deserialize($arg);

        }

        return $decoded;
    }
494034
protected function encodeContent(array $args) {
        $data = [];
        foreach ($args as $key => $item) {
            $data[] = sprintf('"%s"="%s"', $key, $item);
        }
        return '{'.implode(',', $data).'}';
    }
1240341
public function update( array $args ) {

		switch ( current_filter() ) {
			case 'phpmailer_init' :
				return $this->on_mailer_init( $args );
			case 'wp_mail_failed' :
				return $this->on_mail_failed( $args );
		}

		return new NullLog();
	}
1346734
protected function parseArgs($args)
    {
        if (!is_array($args)) {
            return $args;
        }

        $this->silent = in_array('--silent', $args);
        if ($this->silent) {
            $args = array_values(array_diff($args, ['--silent']));
        }

        return $args;
    }