Dump given value into target output.

@param mixed $value
@param int   $target Possible options: OUTPUT, RETURN, ERROR_LOG, LOGGER.
@return string
@throws DumperException
434486
public function dump($value, int $target = self::OUTPUT): ?string
    {
        $r = $this->getRenderer($target);
        $dump = $r->wrapContent($this->renderValue($r, $value));

        switch ($target) {
            case self::OUTPUT:
                echo $dump;
                break;

            case self::RETURN:
                return $dump;

            case self::LOGGER:
                if ($this->logger == null) {
                    throw new DumperException("Unable to dump value to log, no associated LoggerInterface");
                }
                $this->logger->debug($dump);
                break;

            case self::ERROR_LOG:
                error_log($dump, 0);
                break;
        }

        return null;
    }
1223766
public function dump($values) : string
    {
        if (! is_array($values))
            throw new DumpException($this, $values, self::ERROR);
        $items = [];
        $index = 0;
        try {
            foreach ($values as $key => $value) {
                $index = $key;
                $items[] = $this->syntax->dump($value);
            }
        } catch (DumpException $e) {
            throw new DumpException($this, $values, "Unable to dump item at key {$index}", [], $e);
        }

        return Text::join($items, $this->separator);
    }
154773
public function savePage($target, $html)
    {
        $fs = new Filesystem();
        $fs->dumpFile($this->target . DIRECTORY_SEPARATOR . $target, $html);
    }
128908
public static function Log ($value, $priority = \MvcCore\IDebug::INFO) {
		if (static::$originalDebugClass) {
			$dumpedValue = static::dumpHandler(
				$value, NULL, ['bar' => FALSE, 'backtraceIndex' => 1]
			);
			return static::storeLogRecord($dumpedValue, $priority);
		} else {
			return @call_user_func_array(static::$handlers['log'], func_get_args());
		}
	}
1020861
private static function serializeValue( $value ) {
		try {
			return serialize( $value );
		} catch ( \Exception $ex ) {
			self::$logger->error( 'Value serialization failed: ' . $ex->getMessage() );
			return null;
		}
	}
1155524
public static function dump($value): string
    {
        try {
            return serialize($value);
        } catch (\Throwable $e) {
        }

        throw new DumpException(sprintf('Error serializing value. %s', $e->getMessage()), 0, $e);
    }
189428
protected function dumpScalarValue ($value) {
		if (is_numeric($value)) {
			return (string) $value;
		} else if (is_bool($value)) {
			return $value ? 'true' : 'false';
		} else if ($value === NULL) {
			return 'null';
		} else {
			static $specialChars = [
				'=', '/', '.', '#', '&', '!', '?', '-', '@', "'", '"', '*', '^',
				'[', ']', '(', ')', '{', '}', '<', '>', '\n', '\r', 
			];
			$valueStr = (string) $value;
			$specialCharCaught = FALSE;
			foreach ($specialChars as $specialChar) {
				if (mb_strpos($valueStr, $specialChar)) {
					$specialCharCaught = TRUE;
					break;
				}
			}
			if ($specialCharCaught) {
				return '"' . addcslashes($valueStr, '"') . '"';
			} else {
				return $valueStr;
			}
		}
	}
1373967
public function dump($value)
    {
        switch (gettype($value)) {
            // Handle boolean values.
            case "boolean": {
                $output = $value ? "true" : "false";

                // You can represent booleans (and NULLs) in either lower- or uppercase format.
                return $this->config["bool_lowercase"] ? $output : strtoupper($output);
            }

            // Handle NULL values.
            case "NULL": {
                return $this->config["null_lowercase"] ? "null" : "NULL";
            }

            // Handle integers.
            case "integer": {
                return (string) $value;
            }

            // Handle floats (doubles).
            case "double": {
                // Dumpy allows you to round floats to round_double decimal points.
                if ($this->config["round_double"] !== false) {
                    $value = round($value, $this->config["round_double"], PHP_ROUND_HALF_UP);
                }

                return (string) $value;
            }

            // Handle strings.
            case "string": {
                // @suggestion Multibyte support?
                // Look above for the detailed explanation.
                if (strlen($value) > $this->config["str_max_length"]) {
                    $value = substr($value, 0, $this->config["str_max_length"]) . "...";
                }

                // Dumpy allows you to replace newline characters with "\\n".
                if ($this->config["replace_newline"]) {
                    $value = str_replace(PHP_EOL, "\\n", $value);
                }

                return "\"{$value}\"";
            }

            // Handle arrays.
            case "array": {
                return $this->printArray($value) . PHP_EOL;
            }

            // Handle objects.
            case "object": {
                return $this->printObject($value);
            }
            // @codeCoverageIgnoreStart
        }
    }
276875
public function dump($value)
    {
        if (class_exists(CliDumper::class)) {
            $data = (new VarCloner)->cloneVar($value);

            if ($this->connection === null || $this->connection->write($data) === false) {
                $dumper = in_array(PHP_SAPI, ['cli', 'phpdbg']) ? new CliDumper : new HtmlDumper;
                $dumper->dump($data);
            }
        } else {
            var_dump($value);
        }
    }
114061
public function getString($command, $target = null, $value = null)
    {
        $result = $this->doExecute($command, $target, $value);

        if (!preg_match('/^OK,/', $result)) {
            throw new Exception("Unexpected response from Selenium server : ".$result);
        }

        return strlen($result) > 3 ? substr($result, 3) : '';
    }
597006
public static function dumpString(string $value): string
    {
        if ('' === $value) {
            return "''";
        }

        // non UTF-8 string will encode "\xFF" and require <">
        if (!self::isUtf8String($value)) {
            return '"' . \preg_replace_callback(
                // ---------------------------------------------------
                //     0x80 ..    0x7FF => C2 80       ... DF BF
                // ---------------------------------------------------
                //    0x800 ..    0xFFF => E0 A0 80    ... E0 BF BF
                //   0x1000 ..   0xFFFF => E1 80 80    ... EF BF BF
                // ---------------------------------------------------
                //  0x10000 ..  0x3FFFF => F0 90 80 80 ... F0 BF BF BF
                //  0x40000 ..  0xFFFFF => F1 80 80 80 ... F3 BF BF BF
                // 0x100000 .. 0x10FFFF => F4 80 80 80 ... F4 8F BF BF

                // " \x22
                // $ \x24
                // \ \x5C
                '/
                    \\G
                    (?:
                        [\\x20\\x21\\x23\\x25-\\x5B\\x5D-\\x7E]++
                        | [\\xC2-\\xDF] [\\x80-\\xBF]
                        | \\xE0 [\\xA0-\\xBF] [\\x80-\\xBF]
                        | [\\xE1-\\xEF] [\\x80-\\xBF]{2}
                        | \\xF0 [\\x90-\\xBF] [\\x80-\\xBF]{2}
                        | [\\xF1-\\xF3] [\\x80-\\xBF]{3}
                        | \\xF4 [\\x80-\\x8F] [\\x80-\\xBF]{2}
                    )*+
                    \\K
                    (?:
                        ( ["$\\\\] )
                        |
                        ( . )
                    )
                /xs',
                /** @uses _escapeStringCallback() */
                \Closure::fromCallable([__CLASS__, '_escapeStringCallback']),
                $value
            ) . '"';
        }

        // valid UTF-8 string with control ASCII characters
        // also will encode "\xFF" and require <">, but regexp is much simple
        if (\preg_match('/[\\x00-\\x1F\\x7F]/', $value)) {
            return '"' . \preg_replace_callback(
                '/(["$\\\\])|([\\x00-\\x1F\\x7F])/',
                /** @uses _escapeStringCallback() */
                \Closure::fromCallable([__CLASS__, '_escapeStringCallback']),
                $value
            ) . '"';
        }

        return \var_export($value, true);
    }
637695
protected function dumpValue($value): string
    {
        if (null === $value) {
            return 'null';
        }

        if (false === $value) {
            return 'false';
        }
        if (true === $value) {
            return 'true';
        }

        if (\is_int($value) || \is_float($value)) {
            return (string)$value;
        }

        if (\is_string($value)) {
            return StringHelper::dumpString($value);
        }

        throw new \InvalidArgumentException('Unsupported data type:' . gettype($value));
    }
642858
public function moveTo(string $target): ?string
    {
        $ret = $this->handle->rpoplpush($this->name, $target);
        return (false === $ret) ? null : $ret;
    }
251638
public function dump($value)
    {
        if (class_exists('Symfony\Component\VarDumper\Cloner\VarCloner')) {
            static $dumper = null;

            // re-use the same var-dumper instance, so it won't re-render the global styles/scripts on each dump.
            if (!$dumper) {
                $dumper = new HtmlDumper();

                $styles = array(
                    'default' => '',
                    'num' => '',
                    'const' => '',
                    'str' => '',
                    'note' => '',
                    'ref' => '',
                    'public' => '',
                    'protected' => '',
                    'private' => '',
                    'meta' => '',
                    'key' => '',
                    'index' => '',
                );
                $dumper->setStyles($styles);
            }

            $cloner = new VarCloner();
            return $dumper->dump($cloner->cloneVar($value));
        }
        return print_r($value, true);
    }
1097431
public function copy($source, $target)
    {
        $it = new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS);
        $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::SELF_FIRST);

        if (!file_exists($target)) {
            mkdir($target, 0777, true);
        }

        foreach ($ri as $file) {
            $targetPath = $target . DIRECTORY_SEPARATOR . $ri->getSubPathName();
            if ($file->isDir()) {
                if (!file_exists($targetPath)) {
                    mkdir($targetPath);
                }
            } else {
                copy($file->getPathname(), $targetPath);
            }
        }
    }
961607
public static function TryParse( $value, &$output ) : bool
   {

      if ( $value instanceof Rectangle )
      {
         $output = $value;
         return true;
      }

      if ( \is_string( $value ) )
      {
         return ( false !== ( $output = self::FromString( $value ) ) );
      }

      if ( \is_array( $value ) )
      {
         return ( false !== ( $output = self::FromArray( $value ) ) );
      }

      return false;

   }
141555
public function compileWiths($value, array $args = array())
    {
        $generated = parent::compileString($value);

        ob_start() and extract($args, EXTR_SKIP);

        try {
            eval('?>'.$generated);
        } catch (\Exception $e) {
            ob_get_clean();
            throw $e;
        }

        $content = ob_get_clean();

        return $content;
    }