src/DefinitionConverter.php
public function convert(?string $identifier, $definition)
    {
        if ($definition instanceof ObjectDefinitionInterface) {
            $yacoObjectDefinition = new ObjectDefinition($identifier,
                $definition->getClassName(),
                $this->convertArguments($definition->getConstructorArguments()));

            foreach ($definition->getPropertyAssignments() as $assignment) {
                $yacoObjectDefinition->setProperty($assignment->getPropertyName(), $this->convertValue($assignment->getValue()));
            }

            foreach ($definition->getMethodCalls() as $methodCall) {
                $yacoObjectDefinition->addMethodCall($methodCall->getMethodName(), $this->convertArguments($methodCall->getArguments()));
            }

            return $yacoObjectDefinition;
        } elseif ($definition instanceof FactoryCallDefinitionInterface) {
            return new FactoryCallDefinition($identifier,
                $this->convertValue($definition->getFactory()),
                $definition->getMethodName(),
                $this->convertArguments($definition->getArguments()));
        } elseif ($definition instanceof ParameterDefinitionInterface) {
            return new ParameterDefinition($identifier, $this->convertValue($definition->getValue()));
        } elseif ($definition instanceof ReferenceDefinitionInterface) {
            if ($identifier !== null) {
                return new AliasDefinition($identifier, $definition->getTarget());
            } else {
                return new Reference($definition->getTarget());
            }
        } elseif (is_scalar($definition) || is_array($definition)) {
            return new ParameterDefinition($identifier, $this->convertValue($definition));
        } else {
            throw new \RuntimeException(sprintf('Cannot convert object of type "%s"', get_class($definition)));
        }
    }
public function convert(?string $identifier, $definition)
    {
        if ($definition instanceof ObjectDefinitionInterface) {
            $yacoObjectDefinition = new ObjectDefinition($identifier,
                $definition->getClassName(),
                $this->convertArguments($definition->getConstructorArguments()));

            foreach ($definition->getPropertyAssignments() as $assignment) {
                $yacoObjectDefinition->setProperty($assignment->getPropertyName(), $this->convertValue($assignment->getValue()));
            }

            foreach ($definition->getMethodCalls() as $methodCall) {
                $yacoObjectDefinition->addMethodCall($methodCall->getMethodName(), $this->convertArguments($methodCall->getArguments()));
            }

            return $yacoObjectDefinition;
        } elseif ($definition instanceof FactoryCallDefinitionInterface) {
            return new FactoryCallDefinition($identifier,
                $this->convertValue($definition->getFactory()),
                $definition->getMethodName(),
                $this->convertArguments($definition->getArguments()));
        } elseif ($definition instanceof ParameterDefinitionInterface) {
            return new ParameterDefinition($identifier, $this->convertValue($definition->getValue()));
        } elseif ($definition instanceof ReferenceDefinitionInterface) {
            if ($identifier !== null) {
                return new AliasDefinition($identifier, $definition->getTarget());
            } else {
                return new Reference($definition->getTarget());
            }
        } elseif (is_scalar($definition) || is_array($definition)) {
            return new ParameterDefinition($identifier, $this->convertValue($definition));
        } else {
            throw new \RuntimeException(sprintf('Cannot convert object of type "%s"', get_class($definition)));
        }
    }
@param string|null               $identifier
@param DefinitionInterface|mixed $definition

@return AliasDefinition|FactoryCallDefinition|ObjectDefinition|ParameterDefinition|Reference