gumbercules / barbellcalculator
此包最新版本(dev-master)没有可用的许可信息。
一个简单的PHP库,用于计算将杠铃加到一定重量所需的杠铃片。
dev-master
2015-02-23 18:09 UTC
Requires
- php: >=5.4.0
Requires (Dev)
- phpunit/phpunit: ^4.5
This package is not auto-updated.
Last update: 2024-09-28 16:31:08 UTC
README
用于计算杠铃所需杠铃片的简单PHP库
如果你从事任何类型的杠铃举重,无论是奥运举重、力量举还是仅仅想“增肌”,那么你无疑已经必须进行复杂的心理计算,以确定需要将多重的杠铃片加载到杠铃上,以便尝试举起一定重量的重量。
此库试图解决这个问题。
使用composer安装
composer require gumbercules/barbellcalculator
使用方法
导入类命名空间
use Gumbercules\BarbellCalculator
创建一个新的计算器实例
$barbellCalculator = new BarbellCalculator("kg", 180);
构造函数调用参数
@param string $unit: "kg" or "lb" depending on what unit you prefer
@param int/float $targetWeight: the amount of weight you want lifted on the bar (NB must be divisble by 2.5 for KGs or 5 for LBs)
@param optional array $options: define an options array for non-standard stuff:
- include_big_red_plates: set to true to include 25kg/55lb plates in the calculation
- bar_weight: set this to any numeric value in case you're dealing with a non-standard bar (defaults to 20kg/45lbs)
- collar_weight: set this if you're using competition collars (typically weigh 2.5kg each) - this value should be the _COMBINED_ weight of both collars
计算所需的杠铃片
$platesRequired = $barbellCalculator->calculate();
这将返回一个数组,包含所需加载的杠铃片的重量、尺寸和颜色。
待办事项
- 向代码添加doc-blocks以正确记录API
- 添加微型杠铃片选项(例如,0.5kg,1kg等)
- 考虑为杠铃的目标重量设置上限
联系方式
在Twitter @garethellis上找到我