Skip to content

Instantly share code, notes, and snippets.

@jabranr
Last active June 19, 2016 09:09
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 jabranr/383625c25b8c0c9b36383e0a4c49d6d5 to your computer and use it in GitHub Desktop.
Save jabranr/383625c25b8c0c9b36383e0a4c49d6d5 to your computer and use it in GitHub Desktop.
Sublime custom template for PHP Getters and Setters package
# 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