RetrievalStatusResult

class RetrievalStatusResult

Class RetrievalStatusResult

Properties

protected Result $res

Methods

public static RetrievalStatusResult ok(RetrievalStatus $value) No description
public static RetrievalStatusResult err(Exception $err) No description
public bool isOk() No description
public bool isError() No description
public RetrievalStatus value() No description
public Exception|null getErr() No description
public RetrievalStatus|mixed valueOr(mixed $fallback) No description

Details

at line 30

ok()

public static RetrievalStatusResult ok(RetrievalStatus $value)

Parameters

RetrievalStatus $value

Return Value

RetrievalStatusResult
at line 38

err()

public static RetrievalStatusResult err(Exception $err)

Parameters

Exception $err

Return Value

RetrievalStatusResult
at line 45

isOk()

public bool isOk()

Return Value

bool
at line 52

isError()

public bool isError()

Return Value

bool
at line 60

value()

public RetrievalStatus value()

Return Value

RetrievalStatus

Exceptions

Exception
at line 67

getErr()

public Exception|null getErr()

Return Value

Exception|null
at line 75

valueOr()

public RetrievalStatus|mixed valueOr(mixed $fallback)

Parameters

mixed $fallback

Return Value

RetrievalStatus|mixed

Source code

<?php

namespace LibMVault\Result;

use LibMVault\RetrievalStatus;

/**
 * Class RetrievalStatusResult
 * @package LibMVault\Result
 */
class RetrievalStatusResult {

  /**
   * @var Result
   */
  protected $res;

  /**
   * RetrievalStatusResult constructor.
   * @param Result $res
   */
  private function __construct(Result $res) {
    $this->res = $res;
  }

  /**
   * @param RetrievalStatus $value
   * @return RetrievalStatusResult
   */
  public static function ok(RetrievalStatus $value): RetrievalStatusResult {
    return new RetrievalStatusResult(Result::ok($value));
  }

  /**
   * @param \Exception $err
   * @return RetrievalStatusResult
   */
  public static function err(\Exception $err): RetrievalStatusResult {
    return new RetrievalStatusResult(Result::err($err));
  }

  /**
   * @return bool
   */
  public function isOk(): bool {
    return $this->res->isOk();
  }

  /**
   * @return bool
   */
  public function isError(): bool {
    return $this->res->isError();
  }

  /**
   * @return RetrievalStatus
   * @throws \Exception
   */
  public function value(): RetrievalStatus {
    return $this->res->value();
  }

  /**
   * @return \Exception|null
   */
  public function getErr() {
    return $this->res->getErr();
  }

  /**
   * @param mixed $fallback
   * @return RetrievalStatus|mixed
   */
  public function valueOr($fallback) {
    return $this->res->valueOr($fallback);
  }
}