Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feature/Task 1 添加FileHandler并且重构整体结构 #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
blankqwq merged 16 commits into master from dev
Jan 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
d41ec42
update curl and route
blankqwq Mar 22, 2020
8c3d8ff
create gd
blankqwq Mar 22, 2020
7844d23
【优化】代码结构调整
blankqwq Apr 25, 2020
8a56ad5
create base traits and manager
blankqwq May 4, 2020
ec8373a
update some code and create Base Trait and add Manager
blankqwq May 9, 2020
c102700
【优化】优化代码结构和基础组件Traits
blankqwq May 10, 2020
278a751
【开发】修复Session组件异常
blankqwq May 10, 2020
2b0dee5
【优化】优化链接和内存清理
blankqwq May 11, 2020
f06c06f
【优化】优化基本代码结构
blankqwq May 11, 2020
6623b37
【开发】开始构建Proxy代理
blankqwq May 31, 2020
bb7fbc0
start proxy
blankqwq Jun 23, 2020
a5056c9
update proxy
blankqwq Jul 9, 2020
e2309f7
replace log to monolog
blankqwq Jul 9, 2020
84efae8
add logger driver
blankqwq Jul 13, 2020
4f108d9
conflict
blankqwq Jan 13, 2022
528ab9e
update request
blankqwq Jan 13, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions README.md
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
```shell
composer require blankqwq/framework -vvv
```


- [ ] 可测试性&& 可监控性
- [ ] 文档
- [x] 容器
- [x] 依赖注入
Expand Down Expand Up @@ -38,7 +37,7 @@ composer require blankqwq/framework -vvv
- [ ] 国际化
- [ ] 国际化支持
- [ ] 安全
- [] 验证码
- [x] 验证码
- [ ] 加密
- [ ] xss
- [x] sql防注入
Expand All @@ -49,9 +48,28 @@ composer require blankqwq/framework -vvv
- [ ] RPC
- [ ] ...
- [ ] FormValidate
- [ ] Helper
- [ ] Exec
- [ ] Array
- [ ] Curl
- [ ] Rsa
- [ ] Str
...
- [ ] Console
- [x] ConsoleKernel

```
# proxy代理

# manage管理者

# driverFactory 驱动管理

# event事件

# Application容器
```



## Contributing
Expand Down
6 changes: 1 addition & 5 deletions composer.json
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@
"require": {
"psr/log": "^1.1",
"predis/predis": "^1.1",
"ext-curl": "*",
"ext-mbstring": "*"
},
"require-dev": {
"phpunit/phpunit": "^6.2"
"ext-curl": "*"
}
}
29 changes: 29 additions & 0 deletions src/blankphp/Base/Traits/FactoryClientTrait.php
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php


namespace BlankPhp\Base\Traits;


use BlankPhp\Driver\DriverFactory;
use BlankPhp\Facade\Driver;

trait FactoryClientTrait
{
/**
* @var DriverFactory
*/
private $factory;

private function createFromFactory($name, $nickName = 'default', $register = false)
{
return $this->getFactory()->factory($name, $nickName, $register);
}

private function getFactory()
{
if (empty($this->factory)) {
$this->factory = Driver::getFromApp();
}
return $this->factory;
}
}
10 changes: 10 additions & 0 deletions src/blankphp/Base/Traits/GetFromFileCacheTrait.php
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php


namespace BlankPhp\Base\Traits;


trait GetFromFileCacheTrait
{

}
6 changes: 3 additions & 3 deletions src/blankphp/Bootstrap/RegisterProvider.php
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ class RegisterProvider
protected $providers = [
];

public function getProviders()
public function getProviders(): void
{
$this->providers = array_merge($this->providers, config('app.providers',[]));
}

public function register(Application $app)
public function register(Application $app): void
{
$this->getProviders();

}

public function boot(Application $app)
public function boot(Application $app): void
{
$this->register($app);
foreach (config('app.alice',[]) as $name => $class) {
Expand Down
147 changes: 135 additions & 12 deletions src/blankphp/Cache/Cache.php
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,153 @@

namespace BlankPhp\Cache;


use BlankPhp\Application;
use BlankPhp\Contract\Container;
use BlankPhp\Facade\Driver;
use BlankQwq\Helpers\Str;
use \BlankPhp\Driver\Contract\Driver;

class Cache extends CacheAbstract
class Cache
{
/**
* @var Driver
*/
private $handler;
/**
* @var array
*/
private $data = [];
/**
* @var int
*/
private $writeCount = 0;
/**
* @var int
*/
private $getCount = 0;
/**
* @var string
*/
protected $tag;
/**
* @var string[]
*/
protected $config = [
'prefix' => '',
];


public function __construct()
/**
* @return array
*/
public function getData(): array
{
$this->setOption(config('cache'));
$driver = $this->config['driver'];
$handler = Driver::factory($driver, "cache");
$this->setHandler($handler);
return $this->data;
}

public function setOption($config)
public function setOption($config): void
{
$this->config = array_merge($this->config, $config);
}

/**
* @param array $data
*/
public function setData($data): void
{
$this->data = $data;
}

/**
* @return int
*/
public function getWriteCount(): int
{
return $this->writeCount;
}

/**
* @param int $writeCount
*/
public function setWriteCount($writeCount): void
{
$this->writeCount = $writeCount;
}

/**
* @return int
*/
public function getGetCount(): int
{
return $this->getCount;
}

/**
* @param int $getCount
*/
public function setGetCount($getCount): void
{
$this->getCount = $getCount;
}


/**
* @return Driver
*/
public function getHandler(): Driver
{
return $this->handler;
}

/**
* @param Driver $handler
*/
public function setHandler(Driver $handler): void
{
$this->handler = $handler;
}

/***
* @param $key
* @param $value
* @param null $ttl
* @return mixed
*/
public function set($key, $value, $ttl = null)
{
return $this->getHandler()->set($key, $value, $ttl);
}

/**
* @param $key
* @param null $default
* @return mixed
*/
public function get($key, $default = null)
{
return $this->getHandler()->get($key, $default);
}

/**
* @param $key
* @param \Closure $closure
* @return mixed
*/
public function remember(string $key, \Closure $closure)
{
return $this->getHandler()->remember($key, $closure());
}

/**
* @param $key
* @return mixed
*/
public function has($key)
{
return $this->getHandler()->has($key);
}

/**
* @param $name
* @param $arguments
* @return mixed
*/
public function __call($name, $arguments)
{
return $this->getHandler()->$name(...$arguments);
Expand Down
Loading

AltStyle によって変換されたページ (->オリジナル) /