Skip to content

Instantly share code, notes, and snippets.

@marknotfound
Created April 16, 2014 17:41
Show Gist options
  • Save marknotfound/10912126 to your computer and use it in GitHub Desktop.
Save marknotfound/10912126 to your computer and use it in GitHub Desktop.
Generate setter and getter methods for a PHP member variable.
<snippet>
<content><![CDATA[
/**
* @return ${1:type}
*/
${2:visibility} function get${3:Name}() {
return \$this->${5:property};
} // get${3:Name}
/**
* @param ${1:type} ${4:arg}
*/
${2:visibility} function set${3:Name}( ${4:arg} ) {
\$this->${5:property} = ${4:arg};
} // set${3:Name}
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>synthesize</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.php</scope>
</snippet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment