Code Duplication    Length = 13-13 lines in 2 locations

src/Plugins/BasePlugin.php 1 location

@@ 202-214 (lines=13) @@
199
     * @param string $defaultClass the class to use if none is set in config.
200
     * @return object the service-activator instance
201
     */
202
    public function createServiceActivator($config, $defaultClass = false){
203
        $method = (string)$config['method'];
204
        $service = $this->context->getServiceProvider()->provideService((string)$config['ref']);
205
        if($method && $service){
206
            $args = $this->getReplyHandlerArguments($config);
207
            array_unshift($args,array(
208
                $service,
209
                $method
210
            ));
211
            $defaultClass = $defaultClass ? $defaultClass : '\PEIP\Service\ServiceActivator';
212
            return $this->buildAndModify($config, $args, $defaultClass);
213
        }
214
    }
215
216
217
    /**

src/Context/XMLContext.php 1 location

@@ 544-556 (lines=13) @@
541
     * @param string $defaultClass the class to use if none is set in config. 
542
     * @return object the service-activator instance
543
     */
544
    public function createServiceActivator($config, $defaultClass = false){
545
        $method = (string)$config['method'];
546
        $service = $this->getService((string)$config['ref']);
547
        if($method && $service){        
548
            $args = $this->getReplyHandlerArguments($config);
549
            array_unshift($args,array(
550
                $service,
551
                $method             
552
            )); 
553
            $defaultClass = $defaultClass ? $defaultClass : 'ServiceActivator';
554
            return ServiceFactory::buildAndModify($config, $args, $defaultClass);                
555
        }
556
    }   
557
    
558
    
559
    /**