| @@ 12-51 (lines=40) @@ | ||
| 9 | * |
|
| 10 | * @author Sławomir Kania <[email protected]> |
|
| 11 | */ |
|
| 12 | class MethodSetterInterfaceManager extends MethodManager implements SetterMethodInterface |
|
| 13 | { |
|
| 14 | ||
| 15 | /** |
|
| 16 | * Return prepared method name from property eg. getNameOrSurname |
|
| 17 | * |
|
| 18 | * @return string |
|
| 19 | */ |
|
| 20 | public function getPreparedName() |
|
| 21 | { |
|
| 22 | return sprintf("set%s", parent::getPreparedName()); |
|
| 23 | } |
|
| 24 | ||
| 25 | /** |
|
| 26 | * If type is callable object or in namespace then can render type hinting in setter |
|
| 27 | * |
|
| 28 | * @return boolean |
|
| 29 | */ |
|
| 30 | public function canAddTypeHinting() |
|
| 31 | { |
|
| 32 | return $this->getProperty()->isObjectType(); |
|
| 33 | } |
|
| 34 | ||
| 35 | /** |
|
| 36 | * Return set of tags used in template |
|
| 37 | * |
|
| 38 | * @return array |
|
| 39 | */ |
|
| 40 | public function getTemplateTags() |
|
| 41 | { |
|
| 42 | return [ |
|
| 43 | self::TAG_COMMENT, |
|
| 44 | self::TAG_PROPERTY_TYPE, |
|
| 45 | self::TAG_TYPE_HINTING, |
|
| 46 | self::TAG_METHOD_NAME, |
|
| 47 | self::TAG_PROPERTY_NAME, |
|
| 48 | self::TAG_OPTIONAL_PART, |
|
| 49 | ]; |
|
| 50 | } |
|
| 51 | } |
|
| 52 | ||
| @@ 12-51 (lines=40) @@ | ||
| 9 | * |
|
| 10 | * @author Sławomir Kania <[email protected]> |
|
| 11 | */ |
|
| 12 | class MethodSetterManager extends MethodManager implements SetterMethodInterface |
|
| 13 | { |
|
| 14 | ||
| 15 | /** |
|
| 16 | * Return prepared method name from property eg. getNameOrSurname |
|
| 17 | * |
|
| 18 | * @return string |
|
| 19 | */ |
|
| 20 | public function getPreparedName() |
|
| 21 | { |
|
| 22 | return sprintf("set%s", parent::getPreparedName()); |
|
| 23 | } |
|
| 24 | ||
| 25 | /** |
|
| 26 | * If type is callable object or in namespace then can render type hinting in setter |
|
| 27 | * |
|
| 28 | * @return boolean |
|
| 29 | */ |
|
| 30 | public function canAddTypeHinting() |
|
| 31 | { |
|
| 32 | return $this->getProperty()->isObjectType(); |
|
| 33 | } |
|
| 34 | ||
| 35 | /** |
|
| 36 | * Return set of tags used in template |
|
| 37 | * |
|
| 38 | * @return array |
|
| 39 | */ |
|
| 40 | public function getTemplateTags() |
|
| 41 | { |
|
| 42 | return [ |
|
| 43 | self::TAG_COMMENT, |
|
| 44 | self::TAG_PROPERTY_TYPE, |
|
| 45 | self::TAG_TYPE_HINTING, |
|
| 46 | self::TAG_METHOD_NAME, |
|
| 47 | self::TAG_PROPERTY_NAME, |
|
| 48 | self::TAG_OPTIONAL_PART, |
|
| 49 | ]; |
|
| 50 | } |
|
| 51 | } |
|
| 52 | ||