Ejemplo n.º 1
0
 /**
  * @return PortNumber
  */
 public function getPortNumber()
 {
     return $this->portNumber->toNative();
 }
Ejemplo n.º 2
0
$app->register(new UserPermissionsServiceProvider());
$app->register(new \CultuurNet\UDB3\Silex\DoctrineMigrationsServiceProvider(), ['migrations.config_file' => __DIR__ . '/migrations.yml']);
// Add the oauth service provider.
$app->register(new OAuthServiceProvider(), array('oauth.fetcher.base_url' => $app['config']['oauth']['base_url'], 'oauth.fetcher.consumer' => $app['config']['oauth']['consumer']));
$app->register(new \CultuurNet\UDB3\Silex\Media\MediaServiceProvider(), array('media.upload_directory' => $app['config']['media']['upload_directory'], 'media.media_directory' => $app['config']['media']['media_directory'], 'media.file_size_limit' => new \ValueObjects\Number\Natural(isset($app['config']['media']['file_size_limit']) ? $app['config']['media']['file_size_limit'] : 1000000)));
$app['predis.client'] = $app->share(function ($app) {
    $redisURI = isset($app['config']['redis']['uri']) ? $app['config']['redis']['uri'] : 'tcp://127.0.0.1:6379';
    return new Predis\Client($redisURI);
});
$app['oauth.model.provider.nonce_provider'] = $app->share(function (Application $app) {
    return new NonceProvider($app['predis.client']);
});
$app->extend('oauth.model.provider.token_provider', function (TokenProviderInterface $tokenProvider, Application $app) {
    return new TokenProviderCache($tokenProvider, $app['predis.client']);
});
$app['entryapi.link_base_url'] = $app->share(function (Application $app) {
    return $app['config']['entryapi']['link_base_url'];
});
$app['cdbxml_proxy'] = $app->share(function ($app) {
    $accept = new StringLiteral($app['config']['cdbxml_proxy']['accept']);
    /** @var \ValueObjects\Web\Hostname $redirectDomain */
    $redirectDomain = \ValueObjects\Web\Hostname::fromNative($app['config']['cdbxml_proxy']['redirect_domain']);
    /** @var \ValueObjects\Web\Hostname $redirectDomain */
    $redirectPort = \ValueObjects\Web\PortNumber::fromNative($app['config']['cdbxml_proxy']['redirect_port']);
    return new \CultuurNet\UDB3\Symfony\Proxy\CdbXmlProxy($accept, $redirectDomain, $redirectPort, new \Symfony\Bridge\PsrHttpMessage\Factory\DiactorosFactory(), new \Symfony\Bridge\PsrHttpMessage\Factory\HttpFoundationFactory(), new \GuzzleHttp\Client());
});
$app->register(new \CultuurNet\UDB3\Silex\Search\SAPISearchServiceProvider());
$app->register(new \CultuurNet\UDB3\Silex\Offer\BulkLabelOfferServiceProvider());
$app->register(new \TwoDotsTwice\SilexFeatureToggles\FeatureTogglesProvider(isset($app['config']['toggles']) ? $app['config']['toggles'] : []));
$app->register(new \CultuurNet\UDB3\Silex\UDB2IncomingEventServicesProvider(), ['udb2_place_external_id_mapping.yml_file_location' => $udb3ConfigLocation . '/external_id_mapping_place.yml', 'udb2_organizer_external_id_mapping.yml_file_location' => $udb3ConfigLocation . '/external_id_mapping_organizer.yml', 'udb2_cdbxml_enricher.http_response_timeout' => isset($app['config']['udb2_cdbxml_enricher']['http_response_timeout']) ? $app['config']['udb2_cdbxml_enricher']['http_response_timeout'] : 3, 'udb2_cdbxml_enricher.http_connect_timeout' => isset($app['config']['udb2_cdbxml_enricher']['http_connect_timeout']) ? $app['config']['udb2_cdbxml_enricher']['http_connect_timeout'] : 1]);
return $app;