Skip to content

Commit

Permalink
Upgrade: pull in v0.5.0 development changes (#55)
Browse files Browse the repository at this point in the history
* Update: changelog config file & composer script

* Feat: add explicit calculator classes to handle all math related operations (#52)

* Update: remove redundant import

* Feat: add abstract calculator class interface

* Feat: add simple calculator concrete class & write tests

* Feat: add binary calculator (bcmath) concrete class & write tests

* Feat: implement calculator into unit converter & unit calculate methods (#53)

* Fix: simplecalc bugs

* Feat: add new exceptin for missing calculator

* Fix: tests to use new calculator

* Fix: example file to use new calculator

* Feat: implement the calculator into the unit converter

* Update: scripts

* Update: readme to reflect new api

* Fix: formatting & docblocks

* Update: add codeclimate config & travis script updates

* Update: Add codeclimate badges:

* Fix: unit test missing @Covers & @uses docblock annotations

* Update: coverage scripts

* Update: add missing Code Climate YAML config file
  • Loading branch information
jordanbrauer authored Nov 13, 2017
1 parent 4242abf commit 1b6b965
Show file tree
Hide file tree
Showing 119 changed files with 2,850 additions and 2,056 deletions.
12 changes: 12 additions & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
ratings:
paths:
- src/**

exclude_paths:
- .git/**/*
- .github/**/*
- bin/**/*
- dev/**/*
- docs/**/*
- tests/**/*
- vendor/**/*
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
trim_trailing_whitespace = true
insert_final_newline = true

[*.php]
indent_size = 4
2 changes: 2 additions & 0 deletions .github_changelog_generator
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
project=unit-converter
unreleased=false
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@

# Created by https://www.gitignore.io/api/git,vim,node,linux,macos,emacs,windows,composer,phpstorm,sublimetext,phpstorm+all,phpstorm+iml,visualstudiocode

### Composer ###
composer.phar
/composer.lock
/vendor/
coverage.txt
clover.xml

# Commit your application's lock file http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
Expand Down Expand Up @@ -394,5 +396,3 @@ $RECYCLE.BIN/
*.lnk

# End of https://www.gitignore.io/api/git,vim,node,linux,macos,emacs,windows,composer,phpstorm,sublimetext,phpstorm+all,phpstorm+iml,visualstudiocode

/composer.lock
10 changes: 9 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,12 @@ before_install:
install:
- travis_retry composer install --no-suggest --no-interaction

script: composer test
before_script:
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
- chmod +x ./cc-test-reporter
- ./cc-test-reporter before-build

script: composer clover

after_script:
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
153 changes: 87 additions & 66 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,66 +1,87 @@
### v0.4.1

* Feat: add changelog (#49) e4ea6fe
* Fix: api docs (#50) 728d698

### v0.4.0

* Implement Kilopascal and Megapascal and write tests (#29) e1bc33c (@arubacao)
* remove composer.lock from repo and add it to .gitignore (#30) 37e0f01 (@arubacao)
* Fix: add missing self conversions for temperature units (#31) 380bdb7
* Feature/improve travis file (#32) 707fb0a (@arubacao)
* Adding energy units (#33) 0860032 (@andrewboerema)
* Added millibar as pressure unit (#34) 9a6eed0 (@teunw)
* Added time measurements (#35) 611293e (@teunw)
* Feat: add simple contributing guide for now (#36) cd71bbc
* Added last weight measures (#37) dc7021e (@teunw)
* Add first set of dev docs (#44) ca74697
* scientificSymbol property, getter and setter are added (#47) 19837f1 (@luchianenco)
* Upgrade: docs & composer version 7c553ad
* Fix: Energy integration test - wrong unit case for Joule 708f021

### v0.3.9-beta

* Base working package (#26)
* Feat: add speed base unit
* Feat: add support for metre per second units
* Feat: add support for kilometer per hour units
* Feat: add support for miles per hour units
* Fix: name spelling
* Fix: swap units of miles and kilometres per hour
* Fix: all units now use configure() method to configure data
* Feat: add base temperature unit class
* Feat: add kelvin temperature unit
* Feat: add support for celsius
* Feat: add support for fahrenheit units
* Fix: using new ::configure() method over explicit value definitions
* Fix: configure method definition
* Update: add conversion formulae to calculate methods
* Feat: add integration test for temp' units - damn °C <-> °F conversions
* Fix: returned getter to being just that; a getter.
* Feat: convert() method to expose calculate() - allows for complex calcs
* Feat: add switch for conditional calculations based upon temp' unit
* Fix: improper namespace
* Feat: add base volume unit class + integration test
* Feat: add support for litre units
* Feat: add support for mililitre units
* Feat: add support for US liquid pint units
* Feat: add support for US Liquid gallon units
* Feat: add support for cubic metre units
* Fix: misnamed test file
* Feat: add support for basic pressure units w/ single integration test
* Feat: add basic energy units
* Feat: add gram unit support
* Feat: add base mass unit class
* Feat: add kilogram unit support
* Fix: changed use of "weight" with "mass"
* Feat: add support for milligram units
* Feat: add support for Newton units
* Feat: add support for Pound units
* Feat: add support for ounce units
* Feat: add support for metric tonne units
* Update: move example file
* Feat: add phpdoc configurations
* Fix: broken tests using incorrect type of measure for mass, was 'volume'
* Update: temporary readme 'overhaul'
* Upgrade: package version
# Change Log

## [v0.4.1](https://github.com/jordanbrauer/unit-converter/tree/v0.4.1) (2017-11-12)
[Full Changelog](https://github.com/jordanbrauer/unit-converter/compare/v0.4.0...v0.4.1)

**Implemented enhancements:**

- Feat: add changelog [\#49](https://github.com/jordanbrauer/unit-converter/pull/49) ([jordanbrauer](https://github.com/jordanbrauer))

**Closed issues:**

- Need a Contributing Guide [\#27](https://github.com/jordanbrauer/unit-converter/issues/27)
- Basic units of measurement for Energy \(Power\) [\#11](https://github.com/jordanbrauer/unit-converter/issues/11)
- Basic units of measurement for Pressure [\#9](https://github.com/jordanbrauer/unit-converter/issues/9)
- Basic units of measurement for Weight \(Mass\) [\#5](https://github.com/jordanbrauer/unit-converter/issues/5)

**Merged pull requests:**

- Documentation Fixes & Improvements [\#51](https://github.com/jordanbrauer/unit-converter/pull/51) ([jordanbrauer](https://github.com/jordanbrauer))
- Fix: api docs [\#50](https://github.com/jordanbrauer/unit-converter/pull/50) ([jordanbrauer](https://github.com/jordanbrauer))

## [v0.4.0](https://github.com/jordanbrauer/unit-converter/tree/v0.4.0) (2017-11-12)
[Full Changelog](https://github.com/jordanbrauer/unit-converter/compare/v0.3.9-beta...v0.4.0)

**Implemented enhancements:**

- Add new unit property, "scientificSymbol" for special unicode character symbols [\#46](https://github.com/jordanbrauer/unit-converter/issues/46)
- Hacktoberfest Development [\#48](https://github.com/jordanbrauer/unit-converter/pull/48) ([jordanbrauer](https://github.com/jordanbrauer))
- Scientific Symbol Added [\#47](https://github.com/jordanbrauer/unit-converter/pull/47) ([luchianenco](https://github.com/luchianenco))
- Added last weight measures [\#37](https://github.com/jordanbrauer/unit-converter/pull/37) ([teunw](https://github.com/teunw))
- Added time measurements [\#35](https://github.com/jordanbrauer/unit-converter/pull/35) ([teunw](https://github.com/teunw))
- Added millibar as pressure unit [\#34](https://github.com/jordanbrauer/unit-converter/pull/34) ([teunw](https://github.com/teunw))
- Adding energy units [\#33](https://github.com/jordanbrauer/unit-converter/pull/33) ([andrewboerema](https://github.com/andrewboerema))
- Implement Kilopascal and Megapascal and write tests [\#29](https://github.com/jordanbrauer/unit-converter/pull/29) ([arubacao](https://github.com/arubacao))

**Fixed bugs:**

- Fix: add missing self conversions for temperature units [\#31](https://github.com/jordanbrauer/unit-converter/pull/31) ([jordanbrauer](https://github.com/jordanbrauer))
- remove composer.lock from repo and add it to .gitignore [\#30](https://github.com/jordanbrauer/unit-converter/pull/30) ([arubacao](https://github.com/arubacao))

**Closed issues:**

- Basic units of measurement for Time [\#10](https://github.com/jordanbrauer/unit-converter/issues/10)
- Basic units of measurement for Temperature [\#8](https://github.com/jordanbrauer/unit-converter/issues/8)
- Basic units of measurement for Speed [\#6](https://github.com/jordanbrauer/unit-converter/issues/6)
- Basic units of measurement for Volume [\#4](https://github.com/jordanbrauer/unit-converter/issues/4)

**Merged pull requests:**

- Add first set of dev docs [\#44](https://github.com/jordanbrauer/unit-converter/pull/44) ([jordanbrauer](https://github.com/jordanbrauer))
- Feat: add simple contributing guide for now \(\#27\) [\#36](https://github.com/jordanbrauer/unit-converter/pull/36) ([jordanbrauer](https://github.com/jordanbrauer))
- Feature/improve travis file [\#32](https://github.com/jordanbrauer/unit-converter/pull/32) ([arubacao](https://github.com/arubacao))

## [v0.3.9-beta](https://github.com/jordanbrauer/unit-converter/tree/v0.3.9-beta) (2017-10-11)
**Implemented enhancements:**

- Feat: add basic energy units [\#25](https://github.com/jordanbrauer/unit-converter/pull/25) ([jordanbrauer](https://github.com/jordanbrauer))
- Units pressure [\#22](https://github.com/jordanbrauer/unit-converter/pull/22) ([jordanbrauer](https://github.com/jordanbrauer))
- Units volume [\#21](https://github.com/jordanbrauer/unit-converter/pull/21) ([jordanbrauer](https://github.com/jordanbrauer))
- Add support for units of temperature [\#18](https://github.com/jordanbrauer/unit-converter/pull/18) ([jordanbrauer](https://github.com/jordanbrauer))
- Add support for units of speed [\#17](https://github.com/jordanbrauer/unit-converter/pull/17) ([jordanbrauer](https://github.com/jordanbrauer))
- Support for Plane Angle units [\#16](https://github.com/jordanbrauer/unit-converter/pull/16) ([jordanbrauer](https://github.com/jordanbrauer))
- Added package specific exception classes to handle uncaught exceptions [\#15](https://github.com/jordanbrauer/unit-converter/pull/15) ([jordanbrauer](https://github.com/jordanbrauer))
- Add support for Area units of measure [\#13](https://github.com/jordanbrauer/unit-converter/pull/13) ([jordanbrauer](https://github.com/jordanbrauer))

**Fixed bugs:**

- Fix calc method [\#20](https://github.com/jordanbrauer/unit-converter/pull/20) ([jordanbrauer](https://github.com/jordanbrauer))
- Fix: all units now use configure\(\) method to configure data [\#19](https://github.com/jordanbrauer/unit-converter/pull/19) ([jordanbrauer](https://github.com/jordanbrauer))
- Fix: accidently had all classes be abstract [\#14](https://github.com/jordanbrauer/unit-converter/pull/14) ([jordanbrauer](https://github.com/jordanbrauer))

**Closed issues:**

- Basics units of measurement for Rotation [\#7](https://github.com/jordanbrauer/unit-converter/issues/7)
- Basic units of measurement for Area [\#3](https://github.com/jordanbrauer/unit-converter/issues/3)
- Custom ErrorException classes would be nice [\#2](https://github.com/jordanbrauer/unit-converter/issues/2)

**Merged pull requests:**

- Base working package [\#26](https://github.com/jordanbrauer/unit-converter/pull/26) ([jordanbrauer](https://github.com/jordanbrauer))
- Revert "Units energy" [\#24](https://github.com/jordanbrauer/unit-converter/pull/24) ([jordanbrauer](https://github.com/jordanbrauer))
- Units energy [\#23](https://github.com/jordanbrauer/unit-converter/pull/23) ([jordanbrauer](https://github.com/jordanbrauer))
- MVP version of component [\#1](https://github.com/jordanbrauer/unit-converter/pull/1) ([jordanbrauer](https://github.com/jordanbrauer))



\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
[![Latest Stable Version](https://poser.pugx.org/jordanbrauer/unit-converter/version)](https://packagist.org/packages/jordanbrauer/unit-converter)
[![Latest Unstable Version](https://poser.pugx.org/jordanbrauer/unit-converter/v/unstable)](//packagist.org/packages/jordanbrauer/unit-converter)
[![Build Status](https://travis-ci.org/jordanbrauer/unit-converter.svg?branch=master)](https://travis-ci.org/jordanbrauer/unit-converter)
[![Test Coverage](https://api.codeclimate.com/v1/badges/0b4639967df0b1578734/test_coverage)](https://codeclimate.com/github/jordanbrauer/unit-converter/test_coverage)
[![Maintainability](https://api.codeclimate.com/v1/badges/0b4639967df0b1578734/maintainability)](https://codeclimate.com/github/jordanbrauer/unit-converter/maintainability)
[![composer.lock available](https://poser.pugx.org/jordanbrauer/unit-converter/composerlock)](https://packagist.org/packages/jordanbrauer/unit-converter)
[![Total Downloads](https://poser.pugx.org/jordanbrauer/unit-converter/downloads)](https://packagist.org/packages/jordanbrauer/unit-converter)
[![License](https://poser.pugx.org/jordanbrauer/unit-converter/license)](https://packagist.org/packages/jordanbrauer/unit-converter)
Expand All @@ -19,7 +21,7 @@ Convert all kinds of standard units of measurement from one to another with this

### 1. About the Component

This unit converter component aims to be modern and follow best practices where possible.
This unit converter component aims to be modern and follow best practices where possible.

It supports the following types of measurement by default (support for more measurement types are on the roadmap).

Expand Down Expand Up @@ -54,6 +56,7 @@ Using the component is very easy, especially if you have used the Symfony framew

```php
use UnitConverter\UnitConverter;
use UnitConverter\Calculator\SimpleCalculator;
use UnitConverter\Registry\UnitRegistry;
use UnitConverter\Unit\Length\Centimeter;
use UnitConverter\Unit\Length\Inch;
Expand All @@ -66,9 +69,10 @@ $units = array(

# Instantiate a new UnitRegistry and seed it with our array
$registry = new UnitRegistry($units);
$calculator = new SimpleCalculator;

# Instantiate the UnitConverter, passing it the registry
$converter = new UnitConverter($registry);
$converter = new UnitConverter($registry, $calculator);
```

#### Converting Units
Expand Down
2 changes: 1 addition & 1 deletion dev/docs.sh → bin/docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ DESTINATION=./docs

if [ -d $DESTINATION ];
then
printf "Deleting old generated documentation .. "
printf "Deleting stale documentation .. "
rm -r $DESTINATION/*
echo "OK"
fi
Expand Down
8 changes: 5 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@
}
],
"scripts": {
"docs": "./dev/docs.sh",
"docs": "./bin/docs.sh",
"changelog": "github_changelog_generator",
"test": "phpunit --configuration=./phpunit.xml --testsuite=fullspec --color=always",
"unit": "phpunit --configuration=./phpunit.xml --testsuite=unit --color=always",
"integration": "phpunit --configuration=./phpunit.xml --testsuite=integration --color=always"
"integration": "phpunit --configuration=./phpunit.xml --testsuite=integration --color=always",
"coverage": "phpunit --coverage-text --configuration=./phpunit.xml --testsuite=fullspec --color=always",
"clover": "phpunit --coverage-clover=./clover.xml --configuration=./phpunit.xml --testsuite=fullspec --color=never"
},
"require": {},
"require-dev": {
"apigen/apigen": "dev-master",
"phpunit/phpunit": "^6.3",
Expand Down
12 changes: 6 additions & 6 deletions dev/examples.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@

require_once "vendor/autoload.php";

use UnitConverter\Measure;
use UnitConverter\UnitConverter;
use UnitConverter\Calculator\SimpleCalculator;
use UnitConverter\Registry\UnitRegistry;
use UnitConverter\Unit\AbstractUnit;
use UnitConverter\Measure;
use UnitConverter\Unit\Length\{
Centimeter,
Inch
};
use UnitConverter\Unit\Length\Centimeter;
use UnitConverter\Unit\Length\Inch;

# Configuring a New Converter
# ===========================
Expand All @@ -23,8 +22,9 @@
);

$registry = new UnitRegistry($units);
$calculator = new SimpleCalculator;

$converter = new UnitConverter($registry);
$converter = new UnitConverter($registry, $calculator);

# Registering Custom Units
# ========================
Expand Down
Loading

0 comments on commit 1b6b965

Please sign in to comment.