当前位置: 首页>>代码示例>>PHP>>正文


PHP KInflector::camelize方法代码示例

本文整理汇总了PHP中KInflector::camelize方法的典型用法代码示例。如果您正苦于以下问题:PHP KInflector::camelize方法的具体用法?PHP KInflector::camelize怎么用?PHP KInflector::camelize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在KInflector的用法示例。


在下文中一共展示了KInflector::camelize方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: findClass

 /**
  * Get the classname based on an identifier.
  *
  * @param 	mixed  		 An identifier object - koowa:[path].name
  *
  * @return string|false Return object on success, returns FALSE on failure
  */
 public function findClass(KServiceIdentifier $identifier)
 {
     $classname = 'Tmpl' . ucfirst($identifier->package) . KInflector::implode($identifier->path) . ucfirst($identifier->name);
     if (!$this->getService('koowa:loader')->loadClass($classname, $identifier->basepath)) {
         $classname = AnServiceClass::findDefaultClass($identifier);
         if (!$classname) {
             //$path      = KInflector::implode($identifier->path);
             $classpath = $identifier->path;
             $classtype = !empty($classpath) ? array_shift($classpath) : '';
             //Create the fallback path and make an exception for views
             $path = $classtype != 'view' ? ucfirst($classtype) . KInflector::camelize(implode('_', $classpath)) : ucfirst($classtype);
             $classes[] = 'Tmpl' . ucfirst($identifier->package) . $path . ucfirst($identifier->name);
             $classes[] = 'Tmpl' . ucfirst($identifier->package) . $path . 'Default';
             $classes[] = 'ComApplication' . $path . ucfirst($identifier->name);
             $classes[] = 'ComApplication' . $path . 'Default';
             $classes[] = 'LibApplication' . $path . ucfirst($identifier->name);
             $classes[] = 'LibApplication' . $path . 'Default';
             $classes[] = 'LibBase' . $path . ucfirst($identifier->name);
             $classes[] = 'LibBase' . $path . 'Default';
             $classes[] = 'K' . $path . ucfirst($identifier->name);
             $classes[] = 'K' . $path . 'Default';
             foreach ($classes as $class) {
                 if ($this->getService('koowa:loader')->loadClass($class, $identifier->basepath)) {
                     $classname = $class;
                     break;
                 }
             }
             if ($classname) {
                 AnServiceClass::setDefaultClass($identifier, $classname);
             }
         }
     }
     return $classname;
 }
开发者ID:stonyyi,项目名称:anahita,代码行数:41,代码来源:template.php

示例2: findClass

 /**
  * Get the classname based on an identifier
  * 
  * @param  mixed  		 An identifier object - plg.type.plugin.[.path].name
  * @return string|false  Return object on success, returns FALSE on failure
  */
 public function findClass(KServiceIdentifier $identifier)
 {
     $classpath = KInflector::camelize(implode('_', $identifier->path));
     $classname = 'Plg' . ucfirst($identifier->package) . $classpath . ucfirst($identifier->name);
     //Don't allow the auto-loader to load plugin classes if they don't exists yet
     if (!class_exists($classname)) {
         $classname = false;
     }
     return $classname;
 }
开发者ID:raeldc,项目名称:nooku-server,代码行数:16,代码来源:plugin.php

