Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added time measurements #35

Merged
merged 3 commits into from
Oct 12, 2017
Merged

Conversation

teunw
Copy link

@teunw teunw commented Oct 11, 2017

Added the basic time measurement functions.
I'd be willing to add more if these ones are good. Let me know

Copy link
Owner

@jordanbrauer jordanbrauer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A handful of minor changes/tweaks should be made before pulling these basic Time units into develop branch.


declare(strict_types = 1);

namespace UnitConverter\Unit\Volume;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix namespace (Volume should be Time).


use UnitConverter\Unit\{
Time\TimeUnit
};
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove superfluous import statement (see notes at the end on TimeUnit.php as to why this is not needed).


use UnitConverter\Unit\{
Time\TimeUnit
};
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as Hour.php – Fix namespace, and remove unnecessary import statement for Time\TimeUnit.


->setSymbol("ms")

->setUnits(.001)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tack a 0 onto the left off that decimal place for the sake of readability. :)


use UnitConverter\Unit\{
Time\TimeUnit
};
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as Hour.php – Fix namespace, and remove unnecessary import statement for Time\TimeUnit.


use UnitConverter\Unit\{
Time\TimeUnit
};
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as Hour.php – Fix namespace, and remove unnecessary import statement for Time\TimeUnit.

};

/**
* Gallon unit data class.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix docblock to reference correct unit

use UnitConverter\Measure;
use UnitConverter\Unit\{
AbstractUnit, Volume\Second
};
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can reduced to simply,

use UnitConverter\Measure;
use UnitConverter\Unit\AbstractUnit;

Since Second.php lives in the same namespace as TimeUnit, we don't need to specify a namespace path to import the class – it can simply be used as is, by all classes within the same namespace (this goes for all unit classes above that are importing Time\TimeUnit as well) 😃


->setSymbol("month")

->setUnits(2678400)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where did you get this number? This isn't what I found from Googles' converter and other random converters. They all land between 2,628,000 and 2,629,000.

1 month === 2.682e+6 seconds
2.682e+6 = (2.628 * pow(10,6))
= 2,628,000 seconds

Copy link
Owner

@jordanbrauer jordanbrauer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me except a value discrepancy with Month units

@jordanbrauer jordanbrauer dismissed their stale review October 12, 2017 18:02

Not really necessary to be changed, however worth a converstaion, as time units are going to be wonky similarly to temperature

@jordanbrauer jordanbrauer merged commit 611293e into jordanbrauer:develop Oct 12, 2017
jordanbrauer added a commit that referenced this pull request Nov 12, 2017
* remove composer.lock from repo and add it to .gitignore (#30)

* Implement Kilopascal and Megapascal and write tests (#29)

* implement Kilopascal

* implement Megapascal

* fix docblocks

* Fix: add missing self conversions for temperature units (#31)

* Feature/improve travis file (#32)

* update .travis.yml

* Added time measurements (#35)

Closes #10 

* Added time measurements

* Added requested changes

* Added new time units

* Feat: add simple contributing guide for now (#36)

* Added last weight measures (#37)

* Added last weight measures

* Fixed stone units

* Added millibar as pressure unit (#34)

* Added millibar as pressure unit

* Fixed wrong millibar, also fixed documentation block

* Added requested changes

* Added requested changes

* Fixed millibar units

* scientificSymbol property, getter and setter are added (#47)

closes #46

* Add first set of dev docs (#44)

* Update: composer docs cmd now uses bash script to check for stale docs

* Update: phpDocumentor XML config file

* Feat: docs for v0.3.9-alpha (#43)

* Update: move docs directory to project root for github pages support

* Adding energy units (#33)

* Properly casing unit symbols

* Adding requested energy units

* Removing unnecessary imports

* Upgrade: docs & composer version

* Fix: Energy integration test - wrong unit case for Joule
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

None yet

2 participants