Code Duplication    Length = 19-19 lines in 2 locations

src/Plugins/PluginFactory.php 1 location

@@ 77-95 (lines=19) @@
74
        $importAdapter = $this->container->get($pluginConfiguration->getImportAdapter()->getId());
75
76
        // query whether or not we've found a factory or the instance itself
77
        if ($importAdapter instanceof ImportAdapterInterface) {
78
            $pluginInstance->setImportAdapter($importAdapter);
79
            // log a warning, that this is deprecated
80
            $this->getSystemLogger()->warning(
81
                sprintf(
82
                    'Direct injection of import adapter with DI ID "%s" is deprecated since version 3.0.0, please use factory instead',
83
                    $pluginConfiguration->getImportAdapter()->getId()
84
                )
85
            );
86
        } elseif ($importAdapter instanceof ImportAdapterFactoryInterface) {
87
            $pluginInstance->setImportAdapter($importAdapter->createImportAdapter($pluginConfiguration));
88
        } else {
89
            throw new \Exception(
90
                sprintf(
91
                    'Expected either an instance of ImportAdapterInterface or ImportAdapterFactoryInterface for DI ID "%s"',
92
                    $pluginConfiguration->getImportAdapter()->getId()
93
                )
94
            );
95
        }
96
97
        // query whether or not we've a plugin instance that implements the exportable plugin interface
98
        if ($pluginInstance instanceof ExportablePluginInterface) {

src/Subjects/SubjectFactory.php 1 location

@@ 112-130 (lines=19) @@
109
        $importAdapter = $this->container->get($subjectConfiguration->getImportAdapter()->getId());
110
111
        // query whether or not we've found a factory or the instance itself
112
        if ($importAdapter instanceof ImportAdapterInterface) {
113
            $subjectInstance->setImportAdapter($importAdapter);
114
            // log a warning, that this is deprecated
115
            $this->getSystemLogger()->warning(
116
                sprintf(
117
                    'Direct injection of import adapter with DI ID "%s" is deprecated since version 3.0.0, please use factory instead',
118
                    $subjectConfiguration->getImportAdapter()->getId()
119
                )
120
            );
121
        } elseif ($importAdapter instanceof ImportAdapterFactoryInterface) {
122
            $subjectInstance->setImportAdapter($importAdapter->createImportAdapter($subjectConfiguration));
123
        } else {
124
            throw new \Exception(
125
                sprintf(
126
                    'Expected either an instance of ImportAdapterInterface or ImportAdapterFactoryInterface for DI ID "%s"',
127
                    $subjectConfiguration->getImportAdapter()->getId()
128
                )
129
            );
130
        }
131
132
        // query whether or not we've a subject instance that implements the exportable subject interface
133
        if ($subjectInstance instanceof ExportableSubjectInterface) {