Last active
June 19, 2016 09:09
-
-
Save jabranr/383625c25b8c0c9b36383e0a4c49d6d5 to your computer and use it in GitHub Desktop.
Sublime custom template for PHP Getters and Setters package
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Save the file to "{Sublime Packages}/PHP Getters and Setters/user_templates.py" | |
# Then add following "user config" in Sublime Text: | |
# | |
# { | |
# "registerTemplates" : [ "customTemplate" ], | |
# "template" : "customTemplate" | |
# } | |
# | |
# Restart Sublime Text | |
# | |
# @link https://github.com/francodacosta/sublime-php-getters-setters | |
class customTemplate(object): | |
name = "customTemplate" | |
style = 'camelCase' # can also be snakeCase | |
getter = """ | |
/** | |
* Gets the %(description)s | |
* @return %(type)s | |
*/ | |
public function get%(normalizedName)s() | |
{ | |
return $this->%(name)s; | |
} | |
""" | |
setter = """ | |
/** | |
* Sets the %(description)s | |
* | |
* @param %(type)s $%(name)s | |
* @return self | |
*/ | |
public function set%(normalizedName)s(%(typeHint)s $%(name)s) | |
{ | |
$this->%(name)s = $%(name)s; | |
} | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment