This commit is contained in:
cloud 2022-04-15 04:37:19 +08:00
parent 31d3ff4aa4
commit ffe19cd023
13 changed files with 30 additions and 17 deletions

View File

@ -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}}

View File

@ -32,4 +32,4 @@
| 20 | 原型模式Prototype | 不太常用 | 应用级 | 编码时、重构时 | 比较简单 | 实例化的类 | 封装对原型的拷贝 | 依赖倒置原则 |
| 21 | 享元模式Flyweight | 不太常用 | 代码级、应用级 | 设计时 | 一般 | 系统开销的优化 | 封装对象的获取 | |
| 22 | 责任链模式Chain Of Responsibilities | 不太常用 | 应用级、构架级 | 设计时、编码时 | 比较复杂 | 对象的请求过程 | 封装对象的责任范围 | |
| 23 | 解释器模式Interpreter | 不太常用 | 应用级 | 设计时 | 比较复杂 | 领域问题的变化 | 封装特定领域的变化 | |
| 23 | 解释器模式Interpreter | 不太常用 | 应用级 | 设计时 | 比较复杂 | 领域问题的变化 | 封装特定领域的变化 | |

View File

@ -1,18 +1,21 @@
<?php
declare(strict_types=1);
declare(strict_types = 1);
/**
* phpunit 实例
*/
class StackTest extends \PHPUnit\Framework\TestCase
{
public function testPushAndPop(): void
public function testPushAndPop() : void
{
$stack = [];
$this->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));
}
}

View File

@ -2,6 +2,9 @@
namespace bin;
/**
* demo入口父类
*/
abstract class Design
{
/**

View File

@ -2,6 +2,9 @@
namespace bin;
/**
* 接口
*/
interface DesignInterface
{

View File

@ -23,3 +23,4 @@
"vimeo/psalm": "5.x-dev"
}
}

1
composer.lock generated
View File

@ -4338,3 +4338,4 @@
"platform-dev": [],
"plugin-api-version": "2.2.0"
}

View File

@ -1 +1 @@
# 行为型
# 行为型模式

View File

@ -1 +1 @@
# 创建型
# 创建型模式

View File

@ -1 +1 @@
# 更多其他类型
# 更多其他类型模式

View File

@ -1 +1 @@
# 结构型
# 结构型模式

View File

@ -1,11 +1,11 @@
<?php
// 根目录
const ROOTDIR = __DIR__;
// composer 自动依赖注入文件
require ROOTDIR . '/vendor/autoload.php';
// 自动实现的自动依赖注入文件
require ROOTDIR . '/bin/Psr4Autoload.php';
// 注册命名空间
(new \bin\Psr4Autoload)->register();
// 首页默认内容
(new \bin\Base);

View File

@ -13,3 +13,4 @@
</ignoreFiles>
</projectFiles>
<plugins><pluginClass class="Psalm\PhpUnitPlugin\Plugin"/></plugins></psalm>