本文整理汇总了PHP中KAutoloader类的典型用法代码示例。如果您正苦于以下问题:PHP KAutoloader类的具体用法?PHP KAutoloader怎么用?PHP KAutoloader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了KAutoloader类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: testAddWithCategories
/**
* Test the addition of a mediaEntry with proeprty "categories" set.
* @param string $categories
* @dataProvider provideData
*/
public function testAddWithCategories($categories)
{
$mediaEntry = new KalturaMediaEntry();
$mediaEntry->name = uniqid();
$mediaEntry->mediaType = KalturaMediaType::VIDEO;
$mediaEntry->categories = $categories;
$mediaEntry = $this->client->media->add($mediaEntry);
var_dump(KAutoloader::getClassFilePath(get_class($this->client)));
$categoryNames = explode(",", $categories);
foreach ($categoryNames as $categoryName) {
$filter = new KalturaCategoryFilter();
$filter->fullNameEqual = $categoryName;
$results = $this->client->category->listAction($filter);
$this->assertEquals(1, $results->totalCount, "Unexpected number of categories with fullname {$categoryName}.");
$catId = $results->objects[0]->id;
// Assert that the entry's "categoriesIds" property was updated properly.
$entryCatIds = explode(',', $mediaEntry->categoriesIds);
$this->assertTrue(in_array($catId, $entryCatIds), "Entry's categoriesIds property should containt category Id [{$catId}] for category [{$categoryName}]");
//Assert that a KalturaCategoryEntry object was created for the entry and each category it was associated with.
$catEntryFilter = new KalturaCategoryEntryFilter();
$catEntryFilter->categoryIdEqual = $catId;
$catEntryFilter->entryIdEqual = $mediaEntry->id;
try {
$res = $this->client->categoryEntry->listAction($catEntryFilter);
$this->assertGreaterThan(0, $res->totalCount > 0);
} catch (Exception $e) {
$this->assertEquals(0, 1, "Unexpected exception thrown - expected categoryEntry object for entry Id" . $mediaEntry->id . " and category Id {$catId}");
}
}
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:35,代码来源:MediaServiceEntitlementTest.php
示例2: get
/**
* @param string $type
* @return KalturaTypeReflector
*/
static function get($type)
{
if (!self::$_enabled) {
return new KalturaTypeReflector($type);
}
if (!array_key_exists($type, self::$_loadedTypeReflectors)) {
$cachedDir = KAutoloader::buildPath(kConf::get("cache_root_path"), "api_v3", "typeReflector");
if (!is_dir($cachedDir)) {
mkdir($cachedDir);
chmod($cachedDir, 0755);
}
$cachedFilePath = $cachedDir . DIRECTORY_SEPARATOR . $type . ".cache";
$typeReflector = null;
if (file_exists($cachedFilePath)) {
$cachedData = file_get_contents($cachedFilePath);
$typeReflector = unserialize($cachedData);
}
if (!$typeReflector) {
$typeReflector = new KalturaTypeReflector($type);
$cachedData = serialize($typeReflector);
$bytesWritten = kFile::safeFilePutContents($cachedFilePath, $cachedData);
if (!$bytesWritten) {
$folderPermission = substr(decoct(fileperms(dirname($cachedFilePath))), 2);
error_log("Kaltura type reflector could not be saved to path [{$cachedFilePath}] type [{$type}] folder permisisons [{$folderPermission}]");
}
}
self::$_loadedTypeReflectors[$type] = $typeReflector;
}
return self::$_loadedTypeReflectors[$type];
}
开发者ID:DBezemer,项目名称:server,代码行数:34,代码来源:KalturaTypeReflectorCacher.php
示例3: __construct
/**
*
* Creates a new Kaltura test Object
* @param string $name
* @param array $data
* @param string $dataName
*/
public function __construct($name = null, array $data = array(), $dataName = '')
{
parent::__construct($name, $data, $dataName);
$class = get_class($this);
if ($name) {
KalturaLog::info("_____________________________________ [{$class}] [{$name}] ___________________________________");
} else {
KalturaLog::info("__________________________________________ [{$class}] ______________________________________");
}
$testFilePath = KAutoloader::getClassFilePath($class);
$this->testFolder = dirname($testFilePath);
$this->inputs = $data;
KalturaLog::info("Loads config file [{$testFilePath}.ini]");
$this->config = new KalturaTestConfig("{$testFilePath}.ini");
$testConfig = $this->config->get('config');
if (!$testConfig) {
$testConfig = new Zend_Config(array('source' => KalturaTestSource::XML), true);
$this->config->config = $testConfig;
$this->config->saveToIniFile();
}
$this->dataSource = $testConfig->source;
$this->outputFolder = $testConfig->outputFolder;
if ($this->outputFolder && !is_dir($this->outputFolder)) {
KalturaLog::info("Creating folder output [{$this->outputFolder}]");
mkdir($this->outputFolder, 777, true);
}
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:34,代码来源:KalturaTestCaseApiBase.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();
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
示例5: get
/**
* @param string $type
* @return KalturaTypeReflector
*/
static function get($type)
{
if (!self::$_enabled) {
return new KalturaTypeReflector($type);
}
if (!array_key_exists($type, self::$_loadedTypeReflectors)) {
$cachedDir = KAutoloader::buildPath(kConf::get("cache_root_path"), "api_v3", "typeReflector");
if (!is_dir($cachedDir)) {
mkdir($cachedDir);
}
$cachedFilePath = $cachedDir . DIRECTORY_SEPARATOR . $type . ".cache";
if (file_exists($cachedFilePath)) {
$cachedData = file_get_contents($cachedFilePath);
$typeReflector = unserialize($cachedData);
} else {
$typeReflector = new KalturaTypeReflector($type);
$cachedData = serialize($typeReflector);
file_put_contents($cachedFilePath, $cachedData);
}
self::$_loadedTypeReflectors[$type] = $typeReflector;
}
return self::$_loadedTypeReflectors[$type];
}
开发者ID:richhl,项目名称:kalturaCE,代码行数:27,代码来源:KalturaTypeReflectorCacher.php
示例6: __construct
<?php
// AWS SDK PHP Client Library
require_once KAutoloader::buildPath(KALTURA_ROOT_PATH, 'vendor', 'aws', 'aws-autoloader.php');
use Aws\S3\S3Client;
use Aws\S3\Exception\S3Exception;
use Aws\S3\Enum\CannedAcl;
/**
* Extends the 'kFileTransferMgr' class & implements a file transfer manager using the Amazon S3 protocol with Authentication Version 4.
* For additional comments please look at the 'kFileTransferMgr' class.
*
* @package infra
* @subpackage Storage
*/
class s3Mgr extends kFileTransferMgr
{
private $s3;
protected $filesAcl = CannedAcl::PRIVATE_ACCESS;
protected $s3Region = '';
// instances of this class should be created usign the 'getInstance' of the 'kFileTransferMgr' class
protected function __construct(array $options = null)
{
parent::__construct($options);
if ($options && isset($options['filesAcl'])) {
$this->filesAcl = $options['filesAcl'];
}
if ($options && isset($options['s3Region'])) {
$this->s3Region = $options['s3Region'];
}
// do nothing
$this->connection_id = 1;
开发者ID:DBezemer,项目名称:server,代码行数:31,代码来源:s3Mgr.class.php
示例7: Zend_Config_Ini
<?php
require_once __DIR__ . "/../../bootstrap.php";
KalturaLog::setContext("CLIENTS");
KalturaLog::debug(__FILE__ . " start");
$generatorPath = KAutoloader::buildPath(KALTURA_ROOT_PATH, "generator");
$generatorOutputPath = KAutoloader::buildPath(KALTURA_ROOT_PATH, "generator", "output");
$generatorConfigPath = KAutoloader::buildPath(KALTURA_ROOT_PATH, "generator", "config.ini");
$config = new Zend_Config_Ini($generatorConfigPath);
?>
<ul>
<?php
foreach ($config as $name => $item) {
if (!$item->get("public-download")) {
continue;
}
$outputFilePath = KAutoloader::buildPath($generatorOutputPath, $name . ".tar.gz");
$outputFileRealPath = realpath($outputFilePath);
if ($outputFileRealPath) {
print '<li>';
print '<a href="download.php?name=' . $name . '"> Download ' . $name . '</a>';
print '</li>';
}
}
?>
</ul>
<?php
KalturaLog::debug(__FILE__ . " end");
开发者ID:DBezemer,项目名称:server,代码行数:28,代码来源:index.php
示例8: define
* limitations under the License.
*
* Modified by Akvelon Inc.
* 2014-06-30
* http://www.akvelon.com/contact-us
*/
/**
*
* @package Scheduler
*/
require_once "../infra/bootstrap_base.php";
require_once KALTURA_ROOT_PATH . '/infra/kConf.php';
require_once KALTURA_ROOT_PATH . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
define("KALTURA_BATCH_PATH", KALTURA_ROOT_PATH . "/batch");
// Autoloader - override the autoloader defaults
require_once KALTURA_INFRA_PATH . "/KAutoloader.php";
KAutoloader::setClassPath(array(KAutoloader::buildPath(KALTURA_ROOT_PATH, "infra", "*"), KAutoloader::buildPath(KALTURA_ROOT_PATH, "vendor", "PHPMailer", "*"), KAutoloader::buildPath(KALTURA_ROOT_PATH, "vendor", "phpseclib", "*"), KAutoloader::buildPath(KALTURA_ROOT_PATH, "plugins", "*"), KAutoloader::buildPath(KALTURA_ROOT_PATH, "vendor", "propel", "*"), KAutoloader::buildPath(KALTURA_ROOT_PATH, "alpha", "*"), KAutoloader::buildPath(KALTURA_BATCH_PATH, "*")));
KAutoloader::addClassPath(KAutoloader::buildPath(KALTURA_ROOT_PATH, "plugins", "*", "batch", "*"));
KAutoloader::setIncludePath(array(KAutoloader::buildPath(KALTURA_ROOT_PATH, "vendor", "ZendFramework", "library")));
KAutoloader::setClassMapFilePath(kConf::get("cache_root_path") . '/batch/classMap.cache');
KAutoloader::register();
set_include_path(get_include_path() . PATH_SEPARATOR . KAutoloader::buildPath(KALTURA_ROOT_PATH, "vendor", "phpseclib"));
set_include_path(get_include_path() . PATH_SEPARATOR . KAutoloader::buildPath(KALTURA_ROOT_PATH, "alpha", "apps", "kaltura", "lib"));
// Logger
$loggerConfigPath = KALTURA_ROOT_PATH . "/configurations/logger.ini";
try {
$config = new Zend_Config_Ini($loggerConfigPath);
KalturaLog::initLog($config->batch);
KalturaLog::setContext("BATCH");
} catch (Zend_Config_Exception $ex) {
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:31,代码来源:bootstrap.php
示例9: isset
<?php
require_once ".." . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR . "bootstrap.php";
KalturaLog::setContext("CLIENTS");
KalturaLog::debug(__FILE__ . " start");
$requestedName = isset($_GET["name"]) ? $_GET['name'] : null;
if (!$requestedName) {
die("File not found");
}
$generatorOutputPath = KAutoloader::buildPath(KALTURA_ROOT_PATH, "generator", "output");
$generatorConfigPath = KAutoloader::buildPath(KALTURA_ROOT_PATH, "generator", "config.ini");
$config = new Zend_Config_Ini($generatorConfigPath);
foreach ($config as $name => $item) {
if ($name === $requestedName && $item->get("public-download")) {
$fileName = $name . ".tar.gz";
$outputFilePath = KAutoloader::buildPath($generatorOutputPath, $fileName);
$outputFilePath = realpath($outputFilePath);
header("Content-disposition: attachment; filename={$fileName}");
kFile::dumpFile($outputFilePath, "application/gzip");
die;
}
}
die("File not found");
KalturaLog::debug(__FILE__ . " end");
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:24,代码来源:download.php
示例10: init
/**
*
* Used to initialize the ui conf deployment like a bootstarp fiel
* @param unknown_type $conf_file_path
*/
public static function init($conf_file_path)
{
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR . "infra" . DIRECTORY_SEPARATOR . "bootstrap_base.php";
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR . "infra" . DIRECTORY_SEPARATOR . "kConf.php";
define("KALTURA_API_PATH", KALTURA_ROOT_PATH . DIRECTORY_SEPARATOR . "api_v3");
// Autoloader
require_once KALTURA_INFRA_PATH . DIRECTORY_SEPARATOR . "KAutoloader.php";
KAutoloader::addClassPath(KAutoloader::buildPath(KALTURA_ROOT_PATH, "vendor", "propel", "*"));
KAutoloader::addClassPath(KAutoloader::buildPath(KALTURA_API_PATH, "lib", "*"));
KAutoloader::addClassPath(KAutoloader::buildPath(KALTURA_API_PATH, "services", "*"));
KAutoloader::addClassPath(KAutoloader::buildPath(KALTURA_ROOT_PATH, "alpha", "plugins", "*"));
// needed for testmeDoc
KAutoloader::addClassPath(KAutoloader::buildPath(KALTURA_ROOT_PATH, "plugins", "*"));
KAutoloader::addClassPath(KAutoloader::buildPath(KALTURA_ROOT_PATH, "generator"));
// needed for testmeDoc
KAutoloader::setClassMapFilePath(kConf::get("cache_root_path") . '/deploy/' . basename(__FILE__) . '.cache');
//KAutoloader::dumpExtra();
KAutoloader::register();
$dbConf = kConf::getDB();
DbManager::setConfig($dbConf);
DbManager::initialize();
date_default_timezone_set(kConf::get("date_default_timezone"));
// try
// {
$confObj = new Zend_Config_Ini($conf_file_path);
// }
// catch(Exception $ex)
// {
// echo 'Exiting on ERROR: '.$ex->getMessage().PHP_EOL;
// exit(1);
// }
return $confObj;
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:38,代码来源:deploy_v2.php
示例11: init
public static function init($conf_file_path)
{
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR . "infra" . DIRECTORY_SEPARATOR . "bootstrap_base.php";
require_once SF_ROOT_DIR . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'kConf.php';
define("KALTURA_API_PATH", KALTURA_ROOT_PATH . DIRECTORY_SEPARATOR . "api_v3");
// Autoloader
require_once KALTURA_INFRA_PATH . DIRECTORY_SEPARATOR . "KAutoloader.php";
KAutoloader::addClassPath(KAutoloader::buildPath(KALTURA_ROOT_PATH, "vendor", "propel", "*"));
KAutoloader::addClassPath(KAutoloader::buildPath(KALTURA_API_PATH, "lib", "*"));
KAutoloader::addClassPath(KAutoloader::buildPath(KALTURA_API_PATH, "services", "*"));
KAutoloader::addClassPath(KAutoloader::buildPath(KALTURA_ROOT_PATH, "alpha", "plugins", "*"));
// needed for testmeDoc
KAutoloader::addClassPath(KAutoloader::buildPath(KALTURA_ROOT_PATH, "plugins", "*"));
KAutoloader::addClassPath(KAutoloader::buildPath(KALTURA_ROOT_PATH, "generator"));
// needed for testmeDoc
KAutoloader::setClassMapFilePath(kConf::get("cache_root_path") . '/deploy/classMap.cache');
//KAutoloader::dumpExtra();
KAutoloader::register();
$dbConf = kConf::getDB();
DbManager::setConfig($dbConf);
DbManager::initialize();
$conf = parse_ini_file($conf_file_path, true);
$confObj = new Zend_Config_Ini($conf_file_path);
return $confObj;
}
开发者ID:richhl,项目名称:kalturaCE,代码行数:25,代码来源:deploy.php
示例12: initClassMap
protected function initClassMap()
{
if ($this->_classMap !== null) {
return;
}
$classMapFileLocation = KAutoloader::getClassMapFilePath();
$this->_classMap = unserialize(file_get_contents($classMapFileLocation));
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:8,代码来源:ClientGeneratorFromPhp.php
示例13: loadChildTypes
private function loadChildTypes(KalturaTypeReflector $typeReflector)
{
$typesDir = KALTURA_ROOT_PATH . DIRECTORY_SEPARATOR . "api_v3" . DIRECTORY_SEPARATOR . "lib" . DIRECTORY_SEPARATOR . "types" . DIRECTORY_SEPARATOR;
$typesDir = realpath($typesDir);
$classMapFileLcoation = KAutoloader::getClassMapFilePath();
$classMap = unserialize(file_get_contents($classMapFileLcoation));
foreach ($classMap as $class => $path) {
if (strpos($path, $typesDir) === 0) {
$reflector = new ReflectionClass($class);
if ($class == 'KalturaFileSyncFilter') {
continue;
}
if ($reflector->isSubclassOf($typeReflector->getType())) {
$classTypeReflector = KalturaTypeReflectorCacher::get($class);
if ($classTypeReflector) {
$this->loadTypesRecursive($classTypeReflector);
}
}
}
}
}
开发者ID:richhl,项目名称:kalturaCE,代码行数:21,代码来源:ClientGeneratorFromPhp.php
示例14: microtime
<?php
require_once "../../bootstrap.php";
KalturaLog::setContext("TESTME");
$type = $_GET["type"];
$bench_start = microtime(true);
KalturaLog::INFO(">------- api_v3 testme type [{$type}]-------");
function toArrayRecursive(KalturaPropertyInfo $propInfo)
{
return $propInfo->toArray(true);
}
$subClasses = array();
try {
KalturaTypeReflector::setClassInheritMapPath(KAutoloader::buildPath(kConf::get("cache_root_path"), "api_v3", "KalturaClassInheritMap.cache"));
if (!KalturaTypeReflector::hasClassInheritMapCache()) {
$config = new Zend_Config_Ini("../../config/testme.ini");
$indexConfig = $config->get('testme');
$include = $indexConfig->get("include");
$exclude = $indexConfig->get("exclude");
$excludePaths = $indexConfig->get("excludepaths");
$additional = $indexConfig->get("additional");
$clientGenerator = new DummyForDocsClientGenerator();
$clientGenerator->setIncludeOrExcludeList($include, $exclude, $excludePaths);
$clientGenerator->setAdditionalList($additional);
$clientGenerator->load();
$objects = $clientGenerator->getTypes();
KalturaTypeReflector::setClassMap(array_keys($objects));
}
$subClassesNames = KalturaTypeReflector::getSubClasses($type);
foreach ($subClassesNames as $subClassName) {
$subClass = new KalturaPropertyInfo($subClassName);
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:31,代码来源:ajax-get-type-subclasses.php
示例15: 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
示例16: init
function init($conf_file_path, $infra_path)
{
$conf = parse_ini_file($conf_file_path, true);
require_once KALTURA_ROOT_PATH . DIRECTORY_SEPARATOR . "infra" . DIRECTORY_SEPARATOR . "KAutoloader.php";
KAutoloader::setIncludePath(array(KAutoloader::buildPath(KALTURA_ROOT_PATH, "vendor", "ZendFramework", "library")));
KAutoloader::register();
$confObj = new Zend_Config_Ini($conf_file_path);
return $confObj;
}
开发者ID:DBezemer,项目名称:server,代码行数:9,代码来源:deploy_client.php
示例17: writeAfterService
protected function writeAfterService(KalturaServiceReflector $serviceReflector)
{
$this->writeTest("\t/**");
$this->writeTest("\t * Called when all tests are done");
$this->writeTest("\t * @param int \$id");
$this->writeTest("\t * @return int");
$this->writeTest("\t * @depends {$this->lastDependencyTest} - TODO: replace {$this->lastDependencyTest} with last test function that uses that id");
$this->writeTest("\t */");
$this->writeTest("\tpublic function testFinished(\$id)");
$this->writeTest("\t{");
$this->writeTest("\t\treturn \$id;");
$this->writeTest("\t}");
$this->writeTest("");
$this->writeTest("}");
$this->writeBase("\t/**");
$this->writeBase("\t * Called when all tests are done");
$this->writeBase("\t * @param int \$id");
$this->writeBase("\t * @return int");
$this->writeBase("\t */");
$this->writeBase("\tabstract public function testFinished(\$id);");
$this->writeBase("");
$this->writeBase("}");
$serviceName = $serviceReflector->getServiceName();
$serviceClass = $serviceReflector->getServiceClass();
$testPath = realpath(dirname(__FILE__) . '/../') . "/tests/api/{$serviceName}";
if ($serviceReflector->isFromPlugin()) {
$servicePath = KAutoloader::getClassFilePath($serviceClass);
$testPath = realpath(dirname($servicePath) . '/../') . "/tests/services/{$serviceName}";
}
$this->writeToFile("{$testPath}/{$serviceClass}BaseTest.php", $this->_txtBase);
$this->writeToFile("{$testPath}/{$serviceClass}Test.php", $this->_txtTest, false);
$this->writeToFile("{$testPath}/{$serviceClass}Test.php.ini", $this->_txtIni, false);
}
开发者ID:richhl,项目名称:kalturaCE,代码行数:33,代码来源:UnitTestsGenerator.php
示例18: autoload
public function autoload($class)
{
KAutoloader::autoload($class);
}
开发者ID:richhl,项目名称:kalturaCE,代码行数:4,代码来源:InfraLoader.php
示例19: 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
示例20: initClassMap
protected function initClassMap()
{
if ($this->_classMap !== null) {
return;
}
$this->_classMap = KAutoloader::getClassMap();
}
开发者ID:AdiTal,项目名称:server,代码行数:7,代码来源:ClientGeneratorFromPhp.php
注:本文中的KAutoloader类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论