Skip to content

Instantly share code, notes, and snippets.

Avatar

Michał Cisz ciszu

View GitHub Profile
View migawka-solid-domain.php
<?php
namespace Mozartify\Subscription;
class SubscriptionDomain
{
public function subscribe($tenantName, $packageType) {}
public static function getHeartbeatsByPackageType(string $type) {}
public function buyPackage(int $subscriptionId, string $newPackageType) {}
public function buyHeartbeats(int $subscriptionId, int $heartbeats) {}
View migawka-solid-domain.php
<?php
namespace Mozartify\Subscription;
class SubscriptionDomain
{
public function subscribe($tenantName, $packageType) {}
public static function getHeartbeatsByPackageType(string $type) {}
public function buyPackage(int $subscriptionId, string $newPackageType) {}
public function buyHeartbeats(int $subscriptionId, int $heartbeats) {}
View migawka-solid-composer.json
{
"type": "project",
"name": "mozartify/web",
"require": {
"php": "^7.1.3",
"mozartify/subscription": "1.2.0",
"mozartify/player": "1.0.3"
}
}
View migawka-solid-postgresqlstoragereadwriteop.php
<?php
namespace Mozartify\Subscription;
interface ReadOpStorage
{
public function select(string $model, int $id);
public function selectAll($model);
public function getActivePackage(int $subscriptionId);
}
View migawka-solid-lsp.php
<?php
namespace Mozartify\Subscription;
interface Storage
{
// ...
public function createNewTenant(string $tenantName);
public function addPackage(int $subscriptionId, string $packageType);
}
View migawka-solid-ramfilestorage.php
<?php
namespace Mozartify\Subscription\Drivers;
use Mozartify\Subscription\WriteOpStorage;
use Mozartify\Subscription\ReadOpStorage;
class RamStorage implements WriteOpStorage, ReadOpStorage
{
// ...
View migawka-solid-storageinterfaceusage.php
<?php
namespace Mozartify\Subscription;
class PostgreSqlStorage implements Storage
{
// ...
}
View migawka-solid-postgresqlstorage.php
<?php
namespace Mozartify\Subscription;
class PostgreSqlStorage
{
public function __construct($dsn) {}
public function select(string $model, int $id) {}
public function selectAll($model) {}
public function createNewTenant(string $tenantName) {}