Converts variable into short text

@param mixed $arg Variable
@return string
435418
static protected function getArgument($arg)
    {

        switch (mb_strtolower(gettype($arg))) {
            case 'string' :
                return ('"' . str_replace(array("\n", "\""), array('', '\"'), $arg) . '"');

            case 'boolean' :
                return ( bool )$arg;

            case 'object' :
                return 'object(' . get_class($arg) . ')';

            case 'array' :
                return 'array[' . count($arg) . ']';

            case 'resource' :
                return 'resource(' . get_resource_type($arg) . ')';

            default :
                return var_export($arg, true);
        }
    }
730516
public function brandParentArg(string $arg = ''): string
    {
        return $this->App->Parent ? $this->App->Parent->Utils->§BrandUrl->brandArg($arg) : $this->brandArg($arg);
    }
336239
public function content($arg=null)
	{
		switch($this->format)
		{
			case 'json':
				if(!isset($arg))
				{
					$arg = false;
				}
				return $this->json($arg);
				break;
			case 'xml' :
				if(!isset($arg))
				{
					$arg = 'dom';
				}
				return $this->xml($arg);
				break;
			default :
				return $this->getContent();
				break;
		}
	}
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));
    }
220014
public function format($args)
    {
        if ($this->isArray($args)) {
            $value = vsprintf($this->val(), $args);
        } else {
            if ($this->isInstanceOf($args, new ArrayObject([]))) {
                $value = vsprintf($this->val(), $args->val());
            } else {
                $value = sprintf($this->val(), $args);
            }
        }
        $this->val($value);

        return $this;
    }
960264
function raw($arg) {
		return $this->fw->recursive($arg,
			function($val) {
				return is_string($val)?$this->fw->decode($val):$val;
			}
		);
	}
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);
    }
276542
public function getSubfield($arg)
    {
        if (1 < strlen($arg)) {
            throw new \UnexpectedValueException(
                'Method only allows argument to be 1 character long. Got '.strlen($arg)
            );
        }

        if (0 < count($this->subfields)) {
            foreach ($this->subfields as $subfield) {
                if ($subfield->getTag() == $arg) {
                    $_subfields[] = $subfield;
                }
            }

            return $_subfields;
        }
    }
56078
public function getValue($args, $default = null)
    {
        if (isset($args[$this->name])) {
            return $args[$this->name];
        }

        if (isset($args[$this->shortName])) {
            return $args[$this->shortName];
        }

        return $default;
    }
1123367
public function getTheExcerpt($args = array())
    {
        $default_args = array(
            'length' => 150,
            'length_unit' => 'char',
            'strip_shortcodes' => true,
            'hellip' => '&hellip;'
        );
        $args = (Arr::iterable($args))
            ? array_merge($default_args, $args)
            : $default_args;
        extract($args);
        
        $excerpt = $this->get('post_excerpt');
        if (!strlen($excerpt)) {
            $excerpt = strip_tags($this->get('post_content'));
            if ($length_unit == 'char') {
                $excerpt = Str::shortenWordsByChar($excerpt, $length, $hellip);
            } elseif ($length_unit == 'word') {
                $excerpt = Str::shortenWords($excerpt, $length, $hellip);
            }
        }
        $excerpt = apply_filters('the_excerpt', $excerpt);
        
        return ($strip_shortcodes) ? strip_shortcodes($excerpt) : $excerpt;
    }
1052147
public function interpolate($msg, array $args = array())
    {
        preg_match_all('/(?<!%)(?:%%)*%\\(([^\\)]*)\\)/', $msg, $matches);
        // Only define the variables if there are any.
        if (isset($matches[1][0])) {
            $args += array_combine(
                $matches[1],
                array_fill(0, count($matches[1]), null)
            );
        }

        if (!count($args)) {
            return $msg;
        }

        // Mapping = array(name => index)
        $keys       = array_keys($args);
        $mapping    = array_flip($keys);
        $keys       = array_map(
            function ($key) {
                return "%($key)";
            },
            $keys
        );
        $values     = array_map(
            function ($val) {
                return '%'.($val + 1).'$';
            },
            $mapping
        );
        $mapping    = array_combine($keys, $values);
        $msg        = strtr($msg, $mapping);
        return vsprintf($msg, array_values($args));
    }
1199219
public static function prepareCommand(array $args)
    {
        $return = '*' . \count($args) . "\r\n";
        foreach ($args as $arg) {
            $return .= '$' . \strlen($arg) . "\r\n" . $arg . "\r\n";
        }

        return $return;
    }
16574
public static function formatString($str, $args)
    {
        foreach ($args as $k => $v) {
            $str = preg_replace('/:'. $k. ':/', $v, $str);
        }
        return $str;
    }
64772
public static function findCommandLong($arg) {
		foreach (self::$commands as $command => $commandOptions) {
			if (($commandOptions["commandLong"] == $arg) || ($commandOptions["commandShort"] == $arg)) {
				return $command;
			}
		}
		return false;
	}
913648
public function getOrderBy($arg)
    {
        // Check if there are phrases in $arg should handle as it is
        $phrase = explode("\"", $arg);
        if (count($phrase) > 2) {
            // Re-init $arg variable 
            // (It will contain the rest of $arg except phrases).
            $arg = '';
            for ($i = 0; $i < count($phrase); $i++) {
                if ($i % 2 == 0 && $phrase[$i] != '') {
                    // Re-build $arg variable after restricting phrases
                    $arg .= $phrase[$i];
                } elseif ($i % 2 == 1 && $phrase[$i] != '') {
                    // Handle phrases using reqular LIKE matching in MySQL
                    $wordOrder[] = $this->getWordLike($phrase[$i]);
                }
            }
        }
        
        // Handle normal $arg using lex's and regular expresion
        $words = explode(' ', $arg);
        foreach ($words as $word) {
            if ($word != '') {
                $wordOrder[] = 'CASE WHEN ' . 
                               $this->getWordRegExp($word) . 
                               ' THEN 1 ELSE 0 END';
            }
        }
        
        $order = '((' . implode(') + (', $wordOrder) . ')) DESC';
        
        return $order;
    }
317638
private function parseArgs(array $args) : string
    {
        if (!is_array($args)) return false;
        $components = array();
        if (count($args) == 1 && is_string($args[0])) {
            $components['src'] = $args[0];
            return $this->makeLink($components);
        } elseif (count($args) == 1 && is_array($args)) {
            $components = $args[0];
            return $this->makeLink($components);
        } elseif (count($args) == 2 && is_string($args[0]) && is_array($args[1])) {
            $args[1]['src'] = $args[0];
            $components = $args[1];
            return $this->makeLink($components);
        } elseif (count($args) == 2 && is_string($args[0]) && is_string($args[1])) {
            return '<script type="'.$args[1].'">'."\n".$args[0]."\n</script>\n";
        }
        Core::i()->log->warning('Unable to interpret script. Not added.');
        return false;
    }
1204868
function parseDSN_args($args) {
     	$retn = array();
     	foreach(explode("&",$args) as $arg) {
     	 	list($key,$val) = explode("=",trim($arg));
     	 	$retn[$key] = $val;
     	 	unset($key,$val);
     	}
     	return $retn;
    }