本文整理汇总了PHP中Psc\Code\Code::expandNamespace方法的典型用法代码示例。如果您正苦于以下问题:PHP Code::expandNamespace方法的具体用法?PHP Code::expandNamespace怎么用?PHP Code::expandNamespace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Psc\Code\Code
的用法示例。
在下文中一共展示了Code::expandNamespace方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createComponent
public function createComponent($class)
{
$class = Code::expandNamespace($class, 'Psc\\UI\\Component');
$component = new $class();
$this->manager->dispatchEvent(self::EVENT_COMPONENT_CREATED, array('component' => $component, 'componentClass' => $class), $this);
return $component;
}
示例2: assertTypeMapsComponent
protected function assertTypeMapsComponent($class, WebforgeType $type, $mapper = NULL)
{
$mapper = $mapper ?: new ComponentMapper();
$this->assertInstanceOf('Psc\\CMS\\Component', $component = $mapper->inferComponent($type));
if ($class !== 'any') {
$class = Code::expandNamespace($class, 'Psc\\UI\\Component');
$this->assertInstanceOf($class, $component);
}
return $component;
}
示例3: array
use Webforge\Setup\ConfigurationTester\ConfigurationTester;
use Psc\System\System;
use Psc\Code\Generate\ClassWriter;
use Webforge\Common\JS\JSONConverter;
use Psc\JS\jQuery;
use Seld\JsonLint\JsonParser;
/**
*
* $createCommand = function ($name, array|closure $configure, closure $execute) {
*
* $arg = function ($name, $description = NULL, $required = TRUE) // default: required
* $opt = function($name, $short = NULL, $withValue = TRUE, $description = NULL) // default: mit value required
* $flag = function($name, $short = NULL, $description) // ohne value
*/
$createCommand('compile:komodo-command-call', array($arg('extension-name')), function ($input, $output, $command) {
$extensionClass = Code::expandNamespace(\Webforge\Common\String::expand($input->getArgument('extension-name'), 'Extension'), 'Psc\\Code\\Compile');
$extension = GClass::factory($extensionClass);
$fields = array();
if ($extension->hasMethod('__construct')) {
foreach ($extension->getMethod('__construct')->getParameters() as $param) {
$fields[] = $param->getName();
}
}
// das nimmt vielleicht zu viele, weis nicht, alternativ würds auch ne statische methode zur extension tun
foreach ($extension->getProperties() as $property) {
$fields[] = $property->getName();
}
$json = array();
foreach (array_unique($fields) as $field) {
$json[$field] = '%(ask:' . $field . ')';
}
示例4: assertInstanceOfL
protected function assertInstanceOfL($element, $actual, $msg = '')
{
$element = Code::expandNamespace('L' . $element, 'Psc\\Code\\AST');
return $this->assertInstanceOf($element, $actual, $msg);
}
示例5: getEntityName
/**
* Gibt die Klasse (den vollen Namen) eines Entities zurück
*
* speaker => 'projectNamespace\Entities\Speaker'
* oid => 'projectNamespace\Entities\OID'
*
* Dies wird z.B. für die Umwandlung von entity-bezeichnern in URLs in echte Klassen gebraucht.
* Irreguläre Namen (sowas wie OID) können in $this->getEntityNames() eingetragen werden
*
* @param string $input kann ein Name in LowerCase sein, eine volle Klasse oder auch ein TabsContentItem2::getTabsResourceName() sein
*/
public function getEntityName($input)
{
if (is_string($input)) {
if (array_key_exists($input, $names = $this->getEntityNames())) {
$name = $names[$input];
} elseif (mb_strpos($input, '\\') === FALSE) {
$name = \Webforge\Common\String::ucfirst($input);
} else {
$name = $input;
}
return Code::expandNamespace($name, $this->getEntitiesNamespace());
}
throw new \Psc\Exception('unbekannter Fall für getEntityName. Input ist: ' . Code::varInfo($input));
}
示例6: parseExtensionGClass
protected function parseExtensionGClass($input)
{
$extensionClass = Code::expandNamespace(\Webforge\Common\String::expand($input->getArgument('name'), 'Extension'), 'Psc\\Code\\Compile');
return GClass::factory($extensionClass);
}
示例7: createTask
/**
* wird automatisch mit dependencies erstellt
* @param string $name der Name des Tasks ohne Namespace und "Task" dahinter
*/
public function createTask($name)
{
$this->init();
$class = Code::expandNamespace(\Webforge\Common\String::expand($name, 'Task'), 'Psc\\System\\Deploy');
$gClass = GClass::factory($class);
$params = array();
if ($gClass->hasMethod('__construct')) {
$constructor = $gClass->getMethod('__construct');
foreach ($constructor->getParameters() as $parameter) {
$params[] = $this->resolveTaskDependency($parameter, $gClass);
}
}
return $gClass->newInstance($params);
}
示例8: testExpandNamespace
/**
* @dataProvider provideTestExpandNamespace
* @group expandnamespace
*/
public function testExpandNamespace($expectedClass, $candidate, $expandNamespace)
{
$this->assertEquals($expectedClass, Code::expandNamespace($candidate, $expandNamespace));
}