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


PHP ReflectionClass::getShortName方法代码示例

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


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

示例1: load

 /**
  * Load all extension classes
  */
 public function load()
 {
     $counter = 0;
     foreach (glob(__DIR__ . '/Extension/*.php') as $filename) {
         $file = new \SplFileInfo($filename);
         $classname = $file->getBasename('.php');
         $classpath = sprintf('%s\\Extension\\%s', __NAMESPACE__, $classname);
         require_once $filename;
         $extension = new \ReflectionClass($classpath);
         $instance = $extension->newInstance($this->getParent());
         foreach ($extension->getMethods() as $method) {
             if (mb_substr($method->name, 0, 3) == 'FN_') {
                 $map = new \StdClass();
                 $map->class = $extension->getShortName();
                 $map->method = $method->name;
                 $map->instance = $instance;
                 $tag = sprintf('%s.%s', mb_strtolower($classname), mb_substr($method->name, 3));
                 $this->mapping[$tag] = $map;
             }
         }
         $this->debug(__METHOD__, __LINE__, sprintf('Loaded extension: %s', $extension->getShortName()));
         // save the instance
         $this->instances[] = $instance;
         $counter++;
     }
     return $counter;
 }
开发者ID:g4z,项目名称:poop,代码行数:30,代码来源:ExtensionManager.php

示例2: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     unset($input);
     $items = glob(CMS_PATH . '*/Model/*.php');
     foreach ($items as $item) {
         $model = str_replace([CMS_BASE_PATH, '/', '.php'], ['', '\\', ''], $item);
         $systemModels[] = $model;
     }
     foreach (glob(APP_PATH . "*", GLOB_ONLYDIR) as $path) {
         $items = glob($path . '/*/Model/*.php');
         foreach ($items as $item) {
             $model = str_replace([APP_PATH, '/', '.php'], ['', '\\', ''], $item);
             $systemModels[] = $model;
         }
     }
     foreach ($systemModels as $model) {
         $myModel = new $model();
         if (method_exists($myModel, 'getIndexableContent')) {
             $reflect = new \ReflectionClass($myModel);
             $myStore = Store::get($reflect->getShortName());
             $modelsToIndex = $myStore->getModelsToIndex();
             $output->write('Indexing: ' . $reflect->getShortName());
             $count = 0;
             foreach ($modelsToIndex as $newModel) {
                 $count++;
                 $content = $newModel->getIndexableContent();
                 $data = ['model' => $newModel, 'content_id' => $newModel->getId(), 'content' => $content];
                 Event::trigger('ContentPublished', $data);
             }
             $output->writeln(' (' . $count . ' items)');
         }
     }
 }
开发者ID:dw250100785,项目名称:Octo,代码行数:33,代码来源:BuildSearchIndex.php

示例3: parseResource

 /**
  * @param array            $config
  * @param \ReflectionClass $class
  *
  * @return Resource
  */
 protected function parseResource(array $config, \ReflectionClass $class)
 {
     if (isset($config['resource'])) {
         $resource = $config['resource'];
         return new Resource(isset($resource['type']) ? $resource['type'] : StringUtil::dasherize($class->getShortName()), isset($resource['showLinkSelf']) ? $resource['showLinkSelf'] : null);
     }
     return new Resource(StringUtil::dasherize($class->getShortName()));
 }
开发者ID:jared-fraser,项目名称:JsonApiBundle,代码行数:14,代码来源:YamlDriver.php

示例4: getMethodName

 /**
  * @return string
  */
 private function getMethodName()
 {
     $methodSuffix = $this->argumentType->getShortName();
     $methodSuffix = ucfirst($methodSuffix);
     $pattern = 'get%sVisitor';
     $methodName = sprintf($pattern, $methodSuffix);
     return $methodName;
 }
开发者ID:helstern,项目名称:nomsky-lib,代码行数:11,代码来源:VisitorMethodDispatcherBuilder.php

示例5: __construct

 /**
  * Initializes a new ClassMetadata instance that will hold the object-relational mapping
  * metadata of the class with the given name.
  *
  * @param string $entityName The name of the entity class the new instance is used for.
  */
 public function __construct($entityName)
 {
     $this->name = $entityName;
     $this->reflClass = new \ReflectionClass($entityName);
     $this->namespace = $this->reflClass->getNamespaceName();
     $this->primaryTable['name'] = $this->reflClass->getShortName();
     $this->rootEntityName = $entityName;
 }
开发者ID:nvdnkpr,项目名称:symfony-demo,代码行数:14,代码来源:ClassMetadata.php

示例6: registerTile

 /**
  * @param $className
  *
  * @return bool
  */
 public static function registerTile($className)
 {
     $class = new \ReflectionClass($className);
     if (is_a($className, Tile::class, true) and !$class->isAbstract()) {
         self::$knownTiles[$class->getShortName()] = $className;
         self::$shortNames[$className] = $class->getShortName();
         return true;
     }
     return false;
 }
开发者ID:ClearSkyTeam,项目名称:ClearSky,代码行数:15,代码来源:Tile.php

示例7: getFactory

 /**
  * Creates the factory for this concrete product.
  * If the class does not exists yet, it is generated on the fly.
  * 
  * The factory implements an interface named after the short name of the
  * product class name with the suffix "Factory". The namespace is the
  * same namespace as the product classname.
  * 
  * The concrete factory is not of your concern, that's the trick of
  * factory method. That's why I put a random number after the classname
  * of the concrete factory : do not use that name !
  * 
  * @param string $fqcnProduct
  * 
  * @return object the the new factory
  */
 public function getFactory($fqcnProduct)
 {
     $refl = new \ReflectionClass($fqcnProduct);
     $fmName = 'Concrete' . $refl->getShortName() . 'Factory' . crc32($fqcnProduct);
     $fqcnFM = $refl->getNamespaceName() . '\\' . $fmName;
     if (!class_exists($fqcnFM)) {
         eval($this->generate($refl->getNamespaceName(), $refl->getShortName() . 'Factory', $fmName, $refl->getName()));
     }
     return new $fqcnFM();
 }
开发者ID:trismegiste,项目名称:php-is-magic,代码行数:26,代码来源:Generator.php

示例8: __construct

 /**
  * __construct
  *
  */
 public function __construct($template = null, $context = null)
 {
     $class = new \ReflectionClass(get_called_class());
     $shortcode = Helper::camel_to_underscored($class->getShortName());
     if ($template === null) {
         $template = sprintf("%s.twig", Helper::camel_to_hyphenated($class->getShortName()));
     }
     $this->template = $template;
     $this->context = $context;
     add_shortcode($shortcode, array($this, 'do_shortcode'));
 }
开发者ID:benedict-w,项目名称:pressgang,代码行数:15,代码来源:shortcode.php

示例9:

 function __construct($aggregateType)
 {
     if (null === $aggregateType) {
         throw new \InvalidArgumentException("Aggregate type not set.");
     }
     $this->reflClass = new \ReflectionClass($aggregateType);
     if (!$this->reflClass->implementsInterface(EventSourcedAggregateRootInterface::class)) {
         throw new \InvalidArgumentException("The given aggregateType must be a subtype of EventSourcedAggregateRootInterface");
     }
     $this->aggregateType = $aggregateType;
     $this->typeIdentifier = $this->reflClass->getShortName();
 }
开发者ID:babarinde,项目名称:GovernorFramework,代码行数:12,代码来源:GenericAggregateFactory.php

示例10: getControllerFile

 private function getControllerFile($module)
 {
     $nameSpace = $module->controllerNamespace;
     foreach (new \DirectoryIterator($module->controllerPath) as $file) {
         if (!$file->isDot()) {
             $className = $file->getBasename("Controller.php");
             $class = $nameSpace . '\\' . $className . "Controller";
             if (strpos($class, '-') === false && class_exists($class) && is_subclass_of($class, 'yii\\base\\Controller')) {
                 $class = new \ReflectionClass($class);
                 $doc = DocHelper::getDocComment($class->getDocComment());
                 $this->array[$module->getUniqueId()]['controllers'][str_replace("Controller", "", $class->getShortName())] = ['doc' => $doc ? $doc : $class->getShortName(), 'actions' => $this->getActions($class), 'class' => $class->getName()];
             }
         }
     }
 }
开发者ID:oyoy8629,项目名称:yii-core,代码行数:15,代码来源:SCanHelper.php

示例11: createMockClass

 private function createMockClass($className, $mockData = [])
 {
     $shortName = $this->reflection->getShortName();
     $classStart = self::reflectionContent($this->reflection, 1, $this->reflection->getStartLine() - 1);
     $classStart .= PHP_EOL . "class {$className} extends {$shortName}" . PHP_EOL;
     $this->body = self::reflectionBody($this->reflection, false);
     foreach ($mockData as $attribute => $value) {
         if (is_callable($value)) {
             $this->insertMethod($attribute, $value);
         } else {
             $this->insertAttribute($attribute, $value);
         }
     }
     eval($classStart . $this->body);
 }
开发者ID:bariew,项目名称:yii2-doctest-extension,代码行数:15,代码来源:Mock.php

示例12: indexAction

 public function indexAction(Request $request)
 {
     try {
         $this->get('naoned.oaipmh.ruler')->checkParamsUnicity($request->getQueryString());
         $this->allArgs = $this->getAllArguments($request);
         if (!array_key_exists('verb', $this->allArgs)) {
             throw new BadVerbException('The verb argument is missing');
         }
         $verb = $this->allArgs['verb'];
         if (!in_array($verb, $this->availableVerbs)) {
             throw new BadVerbException('Value of the verb argument is not a legal OAI-PMH verb.');
         }
         $methodName = $verb . 'Verb';
         return $this->{$methodName}($request);
     } catch (\Exception $e) {
         if ($e instanceof OaiPmhServerException) {
             $reflect = new \ReflectionClass($e);
             //Remove «Exception» at end of class namespace
             $code = substr($reflect->getShortName(), 0, -9);
             // lowercase first char
             $code[0] = strtolower(substr($code, 0, 1));
         } elseif ($e instanceof NotFoundHttpException) {
             $code = 'notFoundError';
         } else {
             $code = 'unknownError';
         }
         return $this->error($code, $e->getMessage());
     }
 }
开发者ID:naoned,项目名称:OaiPmhServerBundle,代码行数:29,代码来源:MainController.php

示例13: getWidgetStaticContent

 /**
  * Get the static content of the widget.
  *
  * @param Widget $widget
  *
  * @return string The static content
  */
 public function getWidgetStaticContent(Widget $widget)
 {
     $parameters = parent::getWidgetStaticContent($widget);
     $currentView = $this->currentViewHelper->getCurrentView();
     if ($currentView instanceof Template) {
         $rating = new Rating();
         $parameters['ratings'] = [];
         $parameters['entityId'] = 0;
         if ($currentView instanceof BusinessTemplate) {
             $parameters['businessEntityId'] = $currentView->getBusinessEntityId();
         }
     } else {
         if ($currentView instanceof BusinessPage) {
             $businessEntityId = $currentView->getBusinessEntityId();
             $entityId = $currentView->getBusinessEntity()->getId();
         } else {
             $ref = new \ReflectionClass($currentView);
             $businessEntityId = strtolower($ref->getShortName());
             $entityId = $currentView->getId();
         }
         $rating = $this->entityManager->getRepository('VictoireWidgetAggregateRatingBundle:Rating')->findOneOrCreate(['ipAddress' => $this->request->getClientIp(), 'businessEntityId' => $businessEntityId, 'entityId' => $entityId]);
         $parameters['ratings'] = $this->entityManager->getRepository('VictoireWidgetAggregateRatingBundle:Rating')->findBy(['businessEntityId' => $businessEntityId, 'entityId' => $entityId]);
         $parameters['businessEntityId'] = $businessEntityId;
         $parameters['entityId'] = $entityId;
     }
     $ratingForm = $this->formFactory->create(new RatingType(), $rating);
     $parameters['ratingForm'] = $ratingForm->createView();
     return $parameters;
 }
开发者ID:Charlie-Lucas,项目名称:WidgetAggregateRatingBundle,代码行数:36,代码来源:WidgetAggregateRatingContentResolver.php

示例14: __construct

 /**
  * Create a new event instance.
  *
  * @return void
  */
 public function __construct($object, $event)
 {
     $reflection = new \ReflectionClass($object);
     $this->class = $reflection->getShortName();
     $this->object = $object;
     $this->event = $event;
 }
开发者ID:xavierauana,项目名称:avaluestay,代码行数:12,代码来源:Notification.php

示例15: bindXmlData

 public function bindXmlData($xml, $objClass, $objMthods)
 {
     $obj = new $objClass();
     foreach ($objMthods as $medthod) {
         $methodName = $medthod->getName();
         $displayName = strtolower(ucwords(substr($methodName, 3, strlen($methodName) - 3)));
         $getterName = 'get' . substr($methodName, 3);
         if (substr($methodName, 0, 3) == "set") {
             if (is_array($obj->{$getterName}())) {
                 $dtoName = trim(substr($methodName, 3), "s") . "Dto";
                 $dtoXmlName = strtolower($dtoName);
                 $child = new $dtoName();
                 $className = new ReflectionClass($child);
                 $data = array();
                 foreach ($xml->{$displayName}->{$dtoXmlName} as $childXml) {
                     array_push($data, $this->bindXmlData($childXml, $className->getShortName(), $className->getMethods()));
                 }
             } else {
                 if ($obj->{$getterName}() instanceof Dto) {
                     $className = new ReflectionClass($obj->{$getterName}());
                     $data = $this->bindXmlData($xml->{$displayName}, $className->getShortName(), $className->getMethods());
                 } else {
                     $data = $xml->{$displayName};
                 }
             }
             $obj->{$methodName}($data);
         }
     }
     return $obj;
 }
开发者ID:rettakid-carwash,项目名称:server-php,代码行数:30,代码来源:Dto.php


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