Pantheon\Terminus\Collections\PaymentMethods::get PHP Method

get() public method

Retrieves a payment method object by either its UUID or its label
public get ( string $id ) : PaymentMethod
$id string The identifier for the payment method requested
return PaymentMethod
    public function get($id)
    {
        $payment_methods = $this->models;
        if (isset($payment_methods[$id])) {
            return $payment_methods[$id];
        }
        $matches = array_filter($payment_methods, function ($payment_method) use($id) {
            return $payment_method->get('label') == $id;
        });
        if (empty($matches)) {
            throw new TerminusNotFoundException('Could not locate a payment method identified by {id} on this account.', compact('id'));
        } else {
            if (count($matches) > 1) {
                throw new TerminusException('More than one payment method matched {id}.', compact('id'));
            }
        }
        return array_shift($matches);
    }
PaymentMethods