getSrcNamespace() public method

public getSrcNamespace ( ) : string
return string
Esempio n. 1
0
 /**
  * @param Resource $resource
  * @param string            $filepath
  *
  * @return string
  */
 protected function renderTemplate(Resource $resource, $filepath)
 {
     $values = array('%filepath%' => $filepath, '%name%' => $resource->getName(), '%namespace%' => $resource->getSrcNamespace(), '%namespace_block%' => '' !== $resource->getSrcNamespace() ? sprintf("\n\nnamespace %s;", $resource->getSrcNamespace()) : '');
     if (!($content = $this->getTemplateRenderer()->render('class', $values))) {
         $content = $this->getTemplateRenderer()->renderString($this->getTemplate(), $values);
     }
     return $content;
 }
 function it_calls_the_command_bus(CommandBus $commandBus, Resource $resource)
 {
     $resource->getSrcFilename()->willReturn(self::FILE_NAME);
     $resource->getSrcNamespace()->willReturn(self::NAME_SPACE);
     $resource->getSrcClassname()->willReturn(self::CLASS_NAME);
     $data = ['name' => self::METHOD_NAME, 'arguments' => []];
     $command = Argument::type(GenerateConstructor::class);
     $commandBus->handle($command)->shouldbeCalled();
     $this->generate($resource, $data);
 }
Esempio n. 3
0
 function it_records_that_class_was_created_in_executioncontext(Resource $resource, ExecutionContext $executionContext)
 {
     $resource->getName()->willReturn('App');
     $resource->getSrcFilename()->willReturn('/project/src/Acme/App.php');
     $resource->getSrcNamespace()->willReturn('Acme');
     $resource->getSrcClassname()->willReturn('Acme\\App');
     $this->generate($resource);
     $executionContext->addGeneratedType('Acme\\App')->shouldHaveBeenCalled();
 }