PHP code example of brokeyourbike / has-source-model
1. Go to this page and download the library: Download brokeyourbike/has-source-model library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
brokeyourbike / has-source-model example snippets
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
}
}
}