예제 #1
0
 /**
  * @param ExtensionType $type
  *
  * @return Call
  */
 public function visitExtensionType(ExtensionType $type)
 {
     $this->typeCheck->visitExtensionType(func_get_args());
     $extension = $this->extensionLoader->load($type->className()->string());
     $closure = $extension->generateTypeCheck($this, $type);
     $call = new Call($closure);
     $call->add($this->valueExpression());
     return $call;
 }
예제 #2
0
 /**
  * Visit an extension type.
  *
  * @param ExtensionType $type The type.
  *
  * @return mixed The result of visitation.
  */
 public function visitExtensionType(ExtensionType $type)
 {
     $string = ':' . $type->className();
     if (0 !== count($type->types())) {
         $subTypes = array();
         foreach ($type->types() as $subType) {
             $subTypes[] = $subType->accept($this);
         }
         $string .= sprintf('<%s>', implode(',', $subTypes));
     }
     if (0 !== count($type->attributes())) {
         $attributes = array();
         foreach ($type->attributes() as $key => $value) {
             $attributes[] = $key . ':' . var_export($value, true);
         }
         $string .= sprintf('{%s}', implode(',', $attributes));
     }
     return $string;
 }