Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mathiasverraes/9173323 to your computer and use it in GitHub Desktop.
Save mathiasverraes/9173323 to your computer and use it in GitHub Desktop.
<?php
final class Number // Immutable value object
{
/**
* @param int $arabic
* @throws InvalidArgumentException
*/
public function __construct($arabic) { /* ... */ }
/**
* @param int $arabic
* @return Number
* @throws InvalidArgumentException
*/
public static function fromArabic($arabic) { /* ... */ }
/**
* @param string $roman
* @return Number
* @throws InvalidArgumentException
*/
public static function fromRoman($roman) { /* ... */ }
/**
* @return int
*/
public function asArabic() { /* ... */ }
/**
* @return string
*/
public function asRoman() { /* ... */ }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment