Table of contents
Namespace: Com\Tecnick\Pdf\Page
Backing type: string
File: Unit.php line 37
Backed enum for the document unit of measure. The backing value of each case is the canonical unit name used as a key of Format::UNITRATIO.
Tags
- since: 2026-07-17
- category: Library
- author: Nicola Asuni info@tecnick.com
- copyright: 2011-2026 Nicola Asuni - Tecnick.com LTD
- license: https://www.gnu.org/copyleft/lesser.html GNU-LGPL v3 (see LICENSE)
- link: https://github.com/tecnickcom/tc-lib-pdf-page
Cases
Point
File: Unit.php line 39
Millimeter
File: Unit.php line 41
Centimeter
File: Unit.php line 43
Inch
File: Unit.php line 45
Methods
fromLoose()
File: Unit.php line 58
public static fromLoose(string|self $value) : self
Accepts the canonical value, its aliases and the empty-string default, case-insensitively, or an enum instance (returned unchanged). Unknown values throw, matching Format::getUnitRatio().
Parameters
- $value : string|self: Unit name or enum case.
Tags
- throws: Exception if the value does not match a known unit.
Return values
self