格式化打印，不含数据类型
@param $data
@param bool $mark
@param string $outString
@return string
336650
private static function _handleNormalOutput($data, $mark = true, $outString = ''): string
    {
        $html = 'htmlspecialchars';
        $ucfirst = 'ucfirst';
        $jsClass = self::$controlClass;//' class="js-print-showOrHide"';
        $usualString = "<dt><div class=\"array-value\">\n%s</div></dt>\n";
        $outString .= '<dl>' . PHP_EOL;
        $dataType = \gettype($data);

        if (\is_array($data)) {
            $count = 'count';
            if ($mark) {
                $outString = sprintf(
                    "<dt>\n<div class=\"%s\" style=\"%s\"><b class=\"general-print-color-dg\">%s</b>(size:<b>%d</b>)<b>(</b></div><span class=\"print-icon icon-hide\"></span>\n</dt>",
                    $jsClass, 'width:98%', ucfirst($dataType), count($data)
                );
            }
            $outString .= '<!-- .general-print-ar-content -->' . PHP_EOL . '<dd class="general-print-ar-content">';

            foreach ($data as $k => $v) {
                $k = \is_int($k) ? $k : "'{$html($k,ENT_QUOTES)}'";
                $vType = \gettype($v);
                $outString .= PHP_EOL . "<dl>\n<dt><div class=\"array-key\">\t$k</div>";

                if (\is_array($v) || \is_object($v) || \is_resource($v)) {
                    $outString .= "<div class=\"array-value {$jsClass}\"> &rArr; <strong class=\"general-print-color-dg\">{$ucfirst($vType)}</strong>(size:";

                    if (empty($v)) {
                        $outString .= '0)<strong>()</strong> </div><span class="print-icon icon-hide"></span></dt>';
                        continue;
                    }

                    $outString .= "<strong>{$count((array)$v)}</strong>)<strong>(</strong></div><span class=\"print-icon icon-hide\"></span>\n</dt>" . PHP_EOL;
                    $outString .= ltrim(self::_handleNormalOutput($v, false), '<dl>');
                } else {
                    $v = PrintHelper::getTypeString($v);
                    $outString .= "<div class=\"array-value\"> &rArr; <span class=\"general-print-color-r\">{$v}</span> </div></dt>\n</dl>";
                }

            }//--endforeach--

            $outString .= PHP_EOL . '</dd><!-- /.general-print-ar-content -->' . PHP_EOL . '</dl>' . PHP_EOL . '<dl><dt><strong>)</strong></dt>';
        } else if (is_object($data)) {
            $outString .= PrintHelper::getSystemPrintData($data, 0);
        } else if (is_resource($data)) {
            if (($type = get_resource_type($data)) === 'stream' && $meta = stream_get_meta_data($data)) {

                if (isset($meta['uri'])) {
                    $file = $meta['uri'];
                    $resourceString = "resource ({$type}) {$html( $file, ENT_QUOTES )}";
                } else {
                    $resourceString = "resource ({$type})";
                }

            } else {
                $resourceString = "resource ({$type})";
            }

            $outString .= sprintf($usualString, $resourceString);
        } else {
            $data = PrintHelper::getTypeString($data);
            $outString .= '<span class=\"general-print-color-r\">' . sprintf($usualString, $data) . '</span>';
        }

        return $outString . '</dl>' . PHP_EOL;
    }
699769
protected function renderPayloadDataAsMarkupList(array $data, $indent = 0) {
		$markup = '';
		foreach ($data as $key => $value) {
			$markup .= str_repeat(' ', $indent * 2) . '- ' . $key . ':';
			if (TRUE === is_array($value)) {
				$markup .= $this->renderPayloadDataAsMarkupList($value, ++ $indent);
			} else {
				$markup .= ' ' . $value . PHP_EOL;
			}
		}
		return TRUE === empty($markup) ? '' : PHP_EOL . $markup;
	}
1337197
protected function url(&$out)
    {
        if ($this->match('(url\(\s*(["\']?)([^)]+)\2\s*\))', $m)) {
            $out = [Type::T_STRING, '', ['url(' . $m[2] . $m[3] . $m[2] . ')']];

            return true;
        }

        return false;
    }
1129206
private function dump($data, $hasType = true, $useSystemPrint = false): string
    {
        $style = '';

        if (self::$hidden) {
            $style = ' style="display:none;"';
        }

        $outString = '%s';

        if (PrintHelper::isWebRequest()) {
            $outString = "<!-- output print start -->\n<div class=\"general-print-box general-print-font general-print-shadow\" $style>\n%s</div>\n<!-- output print end -->" . PHP_EOL;
        }

        # 使用系统函数打印
        if ($useSystemPrint) {
            $result = PrintHelper::getSystemPrintData($data, $hasType);
            $outString = sprintf($outString, $result);
            # 自定义函数
        } else {
            $result = self::_handleTypeOutput($data, $hasType);
            $outString = sprintf($outString, $result);
        }

        unset($result);

        return $outString;
    }
