-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v1.1.6 新增人元司令分野;修复立春比正月初一早导致大小运错误的问题。
- Loading branch information
Showing
15 changed files
with
292 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,3 +51,7 @@ | |
|
||
## [1.1.5] - 2024-11-13 | ||
1. 新增:2025年法定假日。 | ||
|
||
## [1.1.6] - 2024-12-09 | ||
1. 新增:人元司令分野。 | ||
2. 修复:立春比正月初一早导致大小运错误的问题。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
|
||
namespace com\tyme\enums; | ||
|
||
/** | ||
* 藏干类型 | ||
* @author 6tail | ||
* @package com\tyme\enums | ||
*/ | ||
enum HideHeavenStemType: int | ||
{ | ||
case RESIDUAL = 0; | ||
case MIDDLE = 1; | ||
case MAIN = 2; | ||
|
||
function getCode(): int | ||
{ | ||
return $this->value; | ||
} | ||
|
||
function getName(): string | ||
{ | ||
return match ($this) { | ||
self::RESIDUAL => '余气', | ||
self::MIDDLE => '中气', | ||
self::MAIN => '本气' | ||
}; | ||
} | ||
|
||
static function fromCode(int $code): HideHeavenStemType | ||
{ | ||
return match ($code) { | ||
0 => self::RESIDUAL, | ||
1 => self::MIDDLE, | ||
2 => self::MAIN, | ||
default => null | ||
}; | ||
} | ||
|
||
static function fromName(string $name): HideHeavenStemType | ||
{ | ||
return match ($name) { | ||
'余气' => self::RESIDUAL, | ||
'中气' => self::MIDDLE, | ||
'本气' => self::MAIN, | ||
default => null | ||
}; | ||
} | ||
|
||
function equals(HideHeavenStemType $o): bool | ||
{ | ||
return $this->value == $o->value; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ | |
use com\tyme\LoopTyme; | ||
|
||
/** | ||
* 天干 | ||
* 天干(天元) | ||
* @author 6tail | ||
* @package com\tyme\sixtycycle | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<?php | ||
|
||
namespace com\tyme\sixtycycle; | ||
|
||
|
||
use com\tyme\AbstractCulture; | ||
use com\tyme\enums\HideHeavenStemType; | ||
|
||
/** | ||
* 藏干(即人元,司令取天干,分野取天干的五行) | ||
* @author 6tail | ||
* @package com\tyme\sixtycycle | ||
*/ | ||
class HideHeavenStem extends AbstractCulture | ||
{ | ||
|
||
/** | ||
* @var HeavenStem 天干 | ||
*/ | ||
protected HeavenStem $heavenStem; | ||
|
||
/** | ||
* @var HideHeavenStemType 藏干类型 | ||
*/ | ||
protected HideHeavenStemType $type; | ||
|
||
function __construct(HeavenStem|string|int $heavenStem, HideHeavenStemType $type) | ||
{ | ||
if (is_string($heavenStem)) { | ||
$this->heavenStem = HeavenStem::fromName($heavenStem); | ||
} elseif (is_int($heavenStem)) { | ||
$this->heavenStem = HeavenStem::fromIndex($heavenStem); | ||
} else { | ||
$this->heavenStem = $heavenStem; | ||
} | ||
$this->type = $type; | ||
} | ||
|
||
/** | ||
* 天干 | ||
* | ||
* @return HeavenStem 天干 | ||
*/ | ||
function getHeavenStem(): HeavenStem | ||
{ | ||
return $this->heavenStem; | ||
} | ||
|
||
/** | ||
* 藏干类型 | ||
* | ||
* @return HideHeavenStemType 藏干类型 | ||
*/ | ||
function getType(): HideHeavenStemType | ||
{ | ||
return $this->type; | ||
} | ||
|
||
function getName(): string | ||
{ | ||
return $this->heavenStem->getName(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
namespace com\tyme\sixtycycle; | ||
|
||
|
||
use com\tyme\AbstractCultureDay; | ||
|
||
/** | ||
* 人元司令分野(地支藏干+天索引) | ||
* @author 6tail | ||
* @package com\tyme\sixycycle | ||
*/ | ||
class HideHeavenStemDay extends AbstractCultureDay | ||
{ | ||
function __construct(HideHeavenStem $hideHeavenStem, int $dayIndex) | ||
{ | ||
parent::__construct($hideHeavenStem, $dayIndex); | ||
} | ||
|
||
/** | ||
* 藏干 | ||
* | ||
* @return HideHeavenStem 藏干 | ||
*/ | ||
function getHideHeavenStem(): HideHeavenStem | ||
{ | ||
return $this->culture; | ||
} | ||
|
||
function getName(): string | ||
{ | ||
$heavenStem = $this->getHideHeavenStem()->getHeavenStem(); | ||
return $heavenStem->getName() . $heavenStem->getElement()->getName(); | ||
} | ||
|
||
function __toString(): string | ||
{ | ||
return sprintf('%s第%d天', $this->getName(), $this->getDayIndex() + 1); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.