Skip to content

Instantly share code, notes, and snippets.

View ciszu's full-sized avatar

Michał Cisz ciszu

View GitHub Profile
<?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) {}
<?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) {}
{
"type": "project",
"name": "mozartify/web",
"require": {
"php": "^7.1.3",
"mozartify/subscription": "1.2.0",
"mozartify/player": "1.0.3"
}
}
<?php
namespace Mozartify\Subscription;
interface ReadOpStorage
{
public function select(string $model, int $id);
public function selectAll($model);
public function getActivePackage(int $subscriptionId);
}
<?php
namespace Mozartify\Subscription;
interface Storage
{
// ...
public function createNewTenant(string $tenantName);
public function addPackage(int $subscriptionId, string $packageType);
}
<?php
namespace Mozartify\Subscription\Drivers;
use Mozartify\Subscription\WriteOpStorage;
use Mozartify\Subscription\ReadOpStorage;
class RamStorage implements WriteOpStorage, ReadOpStorage
{
// ...
<?php
namespace Mozartify\Subscription;
class PostgreSqlStorage implements Storage
{
// ...
}
<?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) {}