本文整理汇总了PHP中Phalcon\Text::uncamelize方法的典型用法代码示例。如果您正苦于以下问题:PHP Text::uncamelize方法的具体用法?PHP Text::uncamelize怎么用?PHP Text::uncamelize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Phalcon\Text
的用法示例。
在下文中一共展示了Text::uncamelize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getSource
public function getSource()
{
$nowClassName = get_class($this);
$trueClassName = str_replace(__NAMESPACE__ . '\\', '', $nowClassName);
$trueClassName = Text::uncamelize($trueClassName);
return DB_PREFIX . strtolower($trueClassName);
}
示例2: build
/**
* Generate view
*/
public function build()
{
$action = Text::uncamelize($this->_options['action']);
$viewName = explode('-', str_replace('_', '-', Text::uncamelize($this->_options['name'])));
if (count($viewName) > 1) {
array_pop($viewName);
}
$viewName = implode('-', $viewName);
$viewDir = $this->_options['directory'] . DIRECTORY_SEPARATOR . $viewName;
$viewPath = $viewDir . DIRECTORY_SEPARATOR . $action . '.volt';
$code = "<?php\n" . Tools::getCopyright() . "\n?>\n";
$code = str_replace("\t", " ", $code);
if (!file_exists($viewPath) || $this->_options['force'] == true) {
if (!is_dir($viewDir)) {
mkdir($viewDir, 0777, true);
chmod($viewDir, 0777);
}
if (!@file_put_contents($viewPath, $code)) {
throw new \Exception("Unable to write to '{$viewPath}'");
}
chmod($viewPath, 0777);
} else {
throw new \Exception("The View '{$action}' already exists");
}
return $viewName;
}
示例3: initialize
public function initialize()
{
foreach (self::$routes as $route => $controller) {
$name = str_replace('_', '-', Text::uncamelize($controller));
$this->add($route, $controller)->setName($name);
}
}
示例4: run
public function run($parameters)
{
$name = $this->getOption(array('name', 1));
$className = Text::camelize(isset($parameters[2]) ? $parameters[2] : $name);
$fileName = Text::uncamelize($className);
$schema = $this->getOption('schema');
$modelBuilder = new \Phalcon\Builder\Model(array('name' => $name, 'schema' => $schema, 'className' => $className, 'fileName' => $fileName, 'genSettersGetters' => $this->isReceivedOption('get-set'), 'genDocMethods' => $this->isReceivedOption('doc'), 'namespace' => $this->getOption('namespace'), 'directory' => $this->getOption('directory'), 'force' => $this->isReceivedOption('force')));
$modelBuilder->build();
}
示例5: run
/**
* @param $parameters
*/
public function run($parameters)
{
$name = $this->getOption(array('name', 1));
$className = Text::camelize(isset($parameters[1]) ? $parameters[1] : $name);
$fileName = Text::uncamelize($className);
$schema = $this->getOption('schema');
$modelBuilder = new ModelBuilder(array('name' => $name, 'schema' => $schema, 'className' => $className, 'fileName' => $fileName, 'genSettersGetters' => $this->isReceivedOption('get-set'), 'genDocMethods' => $this->isReceivedOption('doc'), 'namespace' => $this->getOption('namespace'), 'directory' => $this->getOption('directory'), 'modelsDir' => $this->getOption('output'), 'extends' => $this->getOption('extends'), 'excludeFields' => $this->getOption('excludefields'), 'force' => $this->isReceivedOption('force'), 'mapColumn' => $this->isReceivedOption('mapcolumn')));
$modelBuilder->build();
}
示例6: install
/**
* @param Filter $filter
*/
public static function install($filter)
{
foreach (get_class_methods(get_called_class()) as $method) {
if ($method != __METHOD__) {
$filter->add(Text::uncamelize($method), function ($value) use($method) {
return call_user_func([get_called_class(), $method], $value);
});
}
}
}
示例7: testUncamelizeString
/**
* Tests the uncamelize function
*
* @author Nikos Dimopoulos <nikos@niden.net>
* @since 2012-10-30
*/
public function testUncamelizeString()
{
$uncamelizeTests = array('camelize' => 'camelize', 'CameLiZe' => 'came_li_ze', 'cAmeLize' => 'c_ame_lize', '_camelize' => '_camelize', '123camelize' => '123camelize', 'c_a_m_e_l_i_z_e' => 'c_a_m_e_l_i_z_e', 'Camelize' => 'camelize', 'camel_ize' => 'camel_ize', 'CameLize' => 'came_lize');
$template = "Text::uncamelize did not convert the string '%s' correctly";
foreach ($uncamelizeTests as $input => $uncamelized) {
$expected = $uncamelized;
$actual = PhText::uncamelize($input);
$this->assertEquals($expected, $actual, sprintf($template, $input));
}
}
示例8: install
/**
* @param VoltCompiler $compiler
*/
public static function install($compiler)
{
foreach (get_class_methods(get_called_class()) as $method) {
if ($method != __METHOD__) {
$compiler->addFunction(Text::uncamelize($method), function ($resolvedArgs, $exprArgs) use($method) {
return get_called_class() . '::' . $method . '(' . $resolvedArgs . ')';
});
}
}
}
示例9: modulesConfig
public function modulesConfig($modules_list)
{
$namespaces = array();
$modules = array();
if (!empty($modules_list)) {
foreach ($modules_list as $module) {
$namespaces[$module] = APPLICATION_PATH . '/modules/' . $module;
$simple = Text::uncamelize($module);
$simple = str_replace('_', '-', $simple);
$modules[$simple] = array('className' => $module . '\\Module', 'path' => APPLICATION_PATH . '/modules/' . $module . '/Module.php');
}
}
$modules_array = array('loader' => array('namespaces' => $namespaces), 'modules' => $modules);
return $modules_array;
}
示例10: initialize
public function initialize()
{
if (static::PREFIX) {
$this->setPrefix(static::PREFIX);
}
foreach (static::ROUTES as $route => $controller) {
$namespace = '';
if (static::SPACE) {
$namespace = static::SPACE . '\\';
}
$name = implode('-', array_map(function ($name) {
$name = Text::uncamelize($name);
$name = str_replace('_', '-', $name);
return $name;
}, explode('\\', $controller)));
$this->add($route, $namespace . $controller)->setName($name);
}
}
示例11: afterExecuteRoute
public function afterExecuteRoute(\Phalcon\Events\Event $event, \Phalcon\Mvc\Dispatcher $dispatcher)
{
/** @var \Phalcon\Mvc\Router $route */
$route = $dispatcher->getDI()->get('router');
$view = $dispatcher->getDI()->getService('view')->resolve();
$wasForwarded = $dispatcher->wasForwarded();
if ($wasForwarded) {
return;
}
if ($route->getMatchedRoute()) {
$paths = $route->getMatchedRoute()->getPaths();
$controller = $paths['controller'];
$action = \Phalcon\Text::uncamelize($paths['action']);
$action = str_replace("_", "-", $action);
$template = $controller . '/' . $action;
$view->pick([$template]);
}
}
示例12: __construct
public function __construct()
{
$class = new \ReflectionClass('\\Phalcon\\Tag');
$methods = $class->getMethods(\ReflectionMethod::IS_PUBLIC);
$code = file_get_contents(__DIR__ . '/Generator.tpl');
// Functions
$skip = ['getEscaper', 'renderAttributes', 'setDI', 'getDI', 'getUrlService', 'getEscaperService', 'setAutoescape', 'setDefault', 'setDefaults', 'displayTo', 'hasValue', 'getValue', 'resetInput', 'setTitle', 'setTitleSeparator', 'appendTitle', 'prependTitle', 'setDocType'];
$functions = [];
foreach ($methods as $method) {
if (in_array($method->getName(), $skip)) {
continue;
}
$name = lcfirst(\Phalcon\Text::uncamelize($method->getName()));
if ($method->getName() == 'getDocType') {
$name = 'get_doctype';
}
$callable = sprintf('Phalcon\\Tag::%s', $method->getName());
$functions[] = sprintf("new Twig_SimpleFunction('%s', '%s')", $name, $callable);
}
$functions = implode(",\n", $functions);
// Create PHP code
$this->code = str_replace('%functions%', $functions, $code);
}
示例13: uncamelize
public static function uncamelize($str)
{
return parent::uncamelize($str);
}
示例14: uncamelize
public static function uncamelize($str, $delimiter = null)
{
return parent::uncamelize($str, $delimiter);
}
示例15: _getForm
/**
* Return form fullname
*
* @param string $module
* @param string $grid
* @return string
*/
protected function _getForm($module, $form)
{
$module = str_replace("-", "_", \Phalcon\Text::uncamelize($module));
$module = explode("_", $module);
foreach ($module as $i => &$word) {
if ($i == 0) {
continue;
}
$word = ucfirst($word);
}
$module = implode("", $module);
$form = str_replace("-", "_", \Phalcon\Text::uncamelize($form));
$form = explode("_", $form);
foreach ($form as $i => &$word) {
if ($i == 0) {
continue;
}
$word = ucfirst($word);
}
$form = implode("\\", $form);
return "\\" . ucfirst($module) . "\\Form\\Extjs\\" . ucfirst($form);
}