mirror of
https://github.com/retailcrm/prestashop-module.git
synced 2025-03-03 19:53:19 +03:00
42 lines
1010 B
PHP
42 lines
1010 B
PHP
|
<?php
|
||
|
|
||
|
class Service
|
||
|
{
|
||
|
public static function getDate($file)
|
||
|
{
|
||
|
if (file_exists($file)) {
|
||
|
$result = file_get_contents($file);
|
||
|
} else {
|
||
|
$result = date('Y-m-d H:i:s', strtotime('-1 days', strtotime(date('Y-m-d H:i:s'))));
|
||
|
}
|
||
|
|
||
|
return $result;
|
||
|
}
|
||
|
|
||
|
public static function explodeFIO($string)
|
||
|
{
|
||
|
$result = array();
|
||
|
$parse = (!$string) ? false : explode(" ", $string, 3);
|
||
|
|
||
|
switch (count($parse)) {
|
||
|
case 1:
|
||
|
$result['firstName'] = $parse[0];
|
||
|
break;
|
||
|
case 2:
|
||
|
$result['firstName'] = $parse[1];
|
||
|
$result['lastName'] = $parse[0];
|
||
|
break;
|
||
|
case 3:
|
||
|
$result['firstName'] = $parse[1];
|
||
|
$result['lastName'] = $parse[0];
|
||
|
$result['patronymic'] = $parse[2];
|
||
|
break;
|
||
|
default:
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
return $result;
|
||
|
}
|
||
|
|
||
|
}
|