Skip to content

Instantly share code, notes, and snippets.

@jabranr
Created April 1, 2016 14:47
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/40514627594610d6eda0f17f0fc94dc5 to your computer and use it in GitHub Desktop.
Save jabranr/40514627594610d6eda0f17f0fc94dc5 to your computer and use it in GitHub Desktop.
Autogenerate PHP getters setters
<snippet>
<content><![CDATA[
/**
* Get ${1/(.*)/\u$1/:[ Prop name ]}
* ${4:[description]}
*
* @return ${3:[type]}
*/
public function get${1/(.*)/\u$1/:[ Prop name ]}() {
return \$this->${1:[ Prop name ]};
}
/**
* Set ${1/(.*)/\u$1/:[ Prop name ]}
* ${5/(.*)/\u$1/:[description]}
*
* @param ${3/(.*)/\u$1/:[type]} \$${1:[ Prop name ]}
*/
public function set${1/(.*)/\u$1/:[ Prop name ]}(\$${1/(.*)/$1/:[ Prop name ]}) {
\$this->${1:[Prop name ]} = \$${1/(.*)/$1/:[ Prop name ]};
return \$this;
}
${6}
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>getset</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