Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
55 lines (43 sloc) 1.55 KB
<!--
php-getset
A time-saving device for creating getters & setters in PHP classes
Based on a snippet originall published by @akrabat:
http://akrabat.com/software/sublime-text-2-snippet-for-php-getter-and-setter-generation/
HOW TO USE
In your PHP class, simply type the following:
php-getset<TAB><name of your property without a $ sign>
Sublime Text will add the getter and setter to your class, and
name them after your property.
For example, if your property is called $connection, you would
go into your class, and type:
php-getset<TAB>connection
and Sublime Text will create getConnection() and setConnection()
methods for you.
-->
<snippet>
<content><![CDATA[
/**
* ${2:[description here]}
*
* @return ${3:[type]} ${4:[description]}
*/
public function get${1/(.*)/\u$1/:[ Prop name ]}() {
return \$this->${1:[ Prop name ]};
}
/**
* ${5:[Description]}
*
* @param ${3/(.*)/\u$1/:[type]} \$new${1:[ Prop name ]} ${4/(.*)/\u$1/:[description]}
*/
public function set${1/(.*)/\u$1/:[ Prop name ]}(\$${1/(.*)/$1/:[ Prop name ]}) {
\$this->${1:[Prop name ]} = \$${1/(.*)/$1/:[ Prop name ]};
return \$this;
}
]]></content>
<!-- Optional: Tab trigger to activate the snippet -->
<tabTrigger>php-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>
Something went wrong with that request. Please try again.