mercredi 24 mai 2017

Class 'OwnerService' not found

So i want to get instance of a given class, this is my code :

class OwnerServiceFactory
{
    protected static $instance;
    protected static $provider;

    public function __construct($provider = 'xxx')
    {
        static::$provider = $provider;
    }

    final public static function getInstance()
    {
        $class = ucfirst(static::$provider)."OwnerService";

        if(!static::$instance) static::$instance = new $class();

        return static::$instance;
    }
}

OwnerService and OwnerServiceFactory classes are already in the same namespace. the problem is in this line if(!static::$instance) static::$instance = new $class();



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2rQmDKr
via IFTTT

Aucun commentaire:

Enregistrer un commentaire