<?php
abstract class Storage
{
abstract function use (): void;
}
class QiNiuStorage extends Storage
{
public function use (): void
{
}
}
class YouPaiStorage extends Storage
{
public function use (): void
{
}
}
abstract class Live
{
abstract function use (): void;
}
class QiNiuLive extends Live
{
public function use (): void
{
}
}
class YouPaiLive extends Live
{
public function use (): void
{
}
}
abstract class Cdn
{
abstract function use (): void;
}
class QiNiuCdn extends Cdn
{
public function use (): void
{
}
}
class YouPaiCdn extends Cdn
{
public function use (): void
{
}
}
abstract class Factory
{
abstract public function createStorage(): Storage;
abstract public function createLive(): Live;
abstract public function createCdb(): Cdn;
}
class QiNiuFactory extends Factory
{
public function createStorage(): Storage
{
return new QiNiuStorage();
}
public function createLive(): Live
{
return new QiNiuLive();
}
public function createCdb(): Cdn
{
return new QiNiuCdn();
}
}
class YouPaiFactory extends Factory
{
public function createStorage(): Storage
{
return new YouPaiStorage();
}
public function createCdb(): Cdn
{
return new YouPaiCdn();
}
public function createLive(): Live
{
return new YouPaiLive();
}
}
$qiNiuFactory = new QiNiuFactory();
$qiNiuStorage = $qiNiuFactory->createStorage();
$qiNiuLive = $qiNiuFactory->createLive();
$qiNiuCdn = $qiNiuFactory->createCdb();
print_r($qiNiuStorage);
print_r($qiNiuLive);
print_r($qiNiuCdn);