Passed
Push — master ( 9f100a...06f597 )
by Aimeos
13:51 queued 10:18
created

Standard   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 17
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A transform() 0 7 2
1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2019-2022
6
 * @package MW
7
 * @subpackage View
8
 */
9
10
11
namespace Aimeos\Base\View\Helper\Datetime;
12
13
14
/**
15
 * View helper class for formatting datetime values for the frontend.
16
 *
17
 * @package MW
18
 * @subpackage View
19
 */
20
class Standard
21
	extends \Aimeos\Base\View\Helper\Base
22
	implements \Aimeos\Base\View\Helper\Datetime\Iface
23
{
24
	/**
25
	 * Returns the formatted date and time.
26
	 *
27
	 * @param string|null $datetime ISO date and time
28
	 * @return string Formatted date
29
	 */
30
	public function transform( string $datetime = null ) : string
31
	{
32
		if( $datetime ) {
33
			return str_replace( ' ', 'T', substr( $datetime, 0, 16 ) );
34
		}
35
36
		return '';
37
	}
38
}
39