diff --git a/src/Commands/Inspect.php b/src/Commands/Inspect.php index 86aec32..b4fffc6 100644 --- a/src/Commands/Inspect.php +++ b/src/Commands/Inspect.php @@ -41,7 +41,7 @@ public function handle() array_walk( $inspectedRepository['results'], function (&$row) { - $row = (array)$row; + $row = $row->toArray(); } ); diff --git a/src/Result.php b/src/Result.php index f5872b8..6a02d17 100644 --- a/src/Result.php +++ b/src/Result.php @@ -88,7 +88,20 @@ public function getDate() public function __toString() { - return json_encode((array)$this); + return json_encode($this->toArray()); + } + + public function toArray() + { + return [ + 'filename' => $this->filename, + 'line' => $this->line, + 'author' => $this->author, + 'email' => $this->email, + 'date' => $this->date, + 'commitHash' => $this->commitHash, + 'parser' => $this->parser, + ]; } /**