コード例 #1
0
ファイル: ComponentMapper.php プロジェクト: pscheit/psc-cms
 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
0
ファイル: TestCase.php プロジェクト: pscheit/psc-cms
 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
0
ファイル: inc.commands.php プロジェクト: pscheit/psc-cms
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
0
ファイル: ParserTest.php プロジェクト: pscheit/psc-cms
 protected function assertInstanceOfL($element, $actual, $msg = '')
 {
     $element = Code::expandNamespace('L' . $element, 'Psc\\Code\\AST');
     return $this->assertInstanceOf($element, $actual, $msg);
 }
コード例 #5
0
ファイル: Module.php プロジェクト: pscheit/psc-cms
 /**
  * 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
0
 protected function parseExtensionGClass($input)
 {
     $extensionClass = Code::expandNamespace(\Webforge\Common\String::expand($input->getArgument('name'), 'Extension'), 'Psc\\Code\\Compile');
     return GClass::factory($extensionClass);
 }
コード例 #7
0
ファイル: Deployer.php プロジェクト: pscheit/psc-cms
 /**
  * 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
0
ファイル: CodeTest.php プロジェクト: pscheit/psc-cms
 /**
  * @dataProvider provideTestExpandNamespace
  * @group expandnamespace
  */
 public function testExpandNamespace($expectedClass, $candidate, $expandNamespace)
 {
     $this->assertEquals($expectedClass, Code::expandNamespace($candidate, $expandNamespace));
 }