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

Standard::transform()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 3
nc 2
nop 1
dl 0
loc 7
rs 10
c 0
b 0
f 0
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