示例3: instantiate

	/**
	 * Create an instance of a class based on a class identifier
	 * 
	 * This factory will try to create an generic or default object based on the identifier information
	 * if the actual object cannot be found using a predefined fallback sequence.
	 * 
	 * Fallback sequence : -> Named Component Specific
	 *                     -> Named Component Default  
	 *                     -> Default Component Specific
	 *                     -> Default Component Default
	 *                     -> Framework Specific 
	 *                     -> Framework Default
	 *
	 * @param mixed  		 Identifier or Identifier object - com:[//application/]component.view.[.path].name
	 * @param 	object 		 An optional KConfig object with configuration options
	 * @return object|false  Return object on success, returns FALSE on failure
	 */
	public function instantiate($identifier, KConfig $config)
	{
	    $path      = KInflector::camelize(implode('_', $identifier->path));
        $classname = 'Com'.ucfirst($identifier->package).$path.ucfirst($identifier->name);
        		        	
      	//Don't allow the auto-loader to load component classes if they don't exists yet
		if (!class_exists( $classname, false ))
		{
			//Find the file
			if($path = KLoader::load($identifier))
			{
				//Don't allow the auto-loader to load component classes if they don't exists yet
				if (!class_exists( $classname, false )) {
					throw new KFactoryAdapterException("Class [$classname] not found in file [".$path."]" );
				}
			}
			else 
			{
				$classpath = $identifier->path;
				$classtype = !empty($classpath) ? array_shift($classpath) : '';
					
				//Create the fallback path and make an exception for views
				$path = ($classtype != 'view') ? KInflector::camelize(implode('_', $classpath)) : '';
							
				/*
				 * Find the classname to fallback too and auto-load the class
				 * 
				 * Fallback sequence : -> Named Component Specific 
				 *                     -> Named Component Default  
				 *                     -> Default Component Specific 
				 *                     -> Default Component Defaukt
				 *                     -> Framework Specific 
				 *                     -> Framework Default
				 */
				if(class_exists('Com'.ucfirst($identifier->package).ucfirst($classtype).$path.ucfirst($identifier->name))) {
					$classname = 'Com'.ucfirst($identifier->package).ucfirst($classtype).$path.ucfirst($identifier->name);
				} elseif(class_exists('Com'.ucfirst($identifier->package).ucfirst($classtype).$path.'Default')) {
					$classname = 'Com'.ucfirst($identifier->package).ucfirst($classtype).$path.'Default';
				} elseif(class_exists('ComDefault'.ucfirst($classtype).$path.ucfirst($identifier->name))) {
					$classname = 'ComDefault'.ucfirst($classtype).$path.ucfirst($identifier->name);
				} elseif(class_exists('ComDefault'.ucfirst($classtype).$path.'Default')) {
					$classname = 'ComDefault'.ucfirst($classtype).$path.'Default';
				} elseif(class_exists( 'K'.ucfirst($classtype).$path.ucfirst($identifier->name))) {
					$classname = 'K'.ucfirst($classtype).$path.ucfirst($identifier->name);
				} elseif(class_exists('K'.ucfirst($classtype).$path.'Default')) {
					$classname = 'K'.ucfirst($classtype).$path.'Default';
				} else {
					$classname = false;
				}
			}
		}
		
		return $classname;
	}
开发者ID:raeldc,项目名称:com_learn,代码行数:71,代码来源:component.php

示例4: _beforeSubmit

 protected function _beforeSubmit(KCommandContext $context)
 {
     $item = $this->getModel()->getItem();
     if ($this->fieldsProperty) {
         $prop = $this->fieldsProperty;
         $item = $item->{$prop};
     }
     foreach ($this->verifyConfig as $type => $fieldName) {
         $method = '__verify' . KInflector::camelize($type);
         if (!$this->{$method}($item, $context->data->toArray(), $fieldName)) {
             return false;
         }
     }
     return true;
 }
开发者ID:kedweber,项目名称:com_briteverify,代码行数:15,代码来源:verifiable.php

示例5: findClass

 /**
  * Get the classname based on an identifier
  * 
  * This locator will try to create an generic or default classname on the identifier information
  * if the actual class cannot be found using a predefined fallback sequence.
  * 
  * Fallback sequence : -> Named Module Specific
  *                     -> Named Module Default  
  *                     -> Default Module Specific
  *                     -> Default Module Default
  *                     -> Framework Specific 
  *                     -> Framework Default
  *
  * @param mixed  		 An identifier object - mod:[//application/]module.[.path].name
  * @return string|false  Return object on success, returns FALSE on failure
  */
 public function findClass(KServiceIdentifier $identifier)
 {
     $path = KInflector::camelize(implode('_', $identifier->path));
     $classname = 'Mod' . ucfirst($identifier->package) . $path . ucfirst($identifier->name);
     //Don't allow the auto-loader to load module classes if they don't exists yet
     if (!$this->getService('koowa:loader')->loadClass($classname, $identifier->basepath)) {
         $classpath = $identifier->path;
         $classtype = !empty($classpath) ? array_shift($classpath) : 'view';
         //Create the fallback path and make an exception for views
         $com_path = $classtype != 'view' ? ucfirst($classtype) . KInflector::camelize(implode('_', $classpath)) : ucfirst($classtype);
         $mod_path = $classtype != 'view' ? ucfirst($classtype) . KInflector::camelize(implode('_', $classpath)) : '';
         /*
          * Find the classname to fallback too and auto-load the class
          * 
          * Fallback sequence : -> Named Module Specific 
          *                     -> Named Module Default  
          *                     -> Default Module Specific 
          *                     -> Default Module Default
          *                     -> Default Component Specific 
          *                     -> Default Component Default
          *                     -> Framework Specific 
          *                     -> Framework Default
          */
         if (class_exists('Mod' . ucfirst($identifier->package) . $mod_path . ucfirst($identifier->name))) {
             $classname = 'Mod' . ucfirst($identifier->package) . $mod_path . ucfirst($identifier->name);
         } elseif (class_exists('Mod' . ucfirst($identifier->package) . $mod_path . 'Default')) {
             $classname = 'Mod' . ucfirst($identifier->package) . $mod_path . 'Default';
         } elseif (class_exists('ModDefault' . $mod_path . ucfirst($identifier->name))) {
             $classname = 'ModDefault' . $mod_path . ucfirst($identifier->name);
         } elseif (class_exists('ModDefault' . $mod_path . 'Default')) {
             $classname = 'ModDefault' . $mod_path . 'Default';
         } elseif (class_exists('ComDefault' . $com_path . ucfirst($identifier->name))) {
             $classname = 'ComDefault' . $com_path . ucfirst($identifier->name);
         } elseif (class_exists('ComDefault' . $com_path . 'Default')) {
             $classname = 'ComDefault' . $com_path . 'Default';
         } elseif (class_exists('K' . $com_path . ucfirst($identifier->name))) {
             $classname = 'K' . $com_path . ucfirst($identifier->name);
         } elseif (class_exists('K' . $com_path . 'Default')) {
             $classname = 'K' . $com_path . 'Default';
         } else {
             $classname = false;
         }
     }
     return $classname;
 }
开发者ID:JSWebdesign,项目名称:intranet-platform,代码行数:61,代码来源:module.php

示例6: instantiate

 /**
  * Create an instance of a class based on a class identifier
  * 
  * @param  mixed  		 Identifier or Identifier object - plg.type.plugin.[.path].name
  * @param  object 		 An optional KConfig object with configuration options
  * @return object|false  Return object on success, returns FALSE on failure
  */
 public function instantiate($identifier, KConfig $config)
 {
     $classname = false;
     if ($identifier->type == 'plg') {
         $classpath = KInflector::camelize(implode('_', $identifier->path));
         $classname = 'Plg' . ucfirst($identifier->package) . $classpath . ucfirst($identifier->name);
         //Don't allow the auto-loader to load plugin classes if they don't exists yet
         if (!class_exists($classname, false)) {
             //Find the file
             if ($path = KLoader::load($identifier)) {
                 //Don't allow the auto-loader to load plugin classes if they don't exists yet
                 if (!class_exists($classname, false)) {
                     throw new KFactoryAdapterException("Class [{$classname}] not found in file [" . $path . "]");
                 }
             }
         }
     }
     return $classname;
 }
开发者ID:ravenlife,项目名称:Ninja-Framework,代码行数:26,代码来源:plugin.php

示例7: getInstance

 /**
  * Creates and initialize a property. The instantiation happens through cloning rather
  * then creating a new instance.
  * 
  * @param string  $property The property type
  * @param KConfig $config   The property configuration 
  * 
  * @return AnDomainPropertyAbstract
  */
 public static function getInstance($property, KConfig $config)
 {
     $description = $config['description'];
     $name = $config['name'];
     if (!$name || !$description) {
         throw new AnDomainPropertyException('name [string] or desription [AnDomainDescriptionAbstract] options are missing');
     }
     if ($description->getProperty($name)) {
         $instance = $description->getProperty($name);
     } else {
         if (!isset(self::$_instances[$property])) {
             $classname = 'AnDomain' . KInflector::camelize($property);
             self::$_instances[$property] = new $classname();
         }
         $instance = clone self::$_instances[$property];
     }
     $instance->setConfig($config);
     $description->setProperty($instance);
     return $instance;
 }
开发者ID:stonyyi,项目名称:anahita,代码行数:29,代码来源:abstract.php

