Writes data to the POP3 output stream.

@param string $data    String data.
@param boolean $debug  Output line to debug?

@throws Horde_Imap_Client_Exception
482150
public function write($data, $debug = true)
    {
        if (fwrite($this->_stream, $data . "\r\n") === false) {
            throw new Horde_Imap_Client_Exception(
                Horde_Imap_Client_Translation::r("Server write error."),
                Horde_Imap_Client_Exception::SERVER_WRITEERROR
            );
        }

        if ($debug) {
            $this->_params['debug']->client($data);
        }
    }
1006298
public function sendDataAsHtml($data) {
    $this->disableView();
    if (extension_loaded('xdebug')) {
      ob_start();
      var_dump($data);
      $output = ob_get_clean();
    }
    else {
      $output = sprintf(
          '<pre><code>%s</code></pre>',
          json_encode($data,JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT)
      );
    }
    $this->setContent($output);
    $this->send();
  }
1130542
public static function log(string $msg, array $data = [], int $level = self::VERB_DEBUG, array $opts = []): void
    {
        $levelName  = self::LEVEL_NAMES[$level] ?? 'INFO';
        $colorName  = self::LEVEL2TAG[$level] ?? 'info';
        $taggedName = ColorTag::add($levelName, $colorName);

        $userOpts = [];
        foreach ($opts as $n => $v) {
            if (\is_numeric($n) || \strpos($n, '_') === 0) {
                $userOpts[] = "[$v]";
            } else {
                $userOpts[] = "[$n:$v]";
            }
        }

        $optString = $userOpts ? ' ' . \implode(' ', $userOpts) : '';

        self::write(\sprintf(
            '%s [%s]%s %s %s',
            \date('Y/m/d H:i:s'),
            $taggedName,
            $optString,
            \trim($msg),
            $data ? \PHP_EOL . \json_encode($data, \JSON_UNESCAPED_SLASHES | \JSON_PRETTY_PRINT) : ''
        ));
    }
270780
public function save(Debuggee $debuggee, array $breakpoints)
    {
        $shmid = shm_attach($this->sysvKey);
        if ($shmid === false) {
            throw new \RuntimeException(
                'Failed to attach to the shared memory'
            );
        }
        $result = shm_put_var($shmid, self::VAR_KEY, [$debuggee->id(), $breakpoints]);
        shm_detach($shmid);
        return $result;
    }
359656
public function setDebug($debug)
    {
        $this->debug = strtolower((string) $debug);

        $message = sprintf("Set debug flag to [%s].", $this->debug);
        $this->log($message, Project::MSG_DEBUG);
    }
826155
public synchronized void setDebug(boolean debug)
    {
        boolean oldDebug=_debugOn;
        if (_debugOn && !debug)
            this.message(DEBUG,"DEBUG OFF");
        _debugOn=debug;
        if (!oldDebug && debug)
            this.message(DEBUG,"DEBUG ON");
    }
1294480
public function write($showDebug = false, $forceInsert = false, $forceWrite = false, $writeComponents = false)
    {
        throw new Exception("{$this->ClassName} can not be written back to the database.");
    }
1311945
public function render(array $values, bool $debug = false)
    {
        $vals = $this->compileValues($values);
        return str_replace(array_keys($vals), array_values($vals), $this->templateSource);
    }
1183977
public static function set_debug($toggle, $output = "stdout") {
    if ($toggle) {
      self::$debug = $output;
    }
    else {
      self::$debug = false;
    }
  }
42095
private function output($text, $level = null)
    {
        if ($this->logger) {
            $this->logger->log($level ?: LogLevel::DEBUG, $text);
        }

        if ($this->debug) {
            fwrite(STDERR, sprintf('xdebug-handler[%d] %s', getmypid(), $text.PHP_EOL));
        }
    }
120342
public static function dump($data, $description = null, $function = 'print_r')
    {
        if (!in_array($function, ['print_r', 'var_dump'])) {
            throw new Exception("dump type {$function} not supported");
        }

        if (self::isCli()) {
            if ($description) {
                echo $description . ":\n";
            }
            $function($data);
            if (is_scalar($data)) {
                echo "\n\n";
            }
        } else {
            echo "<pre class=\"debug-dump\">";
            if ($description) {
                echo $description . ":\n";
            }
            $function($data);
            echo "</pre>\n";
        }
    }
128725
public function writeDebug($key, $string)
    {
        if (is_null($this->responseDebug)) {
            $this->responseDebug = new ResponseBag();
            $this->response->add($this->responseDebug);
        }
        $this->responseDebug->add(['debug' => [$key => $string]]);
        ErrorHandler::getInstance()->addExtraInfo($key, serialize($string));
    }
225877
public function buildCommand($debug = false)
    {
        $this->outputLine('<b>Run build hook commands</b>');
        $this->commandService->executeHooks($this->buildHooks, function (...$args) { $this->outputLine(...$args); } );
        $this->sendAndExit(0);
    }
1188984
protected function renderExceptionWithSymfony(Exception $e, $debug)
    {
        return (new SymfonyExceptionHandler($debug))->getHtml(
            FlattenException::create($e)
        );
    }
927457
public function client_send($data)
    {
        $this->edebug("CLIENT -> SERVER: $data", self::DEBUG_CLIENT);
        set_error_handler(array($this, 'errorHandler'));
        $result = fwrite($this->smtp_conn, $data);
        restore_error_handler();
        return $result;
    }
1140170
public function write($showDebug = false, $forceInsert = false, $forceWrite = false, $writeComponents = false)
    {
        //throw new Exception("{$this->ClassName} can not be written back to the database.");
        // NOTE: we need to fail silently on writes because writing is part of the cloud upload process
        if ($this->storeRecord) {
            $this->storeRecord->write($showDebug, $forceInsert, $forceWrite, $writeComponents);
        }
    }
1043304
public function notify(MessageInterface $message, $debug = false)
    {
        $payload = $this->serializer->serialize($message, 'json');

        $request = $this->client->post(
            '/services/hooks/incoming-webhook',
            array(),
            $payload,
            array('debug' => $debug)
        );

        $request->send();
    }