{$name})) { return $this->{$name}; } else if (isset($this->data[$name])) { return $this->data[$name]; } return null; } /** * Checks whether the payment was successful. * * @return boolean True on success, otherwise false. */ public function isVerified() { return $this->status; } /** * Marks the payment status as verified or failed. * * @param boolean $status True if verified (default). * * @return self This object to support chaining. */ public function verified($status = true) { $this->status = (bool) $status; return $this; } /** * Sets the total amount that have been paid. * * @param float $amount The total paid. * * @return self This object to support chaining. */ public function paid($amount) { $this->amount = (float) $amount; return $this; } /** * Tracks the given log. * * @param mixed $log A string or a non-scalar value. * An array will be logged using print_r. * * @return self This object to support chaining. */ public function setLog($log) { if (!is_scalar($log)) { // use print_r for non scalar logs $log = print_r($log, true); } $this->log = $log; return $this; } /** * Appends the given log to the existing string. * * @param mixed $log A string or a non-scalar value. * An array will be logged using print_r. * * @return self This object to support chaining. * * @uses setLog() */ public function appendLog($log, $separator = "\n") { // keep current log $current = $this->log; // set log using the proper method $this->setLog($log); // re-build the log by prepending the existing logs $this->log = $current . $separator . $this->log; return $this; } /** * Prepends the given log to the existing string. * * @param mixed $log A string or a non-scalar value. * An array will be logged using print_r. * * @return self This object to support chaining. * * @uses setLog() */ public function prependLog($log, $separator = "\n") { // keep current log $current = $this->log; // set log using the proper method $this->setLog($log); // re-build the log by appending the existing logs $this->log .= $separator . $current; return $this; } /** * Registers the additional transaction data. * * @param string $key The transaction key. * @param mixed $val The transaction value. * * @return self This object to support chaining. */ public function setData($key, $val) { $this->data[$key] = $val; return $this; } }