205726
public static Output<CharBuffer>
            from(String data, boolean endOfRecord) {
        return new Output<>(ManagedBuffer.wrap(
            CharBuffer.wrap(data)), false, endOfRecord);
    }
124788
public static function log($entry, $markName = '...', $params = array())
    {
        if (!self::isDebug()) {
            return false;
        }

        // emulate normal class
        $_this = self::i();

        // check var type
        if (is_bool($entry)) {
            $entry = ($entry) ? 'TRUE' : 'FALSE';
        } elseif (is_null($entry)) {
            $entry = 'NULL';
        } elseif (is_resource($entry)) {
            $entry = 'resource of "' . get_resource_type($entry) . '"';
        }

        // serialize type
        if (self::$_config['log']['serialize'] == 'formats') {
            // don't change log entry

        } elseif (self::$_config['log']['serialize'] == 'none') {
            $entry = array('jbdump_message' => $entry);

        } elseif (self::$_config['log']['serialize'] == 'json') {
            $entry = array('jbdump_message' => @json_encode($entry));

        } elseif (self::$_config['log']['serialize'] == 'serialize') {
            $entry = array('jbdump_message' => serialize($entry));

        } elseif (self::$_config['log']['serialize'] == 'print_r') {
            $entry = array('jbdump_message' => print_r($entry, true));

        } elseif (self::$_config['log']['serialize'] == 'php_array') {
            $markName = (empty($markName) || $markName == '...') ? 'dumpVar' : $markName;
            $entry    = array('jbdump_message' => JBDump_array2php::toString($entry, $markName));

        } elseif (self::$_config['log']['serialize'] == 'var_dump') {
            ob_start();
            var_dump($entry);
            $entry = ob_get_clean();
            $entry = array('jbdump_message' => var_dump($entry, true));
        }

        if (isset($params['trace'])) {
            $_this->_trace = $params['trace'];
        } else {
            $_this->_trace = debug_backtrace();
        }

        $entry['name']      = $markName;
        $entry['datetime']  = date(self::DATE_FORMAT);
        $entry['client_ip'] = self::getClientIP();
        $entry['file']      = $_this->_getSourcePath($_this->_trace, true);
        $entry              = array_change_key_case($entry, CASE_UPPER);

        $fields = array();
        $format = isset($params['format']) ? $params['format'] : self::$_config['log']['format'];
        preg_match_all("/{(.*?)}/i", $format, $fields);

        // Fill in the field data
        $line = $format;
        for ($i = 0; $i < count($fields[0]); $i++) {
            $line = str_replace($fields[0][$i], (isset ($entry[$fields[1][$i]])) ? $entry[$fields[1][$i]] : "-", $line);
        }

        // Write the log entry line
        if ($_this->_openLog()) {
            error_log($line . PHP_EOL, 3, $_this->_logfile);
        }

        return $_this;
    }
1165146
public function replaceQuestionMark(
        /*# string */ $string,
        array $values
    )/*# : string */ {
        $pat = $rep = [];
        foreach ($values as $val) {
            $pat[] = '/\?/'; // question mark
            $rep[] = $this->getPlaceholder($val); // placeholder
        }
        return preg_replace($pat, $rep, $string, 1);
    }
1134477
public static function getStringWithoutLastElement($string, $separator)
    {
        $elements = self::getStringElements($string, $separator);
        $lastKey = Arrays::getLastKey($elements);

        unset($elements[$lastKey]);

        return implode($separator, $elements);
    }
146785
protected function _replaceData($str, $data) {
		// Supported tags.
		$tags = array(
			'[__]' => '[/__]', '[__d]' => '[/__d]', '[__c]' => '[/__c]', '[php]' => '[/php]', '[currency]' => '[/currency]',
			'[url]' => '[/url]', '[image]' => '[/image]', '[link]' => '[/link]', '[truncate]' => '[/truncate]', '[time]' => '[/time]'
		);

		// Find all array path (i.e. [Post.title], [Comment.{n}.text], [Roles.{n, }.name]) matches.
		if (!preg_match_all('/\[([A-Za-z0-9_{},\s\.]+)\]/iUs', $str, $matches)) {
			return $str;
		}

		foreach ($matches[0] as $i => $match) {
			// Skip when exact match of other tag.
			if (in_array($match, $tags) || isset($tags[$match])) {
				continue;
			}

			// Skip when matches tag with attributes (i.e. [truncate length=10]).
			$continue = false;
			foreach (array_keys($tags) as $needle) {
				if ($continue = strpos($match, substr($needle, 0, -1)) === 0) {
					break;
				}
			}
			if ($continue) {
				continue;
			}

			// Check if {f} or {l} in array path.
			// @todo Write tests.
			preg_match('/\{([fl])\}/iUs', $matches[1][$i], $el);

			if (!empty($el)) {
				$matches[1][$i] = str_replace('{' . $el[1] . '}', '{n}', $matches[1][$i]);

				if ('l' == $el[1]) {
					$replace = array_pop(Hash::extract($data, $matches[1][$i]));
				} else if ('f' == $el[1]) {
					$replace = array_shift(Hash::extract($data, $matches[1][$i]));
				}

				$str = str_replace($match, $replace, $str);
				continue;
			}

			// Check if {n} or {s} in array path.
			preg_match('/\{[ns](.+)\}/iUs', $matches[1][$i], $glue);

			// Set string to use in `implode()` extract results.
			if (empty($glue[1])) {
				$glue[1] = ' ';
			} else {
				$matches[1][$i] = str_replace($glue[0], substr($glue[0], 0, 2) . '}', $matches[1][$i]);
			}

			// Replace.
			$str = str_replace($match, implode($glue[1], Hash::extract($data, trim($matches[1][$i]))), $str);
		}

		return $str;
	}
1232030
public static function stripTags($data, $allow_tags = null)
    {
        if (\is_array($data)) {
            foreach ($data as $k => $v) {
                $data[$k] = self::stripTags($v, $allow_tags);
            }

            return $data;
        }

        if (\is_string($data) || is_numeric($data)) {
            return strip_tags($data, $allow_tags);
        }

        return false;
    }
977137
public function transformWithoutTone($inputChar, $delimiter=' ', $outsideIgnore=true)
    {
        $charWithTone = $this->transformWithTone($inputChar, $delimiter, $outsideIgnore);

        $charWithoutTone = str_replace(
            array('ā', 'á', 'ǎ', 'à', 'ō', 'ó', 'ǒ', 'ò', 'ē', 'é', 'ě', 'è', 'ī', 'í', 'ǐ', 'ì', 'ū', 'ú', 'ǔ', 'ù', 'ǖ', 'ǘ', 'ǚ', 'ǜ', 'ü'), 
            array('a', 'a', 'a', 'a', 'o', 'o', 'o', 'o', 'e', 'e', 'e', 'e', 'i', 'i', 'i', 'i', 'u', 'u', 'u', 'u', 'v', 'v', 'v', 'v', 'v'),
            $charWithTone
        );

        return $charWithoutTone;

    }
1343893
public function inboundText( $data=null ){
		if(!$data) $data = $_GET;

		if(!isset($data['text'], $data['msisdn'], $data['to'])) return false;

		// Get the relevant data
		$this->to = $data['to'];
		$this->from = $data['msisdn'];
		$this->text = $data['text'];
		$this->network = (isset($data['network-code'])) ? $data['network-code'] : '';
		$this->message_id = $data['messageId'];

		// Flag that we have an inbound message
		$this->inbound_message = true;

		return true;
	}
567214
public static function getString ($status = FALSE, $tagStart = NULL, $tagEnd = "\n")
	{
		
		// Get messages
		
		$arr	= self::get ($status);
		
		// Set message string
		
		$str	= '';
		
		foreach ($arr as $msg)
		{
			$str	.= $tagStart . $msg . $tagEnd;
		}
		
		// Return message
		
		return $str;
		
	}
535151
public function deleteMarkAction(Mark $mark)
    {
        $this->assertCanEdit($mark->getResult());
        $this->manager->deleteMark($mark);

        return new JsonResponse('', 204);
    }
987796
protected function _writeBackDataOut($out, $data)
    {
        $buck = stream_bucket_new($this->bufferHandle, '');
        if (false === $buck)
            // trigger filter error
            return PSFS_ERR_FATAL;

        $buck->data = $data;
        stream_bucket_append($out, $buck);

        // data was processed successfully
        return PSFS_PASS_ON;
    }
993297
private void simpleWriteString(String outString, OutputStream outStream) throws IOException
   {
      for (int i = 0; i < outString.length(); i++)
      {
         int charCode = outString.charAt(i);
         outStream.write(charCode & 0xFF);
         outStream.write((charCode >> 8) & 0xFF);
      }
   }
94442
public static function toString($data, bool $dump = true): string
    {
        if (is_callable($data)) {
            return static::toString($data());
        }

        if (is_stringable($data)) {
            return (string) $data;
        }

        if (is_array($data)) {
            $data = $dump ? Arr::dump($data) : 'Array()';
        }

        if (is_object($data)) {
            $data = $dump ? Arr::dump($data) : sprintf('[Object %s]', get_class($data));
        }

        return (string) $data;
    }