1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/Jackin-Inflector

Присоединиться к Gitlife
Откройте для себя и примите участие в публичных проектах с открытым исходным кодом с участием более 10 миллионов разработчиков. Приватные репозитории также полностью бесплатны :)
Присоединиться бесплатно
В этом репозитории не указан файл с открытой лицензией (LICENSE). При использовании обратитесь к конкретному описанию проекта и его зависимостям в коде.
Клонировать/Скачать
Inflector.php 2 КБ
Копировать Редактировать Web IDE Исходные данные Просмотреть построчно История
Jackin Отправлено 19.11.2013 12:17 6264bf7
<?php
$br = (php_sapi_name() == "cli")? "":"<br>";
if(!extension_loaded('Inflector')) {
dl('Inflector.' . PHP_SHLIB_SUFFIX);
}
$module = 'Inflector';
$functions = get_extension_funcs($module);
echo "Functions available in the test extension:$br\n";
foreach($functions as $func) {
echo $func."$br\n";
}
echo "$br\n";
$function = 'confirm_' . $module . '_compiled';
if (extension_loaded($module)) {
$str = $function($module);
} else {
$str = "Module $module is not compiled into PHP";
}
echo "$str\n";
if (class_exists("Inflector")){
echo Inflector::underscore("applePie"), PHP_EOL;
}else{
echo "Class Inflector is not exists!", PHP_EOL;
}
if (class_exists("Inflector") && method_exists("Inflector", "camelize")){
echo "Testing Inflector::camelize method....", PHP_EOL;
checkCamelizeMethod();
}else{
echo "Method Inflector:camelize: is not exists!", PHP_EOL;
}
if (class_exists("Inflector") && method_exists("Inflector", "variable")){
echo "Testing Inflector::variable method....", PHP_EOL;
checkVariableMethod();
}else{
echo "Method Inflector:camelize: is not exists!", PHP_EOL;
}
if(class_exists("Inflector") && method_exists("Inflector", "humanize")){
echo "Testing Inflector::humanize method....", PHP_EOL;
checkHumanizeMethod();
}else{
echo "Method Inflector:humanize: is not exists!", PHP_EOL;
}
echo Inflector::TestConstant, PHP_EOL;
// debug_zval_dump(Inflector::$_plural);
function checkVariableMethod(){
$inputs = array('apples', 'user_result', 'people_people');
foreach($inputs as $input){
echo "Input: {$input} => Output: ", Inflector::variable($input), PHP_EOL;
}
}
function checkCamelizeMethod(){
$inputs = array("Apple_pie", "some_thing", "people_person");
foreach($inputs as $input){
echo "Input: {$input} => Output: ", Inflector::camelize($input), PHP_EOL;
}
}
function checkHumanizeMethod(){
$inputs = array("Apple_pie", "some_thing", "people_person", "Apple_PIie", "some____thing", "people__Person");
foreach($inputs as $input){
echo "Input: {$input} => Output: ", Inflector::humanize($input), PHP_EOL;
}
}

Опубликовать ( 0 )

Вы можете оставить комментарий после Вход в систему

1
https://api.gitlife.ru/oschina-mirror/Jackin-Inflector.git
git@api.gitlife.ru:oschina-mirror/Jackin-Inflector.git
oschina-mirror
Jackin-Inflector
Jackin-Inflector
master