diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f08ddd..97e5a26 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +## [4.1.0] - 2018-02-17 + +### Added +- Model methods: + - `getDocumentType()` + - `getFormatedDocument()` + + ## [4.0.0] - 2018-02-17 ### Added @@ -172,7 +180,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - DatabaseObject.php -[Unreleased]: https://github.com/aryelgois/Medools/compare/v4.0.0...develop +[Unreleased]: https://github.com/aryelgois/Medools/compare/v4.1.0...develop +[4.1.0]: https://github.com/aryelgois/Medools/compare/v4.0.0...v4.1.0 [4.0.0]: https://github.com/aryelgois/Medools/compare/v3.1.0...v4.0.0 [3.1.1]: https://github.com/aryelgois/Medools/compare/v3.1.0...v3.1.1 [3.1.0]: https://github.com/aryelgois/Medools/compare/v3.0...v3.1.0 diff --git a/src/Models/Person.php b/src/Models/Person.php index 9175fbc..b2dcb6a 100644 --- a/src/Models/Person.php +++ b/src/Models/Person.php @@ -56,6 +56,31 @@ public static function documentFormat($document, $prepend = false) return Utils\Format::document($document, $prepend); } + /** + * Returns Person's document formated + * + * @param boolean $prepend @see documentFormat() + * + * @return integer Document type + * @return false If document is invalid or not set + */ + public function getDocumentType() + { + return static::documentValidate($this->document)['type'] ?? false; + } + + /** + * Returns Person's document formated + * + * @param boolean $prepend @see documentFormat() + * + * @return ... same as documentFormat() + */ + public function getFormatedDocument($prepend = false) + { + return static::documentFormat($this->document, $prepend); + } + /** * Called when a column is changed *