/** * @param \ReflectionProperty[]|\ReflectionMethod[] $sourceMembers * @param MappingOptionsInterface $mappingOptions * @throws \Papper\NotSupportedException * @return MemberGetterInterface */ public function createMemberGetter(array $sourceMembers, MappingOptionsInterface $mappingOptions) { if (count($sourceMembers) == 1) { return $this->createReflectionGetter($sourceMembers[0]); } $propertyPath = implode('.', array_map(function (\Reflector $member) use($mappingOptions) { /** @var $member \ReflectionProperty|\ReflectionMethod */ return NamingHelper::possibleName($member->name, $mappingOptions->getSourcePrefixes()) ?: $member->getName(); }, $sourceMembers)); return new PropertyAccessGetter($propertyPath); }
private function createNameSnippet(array $matches, $i, MappingOptionsInterface $mappingOptions) { return array('first' => implode($mappingOptions->getSourceMemberNamingConvention()->getSeparatorCharacter(), array_slice($matches, 0, $i)), 'second' => implode($mappingOptions->getSourceMemberNamingConvention()->getSeparatorCharacter(), array_slice($matches, $i))); }