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


PHP KAutoloader::getClassMap方法代码示例

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


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

示例1: cacheMap

 static function cacheMap($servicePath, $cacheFilePath)
 {
     if (!is_dir($servicePath)) {
         throw new Exception('Invalid directory [' . $servicePath . ']');
     }
     $servicePath = realpath($servicePath);
     $serviceMap = array();
     $classMap = KAutoloader::getClassMap();
     $checkedClasses = array();
     foreach ($classMap as $class => $classFilePath) {
         $classFilePath = realpath($classFilePath);
         if (strpos($classFilePath, $servicePath) === 0) {
             $reflectionClass = new ReflectionClass($class);
             if ($reflectionClass->isSubclassOf('KalturaBaseService')) {
                 $docComment = $reflectionClass->getDocComment();
                 $parser = new KalturaDocCommentParser($docComment);
                 $serviceId = strtolower($parser->serviceName);
                 $serviceMap[$serviceId] = $class;
             }
         }
         $checkedClasses[] = $class;
     }
     $pluginServices = array();
     $pluginInstances = KalturaPluginManager::getPluginInstances('IKalturaServices');
     foreach ($pluginInstances as $pluginName => $pluginInstance) {
         $pluginServices = $pluginInstance->getServicesMap();
         foreach ($pluginServices as $serviceName => $serviceClass) {
             $serviceName = strtolower($serviceName);
             $serviceId = "{$pluginName}_{$serviceName}";
             $pluginServices[$serviceId] = $serviceClass;
             $serviceMap[$serviceId] = $serviceClass;
         }
     }
     $cachedFile = '';
     $cachedFile .= '<?php' . PHP_EOL;
     $cachedFile .= 'self::$services = ' . var_export($serviceMap, true) . ';' . PHP_EOL;
     if (!is_dir(dirname($cacheFilePath))) {
         mkdir(dirname($cacheFilePath), 0777);
     }
     file_put_contents($cacheFilePath, $cachedFile);
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:41,代码来源:KalturaServicesMap.php

示例2: writeOrderByEnumForType

 private function writeOrderByEnumForType(KalturaTypeReflector $type)
 {
     $map = KAutoloader::getClassMap();
     if (!isset($map[$type->getType()])) {
         return;
     }
     $this->_txt = "";
     $parentType = $type;
     while (1) {
         $parentType = $parentType->getParentTypeReflector();
         if ($parentType === null || $parentType->isFilterable()) {
             break;
         }
     }
     $partnetClassName = $parentType ? $parentType->getType() . "OrderBy" : "KalturaStringEnum";
     $enumName = $type->getType() . "OrderBy";
     $enumPath = dirname($map[$type->getType()]) . "/filters/orderEnums/{$enumName}.php";
     $subpackage = ($type->getPackage() == 'api' ? '' : 'api.') . 'filters.enum';
     $this->appendLine("<?php");
     $this->appendLine("/**");
     $this->appendLine(" * @package " . $type->getPackage());
     $this->appendLine(" * @subpackage {$subpackage}");
     $this->appendLine(" */");
     $this->appendLine("class {$enumName} extends {$partnetClassName}");
     $this->appendLine("{");
     foreach ($type->getCurrentProperties() as $prop) {
         $filters = $prop->getFilters();
         foreach ($filters as $filter) {
             if ($filter == "order") {
                 $this->appendLine("\tconst " . $this->getOrderByConst($prop->getName()) . "_ASC = \"+" . $prop->getName() . "\";");
                 $this->appendLine("\tconst " . $this->getOrderByConst($prop->getName()) . "_DESC = \"-" . $prop->getName() . "\";");
             }
         }
     }
     $reflectionClass = new ReflectionClass($type->getType());
     if (!$type->isAbstract() && $reflectionClass->getMethod("getExtraFilters")->getDeclaringClass()->getName() === $reflectionClass->getName()) {
         $extraFilters = $type->getInstance()->getExtraFilters();
         if ($extraFilters) {
             foreach ($extraFilters as $filterFields) {
                 if (!isset($filterFields["order"])) {
                     continue;
                 }
                 $fieldName = $filterFields["order"];
                 $fieldConst = $this->getOrderByConst($fieldName);
                 $this->appendLine("\tconst {$fieldConst}_ASC = \"+{$fieldName}\";");
                 $this->appendLine("\tconst {$fieldConst}_DESC = \"-{$fieldName}\";");
             }
         }
     }
     $this->appendLine("}");
     $this->writeToFile($enumPath, $this->_txt);
 }
开发者ID:DBezemer,项目名称:server,代码行数:52,代码来源:FiltersGenerator.php

示例3: initClassMap

 protected function initClassMap()
 {
     if ($this->_classMap !== null) {
         return;
     }
     $this->_classMap = KAutoloader::getClassMap();
 }
开发者ID:AdiTal,项目名称:server,代码行数:7,代码来源:ClientGeneratorFromPhp.php

示例4: cacheMap

 static function cacheMap($servicePath, $cacheFilePath)
 {
     if (!is_dir($servicePath)) {
         throw new Exception('Invalid directory [' . $servicePath . ']');
     }
     $servicePath = realpath($servicePath);
     $serviceMap = array();
     $classMap = KAutoloader::getClassMap();
     $checkedClasses = array();
     //Retrieve all service classes from the classMap.
     $serviceClasses = array();
     foreach ($classMap as $class => $classFilePath) {
         $classFilePath = realpath($classFilePath);
         if (strpos($classFilePath, $servicePath) === 0) {
             $reflectionClass = new ReflectionClass($class);
             if ($reflectionClass->isSubclassOf('KalturaBaseService')) {
                 $serviceDoccomment = new KalturaDocCommentParser($reflectionClass->getDocComment());
                 $serviceClasses[$serviceDoccomment->serviceName] = $class;
             }
         }
     }
     //Retrieve all plugin service classes.
     $pluginInstances = KalturaPluginManager::getPluginInstances('IKalturaServices');
     foreach ($pluginInstances as $pluginName => $pluginInstance) {
         $pluginServices = $pluginInstance->getServicesMap();
         foreach ($pluginServices as $serviceName => $serviceClass) {
             $serviceName = strtolower($serviceName);
             $serviceId = "{$pluginName}_{$serviceName}";
             $serviceClasses[$serviceId] = $serviceClass;
         }
     }
     //Add core & plugin services to the services map
     $aliasActions = array();
     foreach ($serviceClasses as $serviceId => $serviceClass) {
         $serviceReflectionClass = KalturaServiceReflector::constructFromClassName($serviceClass);
         $serviceMapEntry = new KalturaServiceActionItem();
         $serviceMapEntry->serviceId = $serviceId;
         $serviceMapEntry->serviceClass = $serviceClass;
         $serviceMapEntry->serviceInfo = $serviceReflectionClass->getServiceInfo();
         $actionMap = array();
         $nativeActions = $serviceReflectionClass->getActions();
         foreach ($nativeActions as $actionId => $actionName) {
             $actionMap[strtolower($actionId)] = array("serviceClass" => $serviceClass, "actionMethodName" => $actionName, "serviceId" => $serviceId, "actionName" => $actionId);
         }
         $serviceMapEntry->actionMap = $actionMap;
         $serviceMap[strtolower($serviceId)] = $serviceMapEntry;
         foreach ($serviceReflectionClass->getAliasActions() as $alias => $methodName) {
             $aliasActions[$alias] = "{$serviceId}.{$methodName}";
         }
     }
     // add aliases
     foreach ($aliasActions as $aliasAction => $sourceAction) {
         list($aliasService, $aliasAction) = explode('.', $aliasAction);
         list($sourceService, $sourceAction) = explode('.', $sourceAction);
         $aliasService = strtolower($aliasService);
         $sourceService = strtolower($sourceService);
         $extServiceClass = $serviceClasses[$sourceService];
         $serviceMap[$aliasService]->actionMap[strtolower($aliasAction)] = array("serviceClass" => $extServiceClass, "actionMethodName" => $sourceAction, "serviceId" => $sourceService, "actionName" => $aliasAction);
     }
     // filter out services that have no actions
     $serviceMap = array_filter($serviceMap, array('KalturaServicesMap', 'filterEmptyServices'));
     if (!is_dir(dirname($cacheFilePath))) {
         mkdir(dirname($cacheFilePath));
         chmod(dirname($cacheFilePath), 0755);
     }
     kFile::safeFilePutContents($cacheFilePath, serialize($serviceMap), 0644);
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:67,代码来源:KalturaServicesMap.php

示例5: getClassFilePath

 private function getClassFilePath($class)
 {
     $map = KAutoloader::getClassMap();
     if (!isset($map[$class])) {
         throw new Exception("File path was not found for [{$class}]");
     }
     return $map[$class];
 }
开发者ID:DBezemer,项目名称:server,代码行数:8,代码来源:ApiSearchObjectsGenerator.php


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