Skip to content

Commit

Permalink
#372 - Add __debugInfo() support to route object for easier debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
johanjanssens committed Jun 17, 2020
1 parent 3598b6e commit f873bcf
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,21 @@ public function isAbsolute()
{
return (bool) ($this->scheme && $this->host);
}

/**
* Generate debug info
*
* @return array
*/
public function __debugInfo()
{
$result = [
'route' => $this->toString(),
'state' => $this->getState(),
'format' => $this->getFormat(),
'status' => $this->isResolved() ? 'resolved' : $this->isGenerated() ? 'generated' : ''
];

return $result;
}
}
13 changes: 13 additions & 0 deletions code/site/components/com_pages/dispatcher/router/route/page.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,17 @@ public function setGenerated()

return $this;
}

/**
* Generate debug info
*
* @return array
*/
public function __debugInfo()
{
$result = parent::__debugInfo();
$result['page'] = $this->_page_path;

return $result;
}
}

0 comments on commit f873bcf

Please sign in to comment.