// 入退場管理システムの入退場カードエンティティ
class 入退場カード
{
// ...
public function 入退場する(入退場 $入退場): 入退場イベント
{
// このドメインでは不審な入退場を検知する必要がある
if ($this->未登録カードか()) {
return 不審な入退場::未登録カードで入退場した($this->製造番号, $入退場);
}
if ($this->保有者未割り当てカードか()) {
return 不審な入退場::未割り当てカードで入退場した($this->製造番号, $入退場);
}
if ($this->保有者->契約期間超過か($入退場->日時)) {
return 不審な入退場::契約期間超過の従業員が入退場した($this->製造番号, $this->従業員, $入退場);
}
if ($入退場->入場か() && $this->前回の入退場->入場か()) {
return 不審な入退場::連続入場した($this->製造番号, $this->従業員, $入退場);
}
if ($入退場->退場か() && $this->前回の入退場->退場か()) {
return 不審な入退場::連続退場した($this->製造番号, $this->従業員, $入退場);
}
// 正常な入退場
return new 入退場した($this->製造番号, $this->従業員, $入退場);
}
// ...
}
More than 5 years have passed since last update.
もしもドメインモデルを日本語で表現したら
Last updated at Posted at 2017-11-21
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme
List of users who liked
44