mmerlijn/helper-time-array
Composer 安装命令:
composer create-project mmerlijn/helper-time-array
包简介
TimeArray helper
README 文档
README
The time array helper can handle times in array's. All times are represented as integers. Start of the day is 0 end of the day is 24*60=1440.
Example time blok
[[600,660],[720,800]]
This represent 10:00-11:00 and 12:00-13:20
If times blocks overlap each other, the blocks will be compacted to one block
Example
[[600,700],[700,800]] => [[600,800]]
Requirements
- PHP 8.0
Installation
composer require mmerlijn/helper-time-array
Usage
#####Start time array
$t = new TimeArray(); //or with initial value $t = new TimeArray([[500,600],[700,800]]); //multiple intervals $t = new TimeArray([600,720]); //one interval
Or with the create method
$t = new TimeArray(); $t->create([600,700]);
#####Add times (accepts only one time interval)
$t = $t->add([600,700]); //add 10:00-11:40
#####Substract times (accepts only one time interval)
$t = $t->substract([650,700]); //reduce the time Array
#####Get Returning the array
$t->get(); //
#####Chaning
(new TimeArray([500,600]))->add([700,800])->substract([750,800])->get();
Testing
See phpunit tests
统计信息
- 总下载量: 31
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-01-06