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


PHP KInflector::implode方法代码示例

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


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

示例1: execute

 /**
  * Command handler
  * 
  * @param string  $name		The command name
  * @param mixed   $args		The command arguments
  *
  * @return boolean
  */
 public function execute($name, $args)
 {
     $parts = explode('.', $name);
     $event = 'on' . KInflector::implode($parts);
     $dispatcher = KFactory::get('lib.koowa.event.dispatcher');
     return $dispatcher->dispatch($event, $args);
 }
开发者ID:janssit,项目名称:www.reliancelaw.be,代码行数:15,代码来源:event.php

示例2: 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

示例3: 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 = 'K' . ucfirst($identifier->package) . KInflector::implode($identifier->path) . ucfirst($identifier->name);
     if (!class_exists($classname)) {
         // use default class instead
         $classname = 'K' . ucfirst($identifier->package) . KInflector::implode($identifier->path) . 'Default';
         if (!class_exists($classname)) {
             $classname = false;
         }
     }
     return $classname;
 }
开发者ID:stonyyi,项目名称:anahita,代码行数:18,代码来源:koowa.php

示例4: execute

 /**
  * Command handler
  * 
  * @param   string      The command name
  * @param   object      The command context
  * @return  boolean     Always returns true
  */
 public function execute($name, KCommandContext $context)
 {
     $type = '';
     if ($context->caller) {
         $identifier = clone $context->caller->getIdentifier();
         if ($identifier->path) {
             $type = array_shift($identifier->path);
         } else {
             $type = $identifier->name;
         }
     }
     $parts = explode('.', $name);
     $event = 'on' . ucfirst(array_shift($parts)) . ucfirst($type) . KInflector::implode($parts);
     $this->_dispatcher->dispatchEvent($event, clone $context);
     return true;
 }
开发者ID:JSWebdesign,项目名称:intranet-platform,代码行数:23,代码来源:event.php

示例5: instantiate

 /**
  * Create an instance of a class based on a class identifier
  *
  * @param 	mixed  		 Identifier or Identifier object - lib.koowa.[.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 == 'lib' && $identifier->package == 'koowa') {
         $classname = 'K' . KInflector::implode($identifier->path) . ucfirst($identifier->name);
         $filepath = KLoader::path($identifier);
         if (!class_exists($classname)) {
             // use default class instead
             $classname = 'K' . KInflector::implode($identifier->path) . 'Default';
             if (!class_exists($classname)) {
                 throw new KFactoryAdapterException("Class [{$classname}] not found in file [" . basename($filepath) . "]");
             }
         }
     }
     return $classname;
 }
开发者ID:ravenlife,项目名称:Ninja-Framework,代码行数:23,代码来源:koowa.php

示例6: createInstance

 /**
  * Create an instance of a class based on a class identifier
  *
  * @param mixed  $string 	The class identifier
  * @param array  $options 	An optional associative array of configuration settings.
  * @return object
  */
 public function createInstance($identifier, array $options)
 {
     $instance = false;
     $parts = explode('.', $identifier);
     if ($parts[0] == 'lib' && $parts[1] == 'koowa') {
         unset($parts[0]);
         unset($parts[1]);
         $classname = 'K' . KInflector::implode($parts);
         if (!class_exists($classname)) {
             $suffix = array_pop($parts);
             $options['name'] = array('prefix' => 'k', 'base' => KInflector::implode($parts), 'suffix' => $suffix);
             $classname = 'K' . KInflector::implode($parts) . 'Default';
         }
         $instance = new $classname($options);
     }
     return $instance;
 }
开发者ID:janssit,项目名称:www.gincoprojects.be,代码行数:24,代码来源:koowa.php

示例7: execute

 /**
  * Command handler
  * 
  * @param   string      The command name
  * @param   object      The command context
  * @return  boolean     Can return both true or false.  
  */
 public function execute($name, KCommandContext $context)
 {
     $type = '';
     if ($context->caller) {
         $identifier = clone $context->caller->getIdentifier();
         if ($identifier->path) {
             $type = array_shift($identifier->path);
         } else {
             $type = $identifier->name;
         }
     }
     $parts = explode('.', $name);
     $method = !empty($type) ? '_' . $type . ucfirst(KInflector::implode($parts)) : '_' . lcfirst(KInflector::implode($parts));
     if (in_array($method, $this->getMethods())) {
         return $this->{$method}($context);
     }
     return true;
 }
开发者ID:ravenlife,项目名称:Ninja-Framework,代码行数:25,代码来源:command.php

示例8: __call

 /**
  * Implements magic method. Dynamically mixes a mixin
  * 
  * @param string $method Method name
  * @param array  $args   Array of arugments
  * 
  * @return mixed
  */
 public function __call($method, $args)
 {
     //If the method hasn't been mixed yet, load all the behaviors
     if (!isset($this->_mixed_methods[$method])) {
         $key = 'behavior.' . $method;
         if (!self::_cache($this)->offsetExists($key)) {
             self::_cache($this)->offsetSet($key, false);
             $behaviors = $this->getRepository()->getBehaviors();
             foreach ($behaviors as $behavior) {
                 if (in_array($method, $behavior->getMixableMethods())) {
                     //only mix the mixin that has $method
                     self::_cache($this)->offsetSet($key, $behavior);
                     break;
                 }
             }
         }
         if ($behavior = self::_cache($this)->offsetGet($key)) {
             $this->mixin($behavior);
         }
     }
     $parts = KInflector::explode($method);
     if ($parts[0] == 'is') {
         if (isset($this->_mixed_methods[$method])) {
             return true;
         } else {
             return false;
         }
     }
     if (!isset($this->_mixed_methods[$method])) {
         if ($parts[0] == 'get' || $parts[0] == 'set') {
             $property = lcfirst(KInflector::implode(array_slice($parts, 1)));
             $property = $this->getEntityDescription()->getProperty($property);
             if ($property) {
                 if ($parts[0] == 'get') {
                     return $this->getData($property->getName());
                 } else {
                     return $this->setData($property->getName(), array_shift($args));
                 }
             }
         }
     }
     return parent::__call($method, $args);
 }
开发者ID:walteraries,项目名称:anahita,代码行数:51,代码来源:abstract.php

示例9: findDefaultClass

 /**
  * Finds the default class for an identifier or return null.
  *
  * @param KServiceIdentifier $identifier The identifier of the class 
  * 
  * @return string|bool Return the class name or false if not found
  */
 public static function findDefaultClass($identifier)
 {
     $strIdentifier = (string) $identifier;
     if (isset(self::$_defaults[$strIdentifier])) {
         $classname = self::$_defaults[$strIdentifier];
         if ($classname === false || class_exists($classname)) {
             return $classname;
         }
     }
     $classbase = 'Lib' . ucfirst($identifier->package) . KInflector::implode($identifier->path);
     $loader = KService::get('koowa:loader');
     $classname = $classbase . ucfirst($identifier->name);
     if (!class_exists($classname)) {
         $classname = $classbase . 'Default';
         if (!class_exists($classname)) {
             $classname = false;
         }
     }
     if ($classname === false) {
         if (isset(self::$_identifiers[$strIdentifier])) {
             $config = self::$_identifiers[$strIdentifier];
             if (isset($config['default'])) {
                 $classes = array_unique($config['default']);
             } else {
                 $classes = get_prefix($config['prefix'], $config['name']);
                 if (isset($config['fallback'])) {
                     $classes[] = $config['fallback'];
                 }
             }
             foreach ($classes as $class) {
                 //make sure to find  path first
                 //then try to load it
                 if ($loader->findPath($class, $identifier->basepath) && $loader->loadClass($class, $identifier->basepath)) {
                     $classname = $class;
                     break;
                 }
             }
         }
     }
     self::setDefaultClass($strIdentifier, $classname);
     return $classname;
 }
开发者ID:stonyyi,项目名称:anahita,代码行数:49,代码来源:class.php


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