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

Get class for unit #81

Open
gms8994 opened this issue Dec 4, 2018 · 0 comments
Open

Get class for unit #81

gms8994 opened this issue Dec 4, 2018 · 0 comments

Comments

@gms8994
Copy link

gms8994 commented Dec 4, 2018

Similar to #46, is there a way, without using each individual PhysicalQuantity class, to determine which specific PhysicalQuantity class an alias applies to? For example, I want to be able to do something like

// Would return a namespaced classname of \PhpUnitsOfMeasure\PhysicalQuantity\Mass
$className = UnitOfMeasure::getClassByAlias('kilogram');
// or
// Would return an instance of \PhpUnitsOfMeasure\PhysicalQuantity\Mass
$physicalQuantityObject = UnitOfMeasure::getObjectByAlias('kilogram');

I'm open to making a PR to do this, if there's interest. It would benefit me so that I don't have to cycle through each actual PhysicalQuantity class calling ::getUnit and checking for exceptions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant