LoginSignup
4
4

More than 5 years have passed since last update.

もしもドメインモデルを日本語で表現したら

Last updated at Posted at 2017-11-21
// 入退場管理システムの入退場カードエンティティ
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->従業員, $入退場);
    }

    // ...
}
4
4
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4