Skip to content

Commit

Permalink
Merge branch 'release/v0.8.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
betterthanclay committed Sep 3, 2019
2 parents 4cdf87e + 519a2f4 commit d641cfc
Show file tree
Hide file tree
Showing 9 changed files with 2,128 additions and 665 deletions.
11 changes: 10 additions & 1 deletion src/Glitch.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

use DecodeLabs\Glitch\Factory;
use DecodeLabs\Glitch\Context;
use DecodeLabs\Glitch\Stack\Trace;

/**
* This is just a facade.
Expand Down Expand Up @@ -54,11 +55,19 @@ public static function normalizePath(string $path): string
/**
* Shortcut to logException context method
*/
public function logException(\Throwable $e): void
public static function logException(\Throwable $e): void
{
Context::getDefault()->logException($e);
}

/**
* Create a stack trace
*/
public static function stackTrace(): Trace
{
return Trace::create();
}

/**
* Private instanciation
*/
Expand Down
6 changes: 5 additions & 1 deletion src/Glitch/Context.php
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,11 @@ public function setRenderer(Renderer $renderer): Context
public function getRenderer(): Renderer
{
if (!$this->dumpRenderer) {
$this->dumpRenderer = new Renderer\Html($this);
if (in_array(\PHP_SAPI, ['cli', 'phpdbg'])) {
$this->dumpRenderer = new Renderer\Cli($this);
} else {
$this->dumpRenderer = new Renderer\Html($this);
}
}

return $this->dumpRenderer;
Expand Down
11 changes: 10 additions & 1 deletion src/Glitch/Dumper/Entity.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,18 @@ class Entity
* Construct with required info
*/
public function __construct(string $type)
{
$this->setType($type);
}

/**
* Override type
*/
public function setType(string $type): Entity
{
$this->type = $type;
$this->id = str_replace('.', '-', uniqid($type.'-', true));
return $this;
}

/**
Expand Down Expand Up @@ -378,7 +387,7 @@ public function hasMeta(string $key): bool
if ($this->meta === null) {
return false;
}

return array_key_exists($key, $this->meta);
}

Expand Down
Loading

0 comments on commit d641cfc

Please sign in to comment.