Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 06dfec6
Showing
6 changed files
with
255 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,29 @@ | |||
New BSD License | |||
=============== | |||
|
|||
Copyright (c) 2012, Stuart Herbert and contributors | |||
All rights reserved. | |||
|
|||
Redistribution and use in source and binary forms, with or without | |||
modification, are permitted provided that the following conditions are met: | |||
|
|||
* Redistributions of source code must retain the above copyright notice, | |||
this list of conditions and the following disclaimer. | |||
* Redistributions in binary form must reproduce the above copyright notice, | |||
this list of conditions and the following disclaimer in the documentation | |||
and/or other materials provided with the distribution. | |||
* Neither the names of the copyright holders nor the names of its | |||
contributors may be used to endorse or promote products derived from this | |||
software without specific prior written permission. | |||
|
|||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE | |||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |||
POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,26 @@ | |||
Additional PHP Snippets For Sublime Text 2 | |||
========================================== | |||
|
|||
[Sublime Text 2](http://www.sublimetext.com/2) already ships with a lot of snippets for writing PHP code. This is a collection of additional snippets contributed by the PHP community. | |||
|
|||
Installation | |||
------------ | |||
|
|||
We're waiting to be added to [Package Control](http://wbond.net/sublime_packages/package_control), so for now you'll need to clone this repo into your Sublime Text 2 "Packages/" folder. | |||
|
|||
Snippets | |||
-------- | |||
|
|||
We add the following snippets to speed up writing PHP code. | |||
|
|||
To use any of the snippets, simply type the name of the snippet, then press the <TAB> key. Sublime Text 2 will insert the snippet, and you can then use the <TAB> key to move through any placeholders that you need to replace. | |||
|
|||
* __license-newbsd__: insert the new BSD license (eg into LICENSE.md-type files) | |||
* __php-getset__: create getter/setter methods quickly and easily (based on a snippet originally published by @akrabat) | |||
* __php-newbsd__: insert the new BSD license as a PHP docblock | |||
* __php-section-comment__: insert a prominent comment to help break up the sections of your class | |||
|
|||
Contributions Welcome | |||
--------------------- | |||
|
|||
Requests for features, and pull requests with patches, are most welcome :) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,50 @@ | |||
<!-- | |||
license-newbsd | |||
Insert the New BSD license into your file. | |||
HOW TO USE | |||
In your PHP class, simply type the following: | |||
license-newbsd<TAB><your name or organisation> | |||
Sublime Text will add the license to your file, and set the | |||
copyright message to be your name. | |||
--> | |||
<snippet> | |||
<content><![CDATA[ | |||
New BSD License | |||
=============== | |||
Copyright (c) 2012, ${1:[ Copyright Holder ]} | |||
All rights reserved. | |||
Redistribution and use in source and binary forms, with or without | |||
modification, are permitted provided that the following conditions are met: | |||
* Redistributions of source code must retain the above copyright notice, | |||
this list of conditions and the following disclaimer. | |||
* Redistributions in binary form must reproduce the above copyright notice, | |||
this list of conditions and the following disclaimer in the documentation | |||
and/or other materials provided with the distribution. | |||
* Neither the names of the copyright holders nor the names of its | |||
contributors may be used to endorse or promote products derived from this | |||
software without specific prior written permission. | |||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE | |||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |||
POSSIBILITY OF SUCH DAMAGE. | |||
]]></content> | |||
<!-- Optional: Tab trigger to activate the snippet --> | |||
<tabTrigger>license-newbsd</tabTrigger> | |||
<!-- Optional: Description to show in the menu --> | |||
<description>Add New BSD license to a plain text file</description> | |||
</snippet> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,56 @@ | |||
<!-- | |||
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[ | |||
/** | |||
* [get${1/(.*)/\u$1/:[ Prop name ]}() description here] | |||
* | |||
* @return [type] [description] | |||
*/ | |||
public function get${1/(.*)/\u$1/:[ Prop name ]}() | |||
{ | |||
return \$this->\$${1:[ Prop name ]}; | |||
} | |||
/** | |||
* [set${1/(.*)/\u$1/:[ Prop name ]}() description here] | |||
* | |||
* @param \$${1:[ Prop name ]} [description] | |||
* @return [class type] \$this | |||
*/ | |||
public function set${1/(.*)/\u$1/:[ Prop name ]}(\$new${1/(.*)/\u$1/:[ Prop name ]}) | |||
{ | |||
\$this->\$${1:[Prop name ]} = \$new${1/(.*)/\u$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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,64 @@ | |||
<!-- | |||
php-newbsd | |||
Inserts a DocBlock for the NewBSD license. | |||
HOW TO USE | |||
In your PHP class, go to the top of the file, and type | |||
php-newbsd<TAB> | |||
Sublime Text will add the docblock for you. Now use <TAB> to work | |||
through the fields you need to complete. | |||
--> | |||
<snippet> | |||
<content><![CDATA[ | |||
/** | |||
* Copyright (c) 2012 ${1:[ Copyright holder ]}. | |||
* All rights reserved. | |||
* | |||
* Redistribution and use in source and binary forms, with or without | |||
* modification, are permitted provided that the following conditions | |||
* are met: | |||
* | |||
* * Redistributions of source code must retain the above copyright | |||
* notice, this list of conditions and the following disclaimer. | |||
* | |||
* * Redistributions in binary form must reproduce the above copyright | |||
* notice, this list of conditions and the following disclaimer in | |||
* the documentation and/or other materials provided with the | |||
* distribution. | |||
* | |||
* * Neither the names of the copyright holders nor the names of the | |||
* contributors may be used to endorse or promote products derived | |||
* from this software without specific prior written permission. | |||
* | |||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | |||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | |||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | |||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | |||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | |||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | |||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |||
* POSSIBILITY OF SUCH DAMAGE. | |||
* | |||
* @package ${2:[ Package ]} | |||
* @subpackage ${3:[ Subpackage ]} | |||
* @author ${4:[ Your name ]} <${5:[ Your email address ]}> | |||
* @copyright 2012 ${1:[ Copyright holder ]}. | |||
* @license http://www.opensource.org/licenses/bsd-license.php BSD License | |||
* @link http://${6:[ Your website ]} | |||
* @version @@PACKAGE_VERSION@@ | |||
*/ | |||
]]></content> | |||
<!-- Optional: Tab trigger to activate the snippet --> | |||
<tabTrigger>php-newbsd</tabTrigger> | |||
<!-- Optional: Scope the tab trigger will be active in --> | |||
<scope>source.php</scope> | |||
<!-- Optional: Description to show in the menu --> | |||
<description>Insert New BSD license DocBlock</description> | |||
</snippet> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,30 @@ | |||
<!-- | |||
php-section-comment | |||
Insert an easy-to-spot comment to separate out different sections | |||
of your class | |||
HOW TO USE | |||
In your PHP class, simply type the following: | |||
php-section-comment<TAB> | |||
Sublime Text will add the comment for you. Then use <TAB> to | |||
fill out the details for your section comment | |||
--> | |||
<snippet> | |||
<content><![CDATA[ | |||
// ================================================================== | |||
// | |||
// ${1:[ Section description goes here ... ]} | |||
// | |||
// ------------------------------------------------------------------ | |||
]]></content> | |||
<!-- Optional: Tab trigger to activate the snippet --> | |||
<tabTrigger>php-section-comment</tabTrigger> | |||
<!-- Optional: Scope the tab trigger will be active in --> | |||
<scope>source.php</scope> | |||
<!-- Optional: Description to show in the menu --> | |||
<description>Insert a comment block at the start of a new section in your PHP class</description> | |||
</snippet> |