Skip to content

Get class for unit #81

Description

@gms8994

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions