Beispiel #1
0
 /**
  * @param callable $getter
  * @return Cli
  */
 public function setWindowWidthGetter($getter)
 {
     $exceptions = new Exceptions();
     $exceptions->throwIfIsNotCallable($getter);
     $this->windowWidthGetter = $getter;
     return $this;
 }
Beispiel #2
0
 /**
  * @param DumpFunctionInterface $function
  * @return Html
  * @throws \ErrorDumper\Helpers\NotCallableException
  */
 public function setVarDumpFn(DumpFunctionInterface $function)
 {
     $exceptions = new Exceptions();
     $exceptions->throwIfIsNotCallable($function);
     $this->varDumpFn = $function;
     return $this;
 }
 /**
  * @dataProvider providerTestThrowIfIsNotCallable
  * @param $value
  * @param bool $callable
  */
 public function testThrowIfIsNotCallable($value, $callable)
 {
     if (!$callable) {
         $this->setExpectedException('ErrorDumper\\Helpers\\NotCallableException');
     }
     $exceptions = new Exceptions();
     $exceptions->throwIfIsNotCallable($value);
 }
Beispiel #4
0
 /**
  * @param $exception
  * @param Editors\EditorInterface|null $editor
  * @param DumpFunctionInterface $varDumper
  * @return string
  * @throws Helpers\NotThrowableException
  */
 public static function exportExceptionToLightHtml($exception, Editors\EditorInterface $editor = null, DumpFunctionInterface $varDumper = null)
 {
     $exceptions = new Exceptions();
     $exceptions->throwIfIsNotThrowable($exception);
     is_null($editor) && ($editor = new Editors\Nothing());
     $tmp = tmpfile();
     $dumper = new Dumpers\Html($editor, $tmp);
     if (is_null($varDumper)) {
         $varDumper = new LightVarDumper();
     }
     $dumper->setVarDumpFn($varDumper);
     $dumper->displayException($exception);
     $stream = new Stream($tmp);
     $result = $stream->getContents();
     fclose($tmp);
     return $result;
 }
Beispiel #5
0
 /**
  * @param \Exception|\Throwable $exception
  */
 public function __invoke($exception)
 {
     $exceptions = new Exceptions();
     $exceptions->throwIfIsNotThrowable($exception);
     $pre = $this->preCallback;
     if (!empty($pre)) {
         try {
             call_user_func($pre, $exception);
         } catch (StopDisplayException $stopE) {
             return;
         }
     }
     $this->dumper->displayException($exception);
     $post = $this->postCallback;
     if (!empty($post)) {
         call_user_func($post, $exception);
     }
 }
 /**
  * This method is public because of supporting php 5.3.
  * @param $exception
  */
 public function onError($exception)
 {
     $exceptions = new Exceptions();
     $exceptions->throwIfIsNotThrowable($exception);
     call_user_func($this->callable, $exception);
 }