From 605f3c56b156b0c9c9bf19b6629bdae36800751a Mon Sep 17 00:00:00 2001 From: Stuart Grimshaw Date: Thu, 22 Dec 2011 15:03:01 +0000 Subject: [PATCH] Added getset snippet Added a snippet that adds get a getter & setter for the variable you type for ${1}, also tabs to let you add extra info to the included @param and @return tags. --- snippets/php.snippets | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/snippets/php.snippets b/snippets/php.snippets index c0e7033..e2f25d8 100644 --- a/snippets/php.snippets +++ b/snippets/php.snippets @@ -46,8 +46,9 @@ snippet doc_cp * ${1:undocumented class} * * @package ${2:default} - * @author ${3:`g:snips_author`} - */${4} + * @subpackage ${3:default} + * @author ${4:`g:snips_author`} + */${5} # Class Variable - post doc snippet doc_vp /** @@ -242,8 +243,28 @@ snippet vd var_dump(${1}); snippet vdd var_dump(${1}); die(${2:}); - snippet http_redirect header ("HTTP/1.1 301 Moved Permanently"); header ("Location: ".URL); exit(); +# Getters & Setters +snippet getset + /** + * Gets the value of ${1} + * + * @return ${2} + */ + function get${1}() + { + return $this->$_{1} + } + + /** + * Sets the value of ${1} + * + * @param mixed $lcl${1} ${3} + */ + function set${1}($lcl${1}) + { + $this->_${1} = $lcl${1} + }