Skip to content

Instantly share code, notes, and snippets.

@ludofleury
Created February 15, 2013 02:25
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ludofleury/4958145 to your computer and use it in GitHub Desktop.
Save ludofleury/4958145 to your computer and use it in GitHub Desktop.
PHP (Symfony) oriented getter-setter snippet for Sublime Text
<snippet>
<content><![CDATA[
/**
* Get $1
*
* @return ${2:[type]} \$$1
*/
public function get${1/(.*)/\u$1/}()
{
return \$this->${1:$SELECTION};
}
/**
* Set $1
*
* @param ${2:[type]} \$$1
*
* @return static
*/
public function set${1/(.*)/\u$1/}($3\$$1)
{
\$this->$1 = \$$1;
return \$this;
}
]]></content>
<!-- Optional: Tab trigger to activate the snippet -->
<tabTrigger>getset</tabTrigger>
<!-- Optional: Scope the tab trigger will be active in -->
<scope>source.php</scope>
<!-- Optional: Description to show in the menu -->
<description>Create getter and setter methods</description>
</snippet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment