Closed josecelano closed 9 years ago
Solved, thanks for the idea.
By the way, I'm interested on how people use this library. I'm very biased to theoretical approaches and usages, and the next refactorization that I want to apply will go in this direction. What are the features most used by you? What do you think this library needs?
Sorry, It does not work. This is the rigth way:
return new static((string)$intValue, 0);
self returns always your base clase (Decimal). With static your code would return the extended class. More info: http://php.net/manual/en/language.oop5.late-static-bindings.php
I am using the library to implement a new version of this library: https://github.com/mathiasverraes/money whithout the max integer limit for 32 bits systems. This is my fork using your class instead of int: https://github.com/josecelano/money Here there is another library which uses BCMath library directly: https://github.com/keiosweb/moneyright
I am trying to extend Decimal class to add some methods like greaterThan, ...
It would be easier for me if you use self in constructor.
Constructor from integer:
Extended class example:
New using Self:
I know that is not a great new feature but I want to use my own class in case I need some extensions in the future.