<?php
/**
 * Created by IntelliJ IDEA.
 * User: damien
 * Date: 18/06/2017
 * Time: 13:46
 */

namespace Actigraph\ActipageBaseBundle\Services;


class ActipageModuleService
{
    private $actipageModuleChain;

    public function __construct(ActipageModuleChain $actipageModuleChain)
    {
        $this->actipageModuleChain = $actipageModuleChain;
    }

    public function call($serviceName,$methode,$params=array()){
        $service = $this->actipageModuleChain->getService($serviceName);
        if($service && method_exists($service,$methode)){
            return call_user_func_array(array($service, $methode), $params);
        }
        return null;
    }
}