示例8: instantiate

 /**
  * Create an instance of a class based on a class identifier
  * 
  * This factory will try to create an generic or default object based on the identifier information
  * if the actual object cannot be found using a predefined fallback sequence.
  * 
  * Fallback sequence : -> Named Module
  *                     -> Default Module
  *                     -> Framework Specific
  *                     -> Framework Default
  *
  * @param mixed  		 Identifier or Identifier object - application::mod.module.[.path].name
  * @param 	object 		 An optional KConfig object with configuration options
  * @return object|false  Return object on success, returns FALSE on failure
  */
 public function instantiate($identifier, KConfig $config)
 {
     $classname = false;
     if ($identifier->type == 'mod') {
         $path = KInflector::camelize(implode('_', $identifier->path));
         $classname = 'Mod' . ucfirst($identifier->package) . $path . ucfirst($identifier->name);
         //Don't allow the auto-loader to load module classes if they don't exists yet
         if (!class_exists($classname, false)) {
             //Find the file
             if ($path = KLoader::load($identifier)) {
                 //Don't allow the auto-loader to load module classes if they don't exists yet
                 if (!class_exists($classname, false)) {
                     throw new KFactoryAdapterException("Class [{$classname}] not found in file [" . $path . "]");
                 }
             } else {
                 $classpath = $identifier->path;
                 $classtype = !empty($classpath) ? array_shift($classpath) : $identifier->name;
                 /*
                  * Find the classname to fallback too and auto-load the class
                  * 
                  * Fallback sequence : -> Named Module
                  *                     -> Default Module
                  *                     -> Framework Specific 
                  *                     -> Framework Default
                  */
                 if (class_exists('Mod' . ucfirst($identifier->package) . ucfirst($identifier->name))) {
                     $classname = 'Mod' . ucfirst($identifier->package) . ucfirst($identifier->name);
                 } elseif (class_exists('ModDefault' . ucfirst($identifier->name))) {
                     $classname = 'ModDefault' . ucfirst($identifier->name);
                 } elseif (class_exists('K' . ucfirst($classtype) . $path . ucfirst($identifier->name))) {
                     $classname = 'K' . ucfirst($classtype) . ucfirst($identifier->name);
                 } elseif (class_exists('K' . ucfirst($classtype) . 'Default')) {
                     $classname = 'K' . ucfirst($classtype) . 'Default';
                 } else {
                     $classname = false;
                 }
             }
         }
     }
     return $classname;
 }
开发者ID:ravenlife,项目名称:Ninja-Framework,代码行数:56,代码来源:module.php

示例9: _findClass

 /**
  * Find a class
  * 
  * @param KServiceIdentifier $identifier
  * 
  * @return string
  */
 protected function _findClass($identifier)
 {
     $loader = $this->getService('koowa:loader');
     $classname = null;
     //Create the fallback path and make an exception for views
     $classpath = $identifier->path;
     $classtype = !empty($classpath) ? array_shift($classpath) : '';
     $paths = array();
     $paths[] = ucfirst($classtype) . KInflector::camelize(implode('_', $classpath));
     if ($classtype == 'view') {
         $paths[] = ucfirst($classtype);
     }
     $paths = array_unique($paths);
     $namespaces = array();
     $namespaces[] = 'Com' . ucfirst($identifier->package);
     $namespaces[] = 'Lib' . ucfirst($identifier->package);
     $namespaces[] = 'ComBase';
     $namespaces[] = 'LibBase';
     $namespaces[] = 'ComDefault';
     $namespaces[] = 'An';
     $namespaces[] = 'K';
     $namespaces = array_unique($namespaces);
     $classes = array();
     foreach ($namespaces as $namespace) {
         foreach ($paths as $path) {
             $names = array();
             $names[] = ucfirst($identifier->name);
             $names[] = empty($path) ? ucfirst($identifier->name) . 'Default' : 'Default';
             foreach ($names as $name) {
                 $class = $namespace . $path . $name;
                 $classes[] = $class;
                 if ($loader->findPath($class, $identifier->basepath) && $loader->loadClass($class, $identifier->basepath)) {
                     $classname = $class;
                     break 3;
                 }
             }
         }
     }
     return $classname;
 }
开发者ID:walteraries,项目名称:anahita,代码行数:47,代码来源:component.php

示例10: testUnderscoredToCamelize

 /**
  * @dataProvider provideNames
  */
 public function testUnderscoredToCamelize($classified, $separator, $split, $exploded, $camelized, $underscored)
 {
     $this->assertEquals(KInflector::camelize($underscored), $camelized);
 }
开发者ID:janssit,项目名称:www.rvproductions.be,代码行数:7,代码来源:KInflectorTest.php

示例11: load

 /**
  * Calls the methods _beforeLayout($layout) and _layout[Layout] and runs the command 
  * before.load if there are any commands in the queue. For any layout rendered through the view
  * the data of the view is passed to the template regardless. If $data has duplicate keys as the 
  * $view->data then $data values replaces the values with duplicate keys.
  * 
  * @param string $layout The layout
  * @param array  $data   The data
  */
 public function load($template, array $data = array())
 {
     if (method_exists($this, '_beforeLayout')) {
         $this->_beforeLayout($template);
     }
     $method = '_layout' . KInflector::camelize($template);
     if (method_exists($this, $method)) {
         $this->{$method}();
     }
     $data = array_merge($this->_data, $data);
     $output = $this->getTemplate()->loadTemplate($template, $data)->render();
     return $output;
 }
开发者ID:stonyyi,项目名称:anahita,代码行数:22,代码来源:template.php


注:本文中的KInflector::camelize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。