Skip to content

Instantly share code, notes, and snippets.

<?php
final class ProduceAccountStatementHandler
{
private $accountFinder;
private $pdfGenerator;
private $accountTotalCalculator;
public function __construct(
AccountFinder $accountFinder,
<?php
class ProduceDocumentHandler
{
private $accountFinder;
private $pdfGenerator;
public function __construct(
AccountFinder $accountFinder,
PdfGenerator $pdfGenerator
<?php
final class ProduceAccountStatementHandler
{
private $accountFinder;
private $pdfGenerator;
public function __construct(
AccountFinder $accountFinder,
PdfGenerator $pdfGenerator
abstract class ProducePdfHandler
{
private $pdfGenerator;
private $dataProvider;
public function __construct(
PdfGenerator $pdfGenerator,
DefaultDataProvider $dataProvider
) {
$this->pdfGenerator = $pdfGenerator;
final class ProduceStatementOfAccountHandler
{
private $pdfGenerator;
private $dataProvider;
public function __construct(
PdfGenerator $pdfGenerator,
DefaultDataProvider $dataProvider
) {
$this->pdfGenerator = $pdfGenerator;
@chrisharrison
chrisharrison / dry.example.1.php
Last active August 31, 2019 11:02
DRY example 1
function calculateInvoiceTotal(Invoice $invoice): float
{
$mainTotal = 0;
foreach ($invoice->main->items() as $item) {
if ($item->revoked() !== true) {
$mainTotal = $mainTotal + $item->total();
}
}
$othersTotal = 0;
#!/usr/bin/env ruby
# coding: utf-8
# <bitbar.title>GeoIPWeather</bitbar.title>
# <bitbar.version>v0.1.1</bitbar.version>
# <bitbar.author>Taylor Zane</bitbar.author>
# <bitbar.author.github>taylorzane</bitbar.author.github>
# <bitbar.desc>Your weather in the menu bar 🌤</bitbar.desc>
# <bitbar.image>http://i.imgur.com/vrT6vfb.png</bitbar.image>
# <bitbar.dependencies>ruby</bitbar.dependencies>
@chrisharrison
chrisharrison / rate.php
Last active September 18, 2017 12:44
Interest rate calculator
<?php
class Account
{
private $capital;
private $rate;
public function __construct(float $capital, float $rate)
{
$this->capital = $capital;