Commit 91e4ad59 by David Renty

PSR-2 compliance

parent 0fa5230c
......@@ -180,7 +180,9 @@ class Formatter extends Component
if ($value === null) {
return $this->nullDisplay;
}
return str_replace('<p></p>', '',
return str_replace(
'<p></p>',
'',
'<p>' . preg_replace('/[\r\n]{2,}/', "</p>\n<p>", Html::encode($value)) . '</p>'
);
}
......@@ -468,7 +470,7 @@ class Formatter extends Component
*
* @return string the formatted result
*/
public function asRelativeTime($value, $referenceTime=null)
public function asRelativeTime($value, $referenceTime = null)
{
if ($value === null) {
return $this->nullDisplay;
......
......@@ -269,7 +269,7 @@ class FormatterTest extends TestCase
$dateThen = new DateTime('2014-02-28');
$this->assertSame('a month ago', $this->formatter->asRelativeTime($dateThen, $dateNow));
// Relative to current time tests (can't test with seconds though)
// Relative to current time tests (can't test with seconds though due to the tests computation time)
$this->assertSame('4 minutes ago', $this->formatter->asRelativeTime($this->buildDateSubIntervals('now', [$interval_244_seconds])));
$this->assertSame('a minute ago', $this->formatter->asRelativeTime($this->buildDateSubIntervals('now', [$interval_1_minute])));
$this->assertSame('33 minutes ago', $this->formatter->asRelativeTime($this->buildDateSubIntervals('now', [$interval_33_minutes])));
......@@ -335,7 +335,7 @@ class FormatterTest extends TestCase
$this->assertSame('in a month', $this->formatter->asRelativeTime($this->buildDateSubIntervals('2014-03-03', [$interval_1_month]), $dateNow));
$this->assertSame('in 28 days', $this->formatter->asRelativeTime($dateThen, $dateNow));
// Relative to current time tests (can't test with seconds though)
// Relative to current time tests (can't test with seconds though due to the tests computation time)
// We add 5 seconds to compensate for tests computation time
$interval_5_seconds = new DateInterval('PT5S');
$interval_5_seconds->invert = true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment