joelwalls/picoyplaca
Composer 安装命令:
composer require joelwalls/picoyplaca
包简介
This simple package predicts if a given license place can be on the road at a certain date and time based on Quito restrictions.
README 文档
README
This small package offers a simple class to predict if a certain license plate could be on the road based on the timing restrictions of Quitos's transit regulations. Framework agnostic.
Install
Via Composer
$ composer require joelwalls/picoyplaca
Usage
Simple usage of the class
require_once "vendor/autoload.php"; $predictor = new JoelWalls\PicoYPlaca\Predictor($license_plate, $date, $time); if ($predictor->canDrive()) { echo "Car can be on the road"; } else { echo "Car cannnot be on the road"; }
The package supports a DateTime instance as second parameter.
require_once "vendor/autoload.php"; use JoelWalls\PicoYPlaca\Predictor; $predictor = new Predictor($license_plate, new \DateTime); if ($predictor->canDrive()) { echo "Car can be on the road"; } else { echo "Car cannnot be on the road"; }
If needed, you could also especify the timezone of the Predictor object in case the server works with a different TimeZone.
require_once "vendor/autoload.php"; use JoelWalls\PicoYPlaca\Predictor; $predictor = new Predictor($license_plate, new \DateTime); $predictor->setTimeZone('America/Guayaquil'); if ($predictor->canDrive()) { echo "Car can be on the road"; } else { echo "Car cannnot be on the road"; }
Note: The setTimeZone() method is recommended to use when the Predictor is initialized when a DateTime object as current time.
Testing
$ phpunit
Credits
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 16
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-04-21