private function getClassType(Parameter $property) { if ($property->hasClass()) { return $property->getClassType()->getName(); } return ''; }
private function createMethodParam(Parameter $param) { $result = $this->builderFactory->param($param->getName()); if ($param->hasClass()) { $result->setTypeHint($param->getClassType()->getName()); } return $result; }
public function it_will_create_source_from_given_class_type_and_aggregate_root_id_param(ClassSourceFactory $sourceFactory, DefinitionFactory $definitionFactory, ClassType $classType, ImprovedClassSource $classSource, Parameter $parameter, ClassType $parameterClassType, CreateMethod $createMethod, AggregateRootIdGetterMethod $aggregateRootIdGetterMethod) { $parameter->getClassType()->willReturn($parameterClassType); $sourceFactory->create($classType)->willReturn($classSource); $definitionFactory->createBroadwayModelCreateMethod($classType, [$parameter])->shouldBeCalled()->willReturn($createMethod); $definitionFactory->createBroadwayModelAggregateRootIdGetterMethod($parameter)->shouldBeCalled()->willReturn($aggregateRootIdGetterMethod); $this->create($classType, $parameter)->shouldReturn($classSource); }
private function createMethodParamWithDefaultValue(Parameter $param, $defaultValue) { $result = $this->builderFactory->param($param->getName()); if ($param->hasClass()) { $result->setTypeHint($param->getClassType()->getName()); } $result->setDefault($defaultValue); return $result; }
private function isParameterEligibleForMethodParameter(Parameter $parameter) { if (false === $parameter->hasClass()) { return false; } if ($parameter->getClassType() instanceof TypeDeclaration) { return false; } return true; }
public function it_will_not_show_type_declaration_params_from_constructor_in_imports(ConstructorMethod $constructor, Parameter $param, TypeDeclaration $typeDeclaration) { $constructor->getMethodParameters()->willReturn([$param]); $param->hasClass()->willReturn(true); $param->getClassType()->willReturn($typeDeclaration); $this->addConstructorMethod($constructor)->shouldReturn($this); $this->getImports()->shouldReturn([]); }