0.2
This commit is contained in:
parent
31d3ff4aa4
commit
ffe19cd023
|
@ -1 +1,2 @@
|
||||||
{"version":1,"defects":{"demo\\Creational\\FactoryMethod\\tests\\FactoryMethodTest::testCanCreateStdoutLogging":4,"demo\\Creational\\FactoryMethod\\tests\\FactoryMethodTest::testCanCreateFileLogging":4,"demo\\Creational\\FactoryMethod\\tests\\StdoutLoggerTest::testCanCreateStdoutLogging":4,"demo\\Creational\\FactoryMethod\\tests\\StdoutLoggerTest::testCanCreateFileLogging":4,"demo\\Creational\\FactoryMethod\\tests\\StdoutLoggerTest::testLog":4,"demo\\Creational\\Singleton\\Tests\\SingletonTest::testUniqueness":4,"demo\\Structural\\DependencyInjection\\Tests\\DependencyInjectionTest::testDependencyInjection":4},"times":{"demo\\Creational\\FactoryMethod\\tests\\FactoryMethodTest::testCanCreateStdoutLogging":0.007,"demo\\Creational\\FactoryMethod\\tests\\FactoryMethodTest::testCanCreateFileLogging":0,"StackTest::testPushAndPop":0.004,"demo\\Creational\\FactoryMethod\\tests\\StdoutLoggerTest::testCanCreateStdoutLogging":0.005,"demo\\Creational\\FactoryMethod\\tests\\StdoutLoggerTest::testCanCreateFileLogging":0,"demo\\Creational\\FactoryMethod\\tests\\StdoutLoggerTest::testLog":0.004,"demo\\Creational\\Singleton\\Tests\\SingletonTest::testUniqueness":0.005,"demo\\Structural\\DependencyInjection\\Tests\\DependencyInjectionTest::testDependencyInjection":0.007}}
|
{"version":1,"defects":{"demo\\Creational\\FactoryMethod\\tests\\FactoryMethodTest::testCanCreateStdoutLogging":4,"demo\\Creational\\FactoryMethod\\tests\\FactoryMethodTest::testCanCreateFileLogging":4,"demo\\Creational\\FactoryMethod\\tests\\StdoutLoggerTest::testCanCreateStdoutLogging":4,"demo\\Creational\\FactoryMethod\\tests\\StdoutLoggerTest::testCanCreateFileLogging":4,"demo\\Creational\\FactoryMethod\\tests\\StdoutLoggerTest::testLog":4,"demo\\Creational\\Singleton\\Tests\\SingletonTest::testUniqueness":4,"demo\\Structural\\DependencyInjection\\Tests\\DependencyInjectionTest::testDependencyInjection":4},"times":{"demo\\Creational\\FactoryMethod\\tests\\FactoryMethodTest::testCanCreateStdoutLogging":0.007,"demo\\Creational\\FactoryMethod\\tests\\FactoryMethodTest::testCanCreateFileLogging":0,"StackTest::testPushAndPop":0.004,"demo\\Creational\\FactoryMethod\\tests\\StdoutLoggerTest::testCanCreateStdoutLogging":0.005,"demo\\Creational\\FactoryMethod\\tests\\StdoutLoggerTest::testCanCreateFileLogging":0,"demo\\Creational\\FactoryMethod\\tests\\StdoutLoggerTest::testLog":0.004,"demo\\Creational\\Singleton\\Tests\\SingletonTest::testUniqueness":0.005,"demo\\Structural\\DependencyInjection\\Tests\\DependencyInjectionTest::testDependencyInjection":0.007}}
|
||||||
|
|
||||||
|
|
|
@ -32,4 +32,4 @@
|
||||||
| 20 | 原型模式(Prototype) | 不太常用 | 应用级 | 编码时、重构时 | 比较简单 | 实例化的类 | 封装对原型的拷贝 | 依赖倒置原则 |
|
| 20 | 原型模式(Prototype) | 不太常用 | 应用级 | 编码时、重构时 | 比较简单 | 实例化的类 | 封装对原型的拷贝 | 依赖倒置原则 |
|
||||||
| 21 | 享元模式(Flyweight) | 不太常用 | 代码级、应用级 | 设计时 | 一般 | 系统开销的优化 | 封装对象的获取 | |
|
| 21 | 享元模式(Flyweight) | 不太常用 | 代码级、应用级 | 设计时 | 一般 | 系统开销的优化 | 封装对象的获取 | |
|
||||||
| 22 | 责任链模式(Chain Of Responsibilities) | 不太常用 | 应用级、构架级 | 设计时、编码时 | 比较复杂 | 对象的请求过程 | 封装对象的责任范围 | |
|
| 22 | 责任链模式(Chain Of Responsibilities) | 不太常用 | 应用级、构架级 | 设计时、编码时 | 比较复杂 | 对象的请求过程 | 封装对象的责任范围 | |
|
||||||
| 23 | 解释器模式(Interpreter) | 不太常用 | 应用级 | 设计时 | 比较复杂 | 领域问题的变化 | 封装特定领域的变化 | |
|
| 23 | 解释器模式(Interpreter) | 不太常用 | 应用级 | 设计时 | 比较复杂 | 领域问题的变化 | 封装特定领域的变化 | |
|
||||||
|
|
|
@ -1,18 +1,21 @@
|
||||||
<?php
|
<?php
|
||||||
declare(strict_types=1);
|
declare(strict_types = 1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* phpunit 实例
|
||||||
|
*/
|
||||||
class StackTest extends \PHPUnit\Framework\TestCase
|
class StackTest extends \PHPUnit\Framework\TestCase
|
||||||
{
|
{
|
||||||
public function testPushAndPop(): void
|
public function testPushAndPop() : void
|
||||||
{
|
{
|
||||||
$stack = [];
|
$stack = [];
|
||||||
$this->assertSame(0, count($stack));
|
$this->assertSame(0, count($stack));
|
||||||
|
|
||||||
$stack[] = 'foo';
|
$stack[] = 'fooq';
|
||||||
$this->assertSame('foo', $stack[count($stack)-1]);
|
$this->assertSame('fooq', $stack[ count($stack) - 1 ]);
|
||||||
$this->assertSame(1, count($stack));
|
$this->assertSame(1, count($stack));
|
||||||
|
|
||||||
$this->assertSame('foo', array_pop($stack));
|
$this->assertSame('fooq', array_pop($stack));
|
||||||
$this->assertSame(0, count($stack));
|
$this->assertSame(0, count($stack));
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -2,6 +2,9 @@
|
||||||
|
|
||||||
namespace bin;
|
namespace bin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* demo入口父类
|
||||||
|
*/
|
||||||
abstract class Design
|
abstract class Design
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
|
|
||||||
namespace bin;
|
namespace bin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 接口
|
||||||
|
*/
|
||||||
interface DesignInterface
|
interface DesignInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -23,3 +23,4 @@
|
||||||
"vimeo/psalm": "5.x-dev"
|
"vimeo/psalm": "5.x-dev"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4338,3 +4338,4 @@
|
||||||
"platform-dev": [],
|
"platform-dev": [],
|
||||||
"plugin-api-version": "2.2.0"
|
"plugin-api-version": "2.2.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
# 行为型
|
# 行为型模式
|
|
@ -1 +1 @@
|
||||||
# 创建型
|
# 创建型模式
|
|
@ -1 +1 @@
|
||||||
# 更多其他类型
|
# 更多其他类型模式
|
|
@ -1 +1 @@
|
||||||
# 结构型
|
# 结构型模式
|
10
index.php
10
index.php
|
@ -1,11 +1,11 @@
|
||||||
<?php
|
<?php
|
||||||
|
// 根目录
|
||||||
const ROOTDIR = __DIR__;
|
const ROOTDIR = __DIR__;
|
||||||
|
// composer 自动依赖注入文件
|
||||||
require ROOTDIR . '/vendor/autoload.php';
|
require ROOTDIR . '/vendor/autoload.php';
|
||||||
|
// 自动实现的自动依赖注入文件
|
||||||
require ROOTDIR . '/bin/Psr4Autoload.php';
|
require ROOTDIR . '/bin/Psr4Autoload.php';
|
||||||
|
// 注册命名空间
|
||||||
(new \bin\Psr4Autoload)->register();
|
(new \bin\Psr4Autoload)->register();
|
||||||
|
// 首页默认内容
|
||||||
(new \bin\Base);
|
(new \bin\Base);
|
||||||
|
|
Loading…
Reference in New Issue