Exemplo n.º 1
0
 /**
  * Add an account
  *
  * @param Account $account Account to add
  * @param Nominal $parent Optional id of account parent
  *
  * @return $this
  * @throws AccountsException
  */
 public function addAccount(Account $account, Nominal $parent = null)
 {
     Match::on($this->tryHasNode($account->getId(), self::ERR_ACEXISTS))->Monad_FTry_Success(Success::create(Match::on($parent)->SAccounts_Nominal(function ($p) {
         return $this->findNode($p);
     })->null($this->tree)->value()))->value()->pass()->value()->addChild(new Node($account));
     return $this;
 }
Exemplo n.º 2
0
 public function testCallingIsSuccessWillReturnTrue()
 {
     $this->assertTrue(Success::create('foo')->isSuccess());
 }