fixbug get methods

This commit is contained in:
Nasser committed 2020-03-05 19:31:37 +03:30
1 parent 2fec7f078a
commit c62f2a6c94
2 files changed
+7 -5

No files matched your search

+2 -2
View File
@@ -12,8 +12,8 @@
"require": { "require": {
"php": ">=5.5", "php": ">=5.5",
"hekmatinasser/notowo": "^1.0", "hekmatinasser/notowo": "^1.0",
"illuminate/validation": "^5|^6", "illuminate/validation": "^5|^6|^7",
"illuminate/support": "^5|^6" "illuminate/support": "^5|^6|^7"
}, },
"require-dev" : { "require-dev" : {
"phpunit/phpunit": "7.2.*", "phpunit/phpunit": "7.2.*",
+5 -3
View File
@@ -636,8 +636,7 @@ class Verta extends DateTime {
*/ */
public function __get($name) public function __get($name)
{ {
switch (true) { static $formats = array(
case array_key_exists($name, $formats = array(
'year' => 'Y', 'year' => 'Y',
'month' => 'n', 'month' => 'n',
'day' => 'j', 'day' => 'j',
@@ -650,7 +649,10 @@ class Verta extends DateTime {
'weekOfYear' => 'W', 'weekOfYear' => 'W',
'daysInMonth' => 't', 'daysInMonth' => 't',
'timestamp' => 'U', 'timestamp' => 'U',
)): );
switch (true) {
case isset($formats[$name]):
return (int) $this->format($formats[$name]); return (int) $this->format($formats[$name]);
case $name === 'quarter': case $name === 'quarter':