PageRenderTime 52ms CodeModel.GetById 28ms RepoModel.GetById 0ms app.codeStats 0ms

/skeleton/php-classobj.el

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