Dump information about a variable
@param mixed $data,...
421580
public static function dump($data)
	{
		// disabled ?
		//
		if (!self::_debug())
		{
			return false;
		}

		// more arguments ?
		//
		if (func_num_args() > 1)
		{
			$_ = func_get_args();
			foreach($_ as $d)
			{
				self::dump($d);
			}

			return true;
		}

		// the css ?
		//
		self::_css();

		// find caller
		//
		$_ = debug_backtrace();
		while($d = array_pop($_))
		{
			if (0 === strcasecmp($d['function'], 'krumo'))
			{
				break;
			}

			if (!empty($d['class']))
			{
				if (0 === strcasecmp($d['class'], 'krumo'))
				{
					break;
				}
			}
		}

		// find what the argument was ?
		//
		$name = '';
		if (!empty($d['file']))
		{
			$f = file($d['file']);
			$name = trim($f[$d['line']-1]);

			// multi-line call ?
			//
			if (false === stripos($name, 'krumo'))
			{
				for ($i=$d['line']-2; $i >=0; $i--)
				{
					$name = $f[$i] . $name;
					if (false !== stripos($name, 'krumo'))
					{
						break;
					}
				}
			}
			$name = preg_replace(array(
					'~^.+(krumo)~Uis',
					'~\?>$~',
					),
				array(
					'\\1',
					''
					),
				$name);

			unset($f);
		}


		// the content
		//
		?>
			<div class="krumo-root">
				<ul class="krumo-node krumo-first">
					<?php echo self::_dump($data, $name);?>
					<li class="krumo-footnote">
						<div class="krumo-version" style="white-space:nowrap;">
							<h6>Krumo version <?php echo self::version();?></h6> | <a
								href="https://github.com/kktsvetkov/krumo"
								target="_blank">github.com/kktsvetkov/krumo</a>
						</div>

					<?php if (!empty($d['file']))
					{
						?>
					<span class="krumo-call" style="white-space:nowrap;">
						Called from <code><?php echo $d['file']?></code>,
							line <code><?php echo $d['line']?></code></span>
						<?php
					} ?>
					&nbsp;
					</li>
				</ul>
			</div>
		<?php

		// flee the hive
		//
		$_recursion_marker = self::_marker();
		if ($hive =& self::_hive($dummy))
		{
			foreach($hive as $i=>$bee)
			{
				if (is_object($bee))
				{
					unset($hive[$i]->$_recursion_marker);
				} else
				{
					unset($hive[$i][$_recursion_marker]);
				}
			}
		}
	}
51023
public static function dump( $data, int $deep = 10 ) {

    if( --$deep < 0 ) return '...';
    else if( !Collection::is( $data ) ) return $data;
    else {

      // handle custom classes
      $_data = Collection::copy( $data, false );
      if( is_object( $data ) && !( $data instanceof \StdClass ) ) try {
        if( \method_exists( $data, '__debugInfo'  ) ) $_data = $data->__debugInfo();
        else {

          $reflection = new \ReflectionClass( $data );
          $tmp        = [ '__CLASS__' => $reflection->getName() ];

          foreach( $reflection->getProperties() as $property ) {
            if( !$property->isStatic() ) {
              $property->setAccessible( true );

              $key                                = $property->isPrivate() ? '-' : ( $property->isProtected() ? '#' : '+' );
              $tmp[ $key . $property->getName() ] = $property->getValue( $data );
            }
          }

          $_data = $tmp;
        }

      } catch( \ReflectionException $_ ) {
        // can't do anything
      }

      //
      foreach( $_data as &$value ) $value = static::dump( $value, $deep );
      return $_data;
    }
  }
728606
public function write($data)
	{
		$this->createFolderIfNotExist($this->folderPath());
		$this->createFile($this->getFilePath(), $data);
	}
694916
public function setData($data) {
        if (!empty($data)) {
            foreach($data as $key=>$value) {
                $this->_data[$key] = $value;
            }
        } else {
            $this->_data = array();
        }
    }
293457
public static function setDebugData($data)
    {
        $matches = null;

        preg_match_all("/<p class=\"message warning\">\n(.*?)<\/p>/s", $data, $matches);

        if (!empty($matches[1])) {
            self::$debug = $matches[1];
        }
    }
225093
public static function output($data)
    {
        if (!self::$output || !is_string($data)) {
            return;
        }

        if (php_sapi_name() != 'cli') {
            echo sprintf(self::$style['called_from_format'], Debugger::getCalledFrom(2));
            echo sprintf(self::$style['output_format'], $data);
            echo '<style type="text/css">.xicrow-php-debug-timer:hover{ ' . self::$style['hover_style'] . ' }</style>';
        } else {
            echo Debugger::getCalledFrom(2);
            echo "\n";
            echo $data;
        }
    }
626459
protected function doSetFrom($data)
    {
        foreach($data as $k => $v)
            $this->__set($k, $v);
    }
178249
public function setInfo($data=array()) {
        if(isset($data['data'])) $this->info['data'] = $data['data'];
        if(isset($data['status'])) $this->info['status'] = $data['status'];
        if(isset($data['msg'])) $this->info['msg'] = $data['msg'];

    }
65336
protected function onInput($data)
    {
        // print_r($data);
        $this->rowNum++;
        foreach ($this->params as $cKey=>$cValue) {
            switch(gettype($cValue["exp"]))
            {
            case "string":
                $expression = $cValue["exp"];
                // echo $expression . ' || ';
                foreach ($data as $k=>$v) {
                    if (is_string($v) || is_numeric($v)) {
                        $expression = str_replace("{".$k."}", $v, $expression);
                    }
                }

                //predefined row
                $expression = str_replace("{#}", $this->rowNum, $expression);
                // echo $expression . ' <br> ';
                eval('$data[$cKey]='.$expression.';');
                break;
            case "object":
                $function = $cValue["exp"];
                $data[$cKey] = $function($data);
                break;
            }
        }
        $this->next($data);
    }
77817
public function setData($data)
    {
        $this->originalData = $data;

        if ($data instanceof \Iterator) {
            $this->iterator = $data;
        }
        elseif (is_array($data)) {
            $this->iterator = new \ArrayIterator($data);
        }
        else {
            $this->iterator = new \ArrayIterator(array($data));
        }
    }
93742
private static function _parseData(array $data)
    {
        foreach($data as $key => $value) {
            self::$_data[\mb_strtolower($key)] = $value;
        }
    }
1054274
private function log($data)
    {
        $data = date(DATE_RSS, time()) . "\t$data\n";
        file_put_contents($this->storage('.log'), $data, FILE_APPEND);
    }
628923
public function handleData($data)
    {
        $this->incomingBuffer .= $data;

        if ($this->connection && $this->isHeaderEnd($this->incomingBuffer)) {
            $remoteAddress = (string) $this->incoming->getRemoteAddress();
            $headersToReplace = [
                'X-PHP-PM-Remote-IP' => trim(parse_url($remoteAddress, PHP_URL_HOST), '[]'),
                'X-PHP-PM-Remote-Port' => trim(parse_url($remoteAddress, PHP_URL_PORT), '[]')
            ];

            $buffer = $this->replaceHeader($this->incomingBuffer, $headersToReplace);
            $this->connection->write($buffer);

            $this->incoming->removeListener('data', [$this, 'handleData']);
            $this->incoming->pipe($this->connection);
        }
    }
292758
private static function _vars(&$data)
    {
        $_is_object = is_object($data);

        // test for references in order to
        // prevent endless recursion loops
        $_recursion_marker = static::_marker();

        if ($_is_object) {
            if (($hash = spl_object_hash($data)) && isset(static::$objectRecursionProtection[$hash])) {
                $_r = static::$objectRecursionProtection[$hash];
            } else {
                $_r = null;
            }
        } else {
            $_r = isset($data[$_recursion_marker]) ? $data[$_recursion_marker] : null;
        }

        // recursion detected
        if ($_r > 0) {
            static::_recursion();
            return;
        }

        // stain it
        static::_hive($data);

        $count = 0;
        if (is_countable($data)) {
            $count = count($data);
        }

        // render it
        $collapsed = static::_isCollapsed(static::$_level, $count - 1);
        if ($collapsed) {
            $collapse_style = 'style="display: none;"';
        } else {
            $collapse_style = '';
        }

        print "<div class=\"krumo-nest\" $collapse_style>";
        print "<ul class=\"krumo-node\">";

        // we're descending one level deeper
        static::$_level++;

        // Object?? - use Reflection
        if ($_is_object) {
            $reflection = new ReflectionObject($data);
            $properties = $reflection->getProperties();

            foreach ($properties as $property) {
                $prefix = null;
                $setAccessible = false;

                if ($property->isPrivate()) {
                    $setAccessible = true;
                    $prefix = 'private';
                } elseif ($property->isProtected()) {
                    $setAccessible = true;
                    $prefix = 'protected';
                } elseif ($property->isPublic()) {
                    $prefix = 'public';
                }

                $name = $property->getName();
                if ($setAccessible) {
                    $property->setAccessible(true);
                }

                $value = $property->getValue($data);

                static::_dump($value, "<span>$prefix</span>&nbsp;$name");
                if ($setAccessible) {
                    $property->setAccessible(false);
                }
            }
        } else {
            // keys
            $keys = array_keys($data);

            // iterate
            foreach ($keys as $k) {
                // skip marker
                if ($k === $_recursion_marker) {
                    continue;
                }

                // get real value
                $v =& $data[$k];

                static::_dump($v, $k);
            }
        }

        print "</ul>\n</div>";
        static::$_level--;
    }
837896
public function write(string $data) : void
    {
        $this->buffer .= $data;

        if (strlen($this->buffer) >= $this->size) {
            $this->flush();
        }
    }
626483
public function addData($data) : void
    {
        Assert::isInstanceOfAny($data, [Chunk::class, X509Certificate::class]);
        $this->data[] = $data;
    }
778191
public function receiveData(string $data): void
    {
        $chunkSize = null;

        while ($data) {
            $frame = $this->getReceivingFrame();

            $remaining = $frame->getRemainingData();

            if ($remaining === null) {
                $chunkSize = 2;
            } elseif ($remaining > 0) {
                $chunkSize = $remaining;
            }

            $chunkSize = min(strlen($data), $chunkSize);
            $chunk = substr($data, 0, $chunkSize);
            $data = substr($data, $chunkSize);

            $frame->receiveData($chunk);
        }
    }