brokeyourbike/has-source-model

Interface for interacting with source models

Fund package maintenance!
brokeyourbike
Open Collective

Installs: 4 231

Dependents: 36

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

pkg:composer/brokeyourbike/has-source-model

2.0.1 2023-05-14 22:18 UTC

This package is auto-updated.

Last update: 2025-09-20 16:27:00 UTC


README

Latest Stable Version Total Downloads Maintainability Test Coverage

Interface for interacting with source models.

Installation

composer require brokeyourbike/has-source-model

Usage

use BrokeYourBike\HasSourceModel\HasSourceModelInterface;
use BrokeYourBike\HasSourceModel\HasSourceModelTrait;

class Client implements HasSourceModelInterface
{
    use HasSourceModelTrait;

    public function fetchTransaction(Transaction $transaction)
    {
        $this->setSourceModel($transaction);
        $this->performRequest("transactions/{$transaction->id}");
    }

    private function performRequest(string $url)
    {
        if ($this->getSourceModel($transaction)) {
            // do something with it
        }
    }
}

Authors

License

Mozilla Public License v2.0