diff --git a/.phpunit.result.cache b/.phpunit.result.cache index 9ab4bee..917949d 100644 --- a/.phpunit.result.cache +++ b/.phpunit.result.cache @@ -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}} \ No newline at end of file +{"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}} + diff --git a/README.md b/README.md index cb4acfe..34240b0 100644 --- a/README.md +++ b/README.md @@ -32,4 +32,4 @@ | 20 | 原型模式(Prototype) | 不太常用 | 应用级 | 编码时、重构时 | 比较简单 | 实例化的类 | 封装对原型的拷贝 | 依赖倒置原则 | | 21 | 享元模式(Flyweight) | 不太常用 | 代码级、应用级 | 设计时 | 一般 | 系统开销的优化 | 封装对象的获取 | | | 22 | 责任链模式(Chain Of Responsibilities) | 不太常用 | 应用级、构架级 | 设计时、编码时 | 比较复杂 | 对象的请求过程 | 封装对象的责任范围 | | -| 23 | 解释器模式(Interpreter) | 不太常用 | 应用级 | 设计时 | 比较复杂 | 领域问题的变化 | 封装特定领域的变化 | | \ No newline at end of file +| 23 | 解释器模式(Interpreter) | 不太常用 | 应用级 | 设计时 | 比较复杂 | 领域问题的变化 | 封装特定领域的变化 | | diff --git a/Tests/StackTest.php b/Tests/StackTest.php index 9ac3a05..94cbf37 100644 --- a/Tests/StackTest.php +++ b/Tests/StackTest.php @@ -1,18 +1,21 @@ assertSame(0, count($stack)); - - $stack[] = 'foo'; - $this->assertSame('foo', $stack[count($stack)-1]); + + $stack[] = 'fooq'; + $this->assertSame('fooq', $stack[ count($stack) - 1 ]); $this->assertSame(1, count($stack)); - $this->assertSame('foo', array_pop($stack)); + $this->assertSame('fooq', array_pop($stack)); $this->assertSame(0, count($stack)); } } \ No newline at end of file diff --git a/bin/Design.php b/bin/Design.php index 6ef35c8..fc6c895 100644 --- a/bin/Design.php +++ b/bin/Design.php @@ -2,6 +2,9 @@ namespace bin; +/** + * demo入口父类 + */ abstract class Design { /** diff --git a/bin/DesignInterface.php b/bin/DesignInterface.php index 3363570..3337670 100644 --- a/bin/DesignInterface.php +++ b/bin/DesignInterface.php @@ -2,6 +2,9 @@ namespace bin; +/** + * 接口 + */ interface DesignInterface { diff --git a/composer.json b/composer.json index db436d4..b2063f6 100644 --- a/composer.json +++ b/composer.json @@ -23,3 +23,4 @@ "vimeo/psalm": "5.x-dev" } } + diff --git a/composer.lock b/composer.lock index e77ff2d..b4aff59 100644 --- a/composer.lock +++ b/composer.lock @@ -4338,3 +4338,4 @@ "platform-dev": [], "plugin-api-version": "2.2.0" } + diff --git a/demo/Behavioral/README.md b/demo/Behavioral/README.md index e5b1a9a..ebbed69 100644 --- a/demo/Behavioral/README.md +++ b/demo/Behavioral/README.md @@ -1 +1 @@ -# 行为型 \ No newline at end of file +# 行为型模式 \ No newline at end of file diff --git a/demo/Creational/README.md b/demo/Creational/README.md index 528fd8e..9c7fff1 100644 --- a/demo/Creational/README.md +++ b/demo/Creational/README.md @@ -1 +1 @@ -# 创建型 \ No newline at end of file +# 创建型模式 \ No newline at end of file diff --git a/demo/More/README.md b/demo/More/README.md index 9225a76..27a8478 100644 --- a/demo/More/README.md +++ b/demo/More/README.md @@ -1 +1 @@ -# 更多其他类型 \ No newline at end of file +# 更多其他类型模式 \ No newline at end of file diff --git a/demo/Structural/README.md b/demo/Structural/README.md index 9f8f59f..b62b0f2 100644 --- a/demo/Structural/README.md +++ b/demo/Structural/README.md @@ -1 +1 @@ -# 结构型 \ No newline at end of file +# 结构型模式 \ No newline at end of file diff --git a/index.php b/index.php index ae0d967..466523c 100644 --- a/index.php +++ b/index.php @@ -1,11 +1,11 @@ register(); - +// 首页默认内容 (new \bin\Base); diff --git a/psalm.xml b/psalm.xml index 094259f..d212a9a 100644 --- a/psalm.xml +++ b/psalm.xml @@ -13,3 +13,4 @@ +