canAssemble() public method

public canAssemble ( Phpro\SoapClient\CodeGenerator\Context\ContextInterface $context ) : boolean
$context Phpro\SoapClient\CodeGenerator\Context\ContextInterface
return boolean
Exemplo n.º 1
0
 /**
  * @test
  */
 function it_can_assemble_property_context()
 {
     $assembler = new InterfaceAssembler('MyUsedClass');
     $class = new ClassGenerator('MyType', 'MyNamespace');
     $type = new Type('MyNamespace', 'MyType', []);
     $property = new Property('prop1', 'string');
     $context = new PropertyContext($class, $type, $property);
     $this->assertTrue($assembler->canAssemble($context));
 }
Exemplo n.º 2
0
 /**
  * @param ContextInterface|TypeContext $context
  *
  * @throws AssemblerException
  */
 public function assemble(ContextInterface $context)
 {
     try {
         $interfaceAssembler = new InterfaceAssembler(RequestInterface::class);
         if ($interfaceAssembler->canAssemble($context)) {
             $interfaceAssembler->assemble($context);
         }
     } catch (\Exception $e) {
         throw AssemblerException::fromException($e);
     }
 }
Exemplo n.º 3
0
 /**
  * @param ContextInterface|TypeContext $context
  *
  * @throws AssemblerException
  */
 public function assemble(ContextInterface $context)
 {
     $class = $context->getClass();
     $properties = $context->getType()->getProperties();
     $firstProperty = count($properties) ? current($properties) : null;
     try {
         $interfaceAssembler = new InterfaceAssembler(\IteratorAggregate::class);
         if ($interfaceAssembler->canAssemble($context)) {
             $interfaceAssembler->assemble($context);
         }
         if ($firstProperty) {
             $this->implementGetIterator($class, $firstProperty);
         }
     } catch (\Exception $e) {
         throw AssemblerException::fromException($e);
     }
 }