private function __construct() { //load service providers $directory = __DIR__ . DIRECTORY_SEPARATOR . 'tzproviders'; $namespace = __NAMESPACE__ . '\\' . 'tzproviders'; $packageScanner = new \PackageScanner($directory, $namespace, TimeZoneServiceProvider::getClass(), false); foreach ($packageScanner->getAllInstantiable() as $providerClass) { $this->providers[] = $providerClass->newInstance(); } shuffle($this->providers); }
private function __construct() { $serviceProvidersDir = __DIR__ . DS . 'locationproviders'; $ns = __NAMESPACE__ . '\\locationproviders'; $scanner = new \PackageScanner($serviceProvidersDir, $ns, LocationServiceProvider::getClass()); foreach ($scanner->getAllInstantiable() as $provider) { $this->serviceProviderList[] = $provider->newInstance(); } if (!count($this->serviceProviderList)) { throw new \InvalidArgumentException("There are no service providers defined."); } //\ComparableObjectSorter::sort($this->serviceProviderList, false, true); shuffle($this->serviceProviderList); $this->geocodeCachedManager = \models\entities\GeocodeCached::manager(); }
private function __construct() { //load providers $serviceProvidersDir = __DIR__ . DS . 'showtimeproviders'; $namespace = __NAMESPACE__ . '\\' . 'showtimeproviders'; $scanner = new \PackageScanner($serviceProvidersDir, $namespace, ShowtimeServiceProvider::getClass()); foreach ($scanner->getAllInstantiable() as $provider) { $this->serviceProviderList[] = $provider->newInstance(); } if (!count($this->serviceProviderList)) { throw new InvalidArgumentException("There are no service providers defined for showtimes."); } //ComparableObjectSorter::sort($this->serviceProviderList, false, true); shuffle($this->serviceProviderList); //initialize showtime manager $this->showtimeManager = Showtime::manager(); $this->theatreManager = Theatre::manager(); $this->theatreNearByManager = TheatreNearby::manager(); }