Fix styling

This commit is contained in:
iamfarhad authored and GitHub Actions committed 2022-01-16 08:18:46 +00:00
1 parent 145ce06288
commit 7a0be8a936
29 files changed
+263 -265

No files matched your search

+6 -7
View File
@@ -1,16 +1,13 @@
<?php
namespace Hekmatinasser\Verta\Traits;
use DateTimeZone;
use Hekmatinasser\Verta\Verta;
use InvalidArgumentException;
trait Accessor
{
/**
* Get a part of the Verta object
*
@@ -22,7 +19,7 @@ trait Accessor
*/
public function __get($name)
{
static $formats = array(
static $formats = [
'year' => 'Y',
'month' => 'n',
'day' => 'j',
@@ -35,7 +32,7 @@ trait Accessor
'weekOfYear' => 'W',
'daysInMonth' => 't',
'timestamp' => 'U',
);
];
switch (true) {
case isset($formats[$name]):
@@ -90,15 +87,18 @@ trait Accessor
list($year, $month, $day, $hour, $minute, $second) = explode('-', $this->format('Y-n-j-G-i-s'));
$$name = $value;
$this->setDateTime($year, $month, $day, $hour, $minute, $second);
break;
case 'timestamp':
$this->setTimestamp($value);
break;
case 'timezone':
case 'tz':
$this->setTimezone(new DateTimeZone($value));
break;
default:
@@ -268,5 +268,4 @@ trait Accessor
return $this->setTime($hour, $minute, $second, 0);
}
}
}