[gedit] [snippets] Make PHP snippets more standard



commit 73fa16e2071940c35ebc69bd9c78b10cd9a16fe4
Author: Jesse van den Kieboom <jessevdk gmail com>
Date:   Sat Apr 12 17:43:20 2014 +0200

    [snippets] Make PHP snippets more standard
    
    https://bugzilla.gnome.org/show_bug.cgi?id=629774

 plugins/snippets/data/php.xml |  104 ++++++++++++++---------------------------
 1 files changed, 36 insertions(+), 68 deletions(-)
---
diff --git a/plugins/snippets/data/php.xml b/plugins/snippets/data/php.xml
index 8c88ece..89b27e7 100644
--- a/plugins/snippets/data/php.xml
+++ b/plugins/snippets/data/php.xml
@@ -1,26 +1,13 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <snippets language="PHP">
   <snippet id="class">
-    <text><![CDATA[#doc
-#      classname:      ${1:ClassName}
-#      scope:          ${2:PUBLIC}
-#
-#/doc
-
-class ${1:ClassName} ${3:extends AnotherClass}
+    <text><![CDATA[class ${1:ClassName}${2: extends AnotherClass}
 {
-       #       internal variables
-
-       #       Constructor
-       function __construct (${4:argument})
-       {
-               # code...
-               $0
-       }
-       ###
-
-}
-###]]></text>
+    function __construct(${3:argument})
+    {
+        $0
+    }
+}]]></text>
     <description>class ..</description>
     <tag>class</tag>
   </snippet>
@@ -30,28 +17,22 @@ class ${1:ClassName} ${3:extends AnotherClass}
     <tag>$</tag>
   </snippet>
   <snippet id="do">
-    <text><![CDATA[do
-{
-       # code...
-       $0
+    <text><![CDATA[do {
+    $0
 } while (${1:$a <= 10});]]></text>
     <description>do .. while ..</description>
     <tag>do</tag>
   </snippet>
   <snippet id="elseif">
-    <text><![CDATA[elseif (${1:condition})
-{
-       # code...
-       $0
+    <text><![CDATA[elseif (${1:condition}) {
+    $0
 }]]></text>
     <description>elseif ..</description>
     <tag>elseif</tag>
   </snippet>
   <snippet id="else">
-    <text><![CDATA[else
-{
-       # code...
-       $0
+    <text><![CDATA[else {
+    $0
 }]]></text>
     <description>else ..</description>
     <tag>else</tag>
@@ -67,19 +48,15 @@ class ${1:ClassName} ${3:extends AnotherClass}
     <tag>$</tag>
   </snippet>
   <snippet id="foreach">
-    <text><![CDATA[foreach ($${1:variable} as $${2:key} => $${3:value})
-{
-       # code...
-       $0:
+    <text><![CDATA[foreach ($${1:variable} as $${2:key} => $${3:value}) {
+    $0
 }]]></text>
     <description>foreach ..</description>
     <tag>foreach</tag>
   </snippet>
   <snippet id="for">
-    <text><![CDATA[for ($${1:i} = ${2:0}; $${1:i} < $3; $${1:i}++)
-{
-       # code...
-       $0
+    <text><![CDATA[for ($${1:i} = ${2:0}; $${1:i} < $3; $${1:i}++) {
+    $0
 }]]></text>
     <description>for ..</description>
     <tag>for</tag>
@@ -87,7 +64,7 @@ class ${1:ClassName} ${3:extends AnotherClass}
   <snippet id="function">
     <text><![CDATA[${1:public }function ${2:FunctionName}($3)
 {
-       ${0:# code...}
+    ${0:# code...}
 }]]></text>
     <description>function ..</description>
     <tag>function</tag>
@@ -108,23 +85,18 @@ class ${1:ClassName} ${3:extends AnotherClass}
     <tag>iff</tag>
   </snippet>
   <snippet id="ifelse">
-    <text><![CDATA[if (${1:condition})
-{
-       ${2:# code...}
-}
-else
-{
-       ${3:# code...}
+    <text><![CDATA[if (${1:condition}) {
+    ${2}
+} else {
+    ${3}
 }
 $0]]></text>
     <description>if .. else ..</description>
     <tag>ifelse</tag>
   </snippet>
   <snippet id="if">
-    <text><![CDATA[if (${1:condition})
-{
-       # code...
-       $0
+    <text><![CDATA[if (${1:condition}) {
+    $0
 }]]></text>
     <description>if ..</description>
     <tag>if</tag>
@@ -147,7 +119,7 @@ $0]]></text>
   <snippet id="php">
     <text><![CDATA[<?php
 
-       $0
+    $0
 
 ?>]]></text>
     <description>&lt;?php .. ?&gt;</description>
@@ -190,33 +162,29 @@ $0]]></text>
   </snippet>
   <snippet id="case">
     <text><![CDATA[case '${1:variable}':
-       # code...
-       $0
-break;]]></text>
+    $0
+    break;]]></text>
     <description>case ..</description>
     <tag>case</tag>
   </snippet>
   <snippet id="switch">
-    <text><![CDATA[switch (${1:variable})
-{
-       case '${2:value}':
-               ${3:# code...}
-       break;
+    <text><![CDATA[switch (${1:variable}) {
+    case '${2:value}':
+        ${3}
+        break;
 
-       $0
+    $0
 
-       default:
-               ${4:# code...}
-       break;
+    default:
+        ${4}
+        break;
 }]]></text>
     <description>switch ..</description>
     <tag>switch</tag>
   </snippet>
   <snippet id="while">
-    <text><![CDATA[while (${1:$a <= 10})
-{
-       # code...
-       $0
+    <text><![CDATA[while (${1:$a <= 10}) {
+    $0
 }]]></text>
     <description>while ..</description>
     <tag>while</tag>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]