php-value-object/temperature 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

php-value-object/temperature

Composer 安装命令:

composer require php-value-object/temperature

包简介

Temperature ValueObject for PHP. Easy to use with implementation of Kelvin, Celsius and Fahrenheit

README 文档

README

Build Status Latest Stable Version License PHPStan

This repository provides Temperature ValueObject implementation for PHP that is easy to use and easily allow your classes to depend on Temperature object instead of just float or string.

Install

You can install this package via composer

composer require php-value-object/temperature

Example

function isItWarm(Temperature $temperature) : bool
{
    $hot = new Celsius(23);
    if($temperature->gte($hot)) {
      return true; // t-shirt time
    }
    
    return false; // jacket time
}

$temperature = new Kelvin(0);
isItWarm($temperature); // false

Usage

The temperature classes are supported: Celsius, Fahrenheit and Kelvin.

It is possible to compare them via helper methods:

  • eq - equals
  • gt - greater than
  • gte - greater than or equals
  • lt - less than
  • lte - less than or equals
  • compareTo - returns -1, 0, 1 if less than, equal or greater than

To introduce new temperature class simply extend Temperature.

Licence

MIT

Contributing

Any contributions are welcome

Building & Development

The easiest way how to develop is to git clone and run make

git clone git@github.com:PHPValueObject/Temperature.git temperature
cd temperature
make

统计信息

  • 总下载量: 22
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 4
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-12-08

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固