Permalink
Browse files

Let's make this a bit more generic for other people.

  • Loading branch information...
1 parent 2d59b75 commit 48308a47676d8a8a457cc587db19d254671f1f83 @jperras committed May 20, 2011
Showing with 13 additions and 9 deletions.
  1. +2 −3 php_fastium.h
  2. +8 −3 php_fastium_inflector.c
  3. +1 −1 tests/camelize.phpt
  4. +1 −1 tests/humanize.phpt
  5. +1 −1 tests/underscore.phpt
View
@@ -10,8 +10,7 @@
/* {{{ Defines */
#define PHP_FASTIUM_EXTNAME "fastium"
#define PHP_FASTIUM_EXTVER "0.1"
-#define FASTIUM_NS "lithium\\"
-#define FASTIUM_UTIL_NS FASTIUM_NS "util"
+#define FASTIUM_NS "fastium"
/* }}} */
extern zend_module_entry fastium_module_entry;
@@ -63,4 +62,4 @@ PHP_MINFO_FUNCTION(fastium);
* End:
* vim600: noet sw=4 ts=4 fdm=marker
* vim<600: noet sw=4 ts=4
- */
+ */
View
@@ -17,11 +17,15 @@ static zend_class_entry *fastium_inflector_ce = NULL;
/* {{{ write_rule(char*, zval*)
Rewrites a full property value by name. */
-static void write_rule(char *rule, zval *value TSRMLS_DC) {
+static void write_rule(char *rule, zval *value TSRMLS_DC)
+{
zend_update_static_property(fastium_inflector_ce, rule, strlen(rule), value TSRMLS_CC);
}
+/* }}} */
-static void init_transliteration_rules(TSRMLS_D) {
+/* {{{ void init_transliteration_rules() */
+static void init_transliteration_rules(TSRMLS_D)
+{
zval *value;
MAKE_STD_ZVAL(value);
@@ -47,6 +51,7 @@ static void init_transliteration_rules(TSRMLS_D) {
write_rule("_transliteration", value TSRMLS_CC);
zval_ptr_dtor(&value);
}
+/* }}} */
/* {{{ _regex_enclose(char*, int)
Enclose a string for preg matching. */
@@ -279,7 +284,7 @@ zend_module_entry fastium_module_entry = {
PHP_MINIT_FUNCTION(fastium)
{
zend_class_entry ce;
- INIT_NS_CLASS_ENTRY(ce, FASTIUM_UTIL_NS, "Inflector", fastium_class_methods);
+ INIT_NS_CLASS_ENTRY(ce, FASTIUM_NS, "Inflector", fastium_class_methods);
fastium_inflector_ce = zend_register_internal_class(&ce TSRMLS_CC);
#ifdef ZTS
View
@@ -4,7 +4,7 @@ Inflector::camelize()
<?php if (!extension_loaded('fastium')) print "skip"; ?>
--FILE--
<?php
-use lithium\util\Inflector;
+use fastium\Inflector;
echo Inflector::camelize("lower cased word", false) . "\n";
echo Inflector::camelize('red_bike') . "\n";
echo Inflector::camelize('red bike') . "\n";
View
@@ -4,7 +4,7 @@ Inflector::humanize()
<?php if (!extension_loaded('fastium')) print "skip"; ?>
--FILE--
<?php
-use lithium\util\Inflector;
+use fastium\Inflector;
echo Inflector::humanize('red_bike') . "\n";
echo Inflector::humanize('a_really_long_word') . "\n";
echo Inflector::humanize('some_word') . "\n";
View
@@ -4,7 +4,7 @@ Inflector::underscore()
<?php if (!extension_loaded('fastium')) print "skip"; ?>
--FILE--
<?php
-use lithium\util\Inflector;
+use fastium\Inflector;
echo Inflector::underscore('redBike') . "\n";
echo Inflector::underscore('aReallyLongWordToUnderscore') . "\n";
echo Inflector::underscore('some_word') . "\n";

0 comments on commit 48308a4

Please sign in to comment.