PageRenderTime 244ms CodeModel.GetById 91ms app.highlight 7ms RepoModel.GetById 144ms app.codeStats 0ms

/elpa/php-mode-20171204.23/php-classobj.el

https://github.com/andreaja/dotemacs
Lisp | 172 lines | 127 code | 25 blank | 20 comment | 3 complexity | 6bf2b76833ea98bc620c1047e748ffdb MD5 | raw file
  1;; Copyright (C) 2015  David Arroyo Menéndez
  2
  3;; Author: David Arroyo Menéndez <davidam@gnu.org>
  4;; Maintainer: David Arroyo Menéndez <davidam@gnu.org>
  5
  6;; This file is free software; you can redistribute it and/or modify
  7;; it under the terms of the GNU General Public License as published by
  8;; the Free Software Foundation; either version 3, or (at your option)
  9;; any later version.
 10
 11;; This file is distributed in the hope that it will be useful,
 12;; but WITHOUT ANY WARRANTY; without even the implied warranty of
 13;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 14;; GNU General Public License for more details.
 15
 16;; You should have received a copy of the GNU General Public License
 17;; along with GNU Emacs; see the file COPYING.  If not, write to
 18;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 
 19;; Boston, MA 02110-1301 USA,
 20
 21;; To install php-ext.el:
 22;; You can add (load "path/php-ext/php-ext.el") to your .emacs
 23
 24;; Classes Functions
 25;; http://php.net/manual/en/ref.classobj.php
 26;; file:///usr/share/doc/php-doc/html/ref.classobj.html
 27
 28(define-skeleton php-class
 29  "Insert a class statement."
 30  ""
 31  '(setq class (skeleton-read "Class name? ")) \n
 32  > "class " class \n
 33  > "{" \n
 34  ( "Variable? %s: "
 35    > "var " str ";" \n )
 36  ( "Function? %s: "
 37    > "function " str "(" ( "Parameter? %s:" str ", " ) ")" \n
 38    > "{ " \n
 39    _
 40    > "} " \n
 41    )
 42  > "}" \n
 43)
 44
 45(define-skeleton php__autoload 
 46  "Insert a __autoload statement. Attempt to load undefined class"
 47  ""
 48  '(setq class (skeleton-read "Class: "))
 49  > "__autoload(" class ");" \n
 50)
 51
 52(define-skeleton php-class_alias
 53  "Insert a class_alias statement. Creates an alias for a class"
 54  ""
 55  '(setq original (skeleton-read "Original: "))
 56  '(setq alias (skeleton-read "Alias: "))
 57  '(setq autoload (skeleton-read "Autoload: "))
 58  > "class_alias(" original ", " alias ", " autoload ");" \n
 59)
 60
 61(define-skeleton php-class_exists
 62  "Insert a class_exists statement. Checks if the class has been defined"
 63  ""
 64  '(setq class_name (skeleton-read "Class name: "))
 65  '(setq autoload (skeleton-read "Autoload: "))
 66  > "class_exists(" class_name ", " autoload ");" \n
 67)
 68
 69(define-skeleton php-get_called_class
 70  "Insert a get_called_class statement. Gets the name of the class the static method is called in."
 71  > "get_called_class();" \n
 72)
 73
 74(define-skeleton php-get_class_methods
 75  "Insert a get_class_methods statement."
 76  ""
 77  '(setq str (skeleton-read "Class? "))
 78  > "get_class_methods('" str "');" \n
 79)
 80
 81(define-skeleton php-get_class_vars
 82  "Insert a get_class_vars statement."
 83  ""
 84  '(setq str (skeleton-read "Class? "))
 85  > "get_class_vars('" str "');" \n
 86)
 87
 88(define-skeleton php-get_class
 89  "Insert a get_class statement."
 90  ""
 91  '(setq str (skeleton-read "Class? "))
 92  > "get_class('" str "');" \n
 93)
 94
 95(define-skeleton php-get_declared_classes
 96  "Insert a get_declared_classes statement."
 97  > "get_declared_classes();" \n
 98)
 99
100(define-skeleton php-get_declared_interfaces
101  "Insert a get_declared_interfaces statement."
102  > "get_declared_interfaces();" \n
103)
104
105(define-skeleton php-get_declared_traits
106  "Insert a get_declared_traits statement."
107  > "get_declared_traits();" \n
108)
109
110(define-skeleton php-get_object_vars
111  "Insert a get_object_var statement."
112  ""
113  '(setq var (skeleton-read "Var? "))
114  > "get_object_vars(" var ");" \n
115)
116
117(define-skeleton php-get_parent_class
118  "Insert a get_parent_class statement."
119  ""
120  '(setq obj (skeleton-read "Object? "))
121  > "get_parent_class(" obj ");" \n
122)
123
124(define-skeleton php-interface_exists
125  "Insert a interface_exists statement."
126  ""
127  '(setq interface_name (skeleton-read "Interface Name: "))
128  '(setq autoload (skeleton-read "Autoload: "))
129  > "interface_exists(" interface_name ", " autoload ");" \n
130)
131
132(define-skeleton php-is_a
133  "Insert an is_a statement. Checks if the object is of this class or has this class as one of its parents"
134  ""
135  '(setq object (skeleton-read "Object: "))
136  '(setq class_name (skeleton-read "Class name: "))
137  '(setq allow_string (skeleton-read "Allow string: "))
138  > "is_a(" object ", " class_name ", " allow_string ");" \n
139)
140
141(define-skeleton php-is_subclass_of
142  "Insert an is_subclass_of statement."
143  ""
144  '(setq obj (skeleton-read "Object: "))
145  '(setq class (skeleton-read "Class Name: "))
146  '(setq allow_string (skeleton-read "Allow string: "))
147  > "is_subclass_of(" obj ", " class ", " allow_string ");" \n
148)
149
150(define-skeleton php-method_exists
151  "Insert a method_exists statement."
152  ""
153  '(setq obj (skeleton-read "Object: "))
154  '(setq method (skeleton-read "Method: "))
155  > "method_exists(" object ", " method ");" \n
156)
157
158(define-skeleton php-property_exists
159  "Insert a property_exists statement."
160  ""
161  '(setq class (skeleton-read "Class: "))
162  '(setq property (skeleton-read "Property: "))
163  > "property_exists(" class ", " property ");" \n
164)
165  
166(define-skeleton php-trait_exists
167  "Insert a trait_exists statement."
168  ""
169  '(setq trait (skeleton-read "Trait: "))
170  '(setq autoload (skeleton-read "Autoload (TRUE | FALSE): "))
171  > "trait_exists(" trait ", " autoload ");" \n
172)