From 15eed37bda1fd04aa799b3eb6fb28e5f4cabaf5e Mon Sep 17 00:00:00 2001 From: diosmosis <benaka@piwik.pro> Date: Sat, 13 Sep 2014 08:28:17 -0700 Subject: [PATCH] Add toString() method to Piwik\Segment for easier logging of Segment instances. --- core/Segment.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/core/Segment.php b/core/Segment.php index 01e056bf68..e12b165028 100644 --- a/core/Segment.php +++ b/core/Segment.php @@ -451,4 +451,14 @@ class Segment $query = $this->buildSelectQuery($select, $from, $where, $orderBy, $groupBy); return $query; } -} + + /** + * Returns the segment string. + * + * @return string + */ + public function __toString() + { + return (string) $this->getString(); + } +} \ No newline at end of file -- GitLab