From 06dfec6babd3dd5cec1dc85d9bb2b4b55e951863 Mon Sep 17 00:00:00 2001 From: Stuart Herbert Date: Fri, 3 Feb 2012 19:49:37 +0000 Subject: [PATCH] Initial commit --- LICENSE.md | 29 +++++++++++++ README.md | 26 ++++++++++++ license-newbsd.sublime-snippet | 50 ++++++++++++++++++++++ php-getset.sublime-snippet | 56 +++++++++++++++++++++++++ php-newbsd.sublime-snippet | 64 +++++++++++++++++++++++++++++ php-section-comment.sublime-snippet | 30 ++++++++++++++ 6 files changed, 255 insertions(+) create mode 100644 LICENSE.md create mode 100644 README.md create mode 100644 license-newbsd.sublime-snippet create mode 100644 php-getset.sublime-snippet create mode 100644 php-newbsd.sublime-snippet create mode 100644 php-section-comment.sublime-snippet diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..0e4bf63 --- /dev/null +++ b/LICENSE.md @@ -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. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..52cae35 --- /dev/null +++ b/README.md @@ -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 key. Sublime Text 2 will insert the snippet, and you can then use the 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 :) diff --git a/license-newbsd.sublime-snippet b/license-newbsd.sublime-snippet new file mode 100644 index 0000000..36ef177 --- /dev/null +++ b/license-newbsd.sublime-snippet @@ -0,0 +1,50 @@ + + + + + license-newbsd + + Add New BSD license to a plain text file + \ No newline at end of file diff --git a/php-getset.sublime-snippet b/php-getset.sublime-snippet new file mode 100644 index 0000000..e86ea90 --- /dev/null +++ b/php-getset.sublime-snippet @@ -0,0 +1,56 @@ + + + \$${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; +} +]]> + + php-getset + + source.php + + Create getter and setter methods + \ No newline at end of file diff --git a/php-newbsd.sublime-snippet b/php-newbsd.sublime-snippet new file mode 100644 index 0000000..a5e5072 --- /dev/null +++ b/php-newbsd.sublime-snippet @@ -0,0 +1,64 @@ + + + + * @copyright 2012 ${1:[ Copyright holder ]}. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @link http://${6:[ Your website ]} + * @version @@PACKAGE_VERSION@@ + */ +]]> + + php-newbsd + + source.php + + Insert New BSD license DocBlock + \ No newline at end of file diff --git a/php-section-comment.sublime-snippet b/php-section-comment.sublime-snippet new file mode 100644 index 0000000..dfb82a4 --- /dev/null +++ b/php-section-comment.sublime-snippet @@ -0,0 +1,30 @@ + + + + + php-section-comment + + source.php + + Insert a comment block at the start of a new section in your PHP class +