Code Duplication    Length = 18-18 lines in 2 locations

src/KGzocha/Bundle/SearcherBundle/DependencyInjection/CompilerPass/DefinitionBuilder.php 2 locations

@@ 70-87 (lines=18) @@
67
     *
68
     * @return Definition
69
     */
70
    private function buildFromService(
71
        ContainerBuilder $container,
72
        $definitionName,
73
        $oldServiceName
74
    ) {
75
        if (!$container->hasDefinition($oldServiceName)) {
76
            throw new InvalidDefinitionException(sprintf(
77
                'Could not create "%s" service, because configured service "%s" does not exist.',
78
                $definitionName,
79
                $oldServiceName
80
            ));
81
        }
82
83
        return $container->setDefinition(
84
            $definitionName,
85
            $container->getDefinition($oldServiceName)
86
        );
87
    }
88
89
    /**
90
     * @param ContainerBuilder $container
@@ 96-113 (lines=18) @@
93
     *
94
     * @return Definition
95
     */
96
    private function buildFromClass(
97
        ContainerBuilder $container,
98
        $definitionName,
99
        $className
100
    ) {
101
        if (!class_exists($className)) {
102
            throw new InvalidDefinitionException(sprintf(
103
                'Could not create service "%s", because class "%s" does not exist.',
104
                $definitionName,
105
                $className
106
            ));
107
        }
108
109
        return $container->setDefinition(
110
            $definitionName,
111
            $this->getDefinition($className)
112
        );
113
    }
114
115
    /**
116
     * @param string $className