/** * Dump specified value. * * @param mixed $value * @param int $output * @return null|string */ public function dump($value, $output = self::OUTPUT_ECHO) { if (php_sapi_name() === 'cli' && $output == self::OUTPUT_ECHO) { print_r($value); if (is_scalar($value)) { echo "\n"; } return null; } //Dumping is pretty slow operation, let's record it so we can exclude dump time from application //timeline $benchmark = $this->benchmark('dump'); try { switch ($output) { case self::OUTPUT_ECHO: echo $this->style->mountContainer($this->dumpValue($value, '', 0)); break; case self::OUTPUT_RETURN: return $this->style->mountContainer($this->dumpValue($value, '', 0)); break; case self::OUTPUT_LOG: $this->logger()->debug(print_r($value, true)); break; case self::OUTPUT_LOG_NICE: $this->logger()->debug($this->dump($value, self::OUTPUT_RETURN)); break; } return null; } finally { $this->benchmark($benchmark); } }
/** * Dump specified value. * * @param mixed $value * @param int $output * @return null|string */ public function dump($value, $output = self::OUTPUT_ECHO) { //Dumping is pretty slow operation, let's record it so we can exclude dump time from application //timeline $benchmark = $this->benchmark('dump'); try { switch ($output) { case self::OUTPUT_ECHO: echo $this->style->mountContainer($this->dumpValue($value, '', 0)); break; case self::OUTPUT_RETURN: return $this->style->mountContainer($this->dumpValue($value, '', 0)); break; case self::OUTPUT_LOG: $this->logger()->debug($this->dump($value, self::OUTPUT_RETURN)); break; } return null; } finally { $this->benchmark($benchmark); } }