getParameter() public méthode

Gets a parameter.
public getParameter ( string $name ) : mixed
$name string The parameter name
Résultat mixed The parameter value
 /**
  * Invoked to modify the controller that should be executed.
  *
  * @param GetResponseEvent $event The event
  * 
  * @access public
  * @return null|void
  * @author Etienne de Longeaux <*****@*****.**>
  */
 public function onKernelRequest(GetResponseEvent $event)
 {
     if (HttpKernel::MASTER_REQUEST != $event->getRequestType()) {
         // ne rien faire si ce n'est pas la requête principale
         return;
     }
     $this->request = $event->getRequest($event);
     //if (!$this->request->hasPreviousSession()) {
     //    return;
     //}
     // print_r('priority 1');
     // we set locale
     $locale = $this->request->cookies->has('_locale');
     $localevalue = $this->request->cookies->get('_locale');
     $is_switch_language_browser_authorized = $this->container->getParameter('sfynx.auth.browser.switch_language_authorized');
     // Sets the user local value.
     if ($is_switch_language_browser_authorized && !$locale) {
         $lang_value = $this->container->get('request')->getPreferredLanguage();
         $all_locales = $this->container->get('sfynx.auth.locale_manager')->getAllLocales();
         if (in_array($lang_value, $all_locales)) {
             $this->request->setLocale($lang_value);
             $_GET['_locale'] = $lang_value;
             return;
         }
     }
     if ($locale && !empty($localevalue)) {
         $this->request->attributes->set('_locale', $localevalue);
         $this->request->setLocale($localevalue);
         $_GET['_locale'] = $localevalue;
     } else {
         $this->request->attributes->set('_locale', $this->defaultLocale);
         $this->request->setLocale($this->defaultLocale);
         $_GET['_locale'] = $this->defaultLocale;
     }
 }
Exemple #2
0
 /**
  * {@inheritDoc}
  */
 public function load(ObjectManager $manager)
 {
     $entity = new Office();
     $entity->setName('En Office');
     $entity->setAlias('en');
     $entity->setEmail('*****@*****.**');
     $entity->setProtocol('http');
     $entity->setHost($this->container->getParameter('hosts.root'));
     $entity->setRelatedUrl(null);
     $entity->setDefaultLanguage('en');
     $entity->setRecognizeLanguage('en');
     $entity->setAvailableLanguages(['en', 'ru']);
     $entity->setCurrencies(['EUR', 'USD']);
     $entity->setIncludeLangInUrl(false);
     $manager->persist($entity);
     $entity = new Office();
     $entity->setName('Ru Office');
     $entity->setAlias('ru');
     $entity->setEmail('*****@*****.**');
     $entity->setProtocol('http');
     $entity->setHost($this->container->getParameter('hosts.root'));
     $entity->setRelatedUrl(null);
     $entity->setDefaultLanguage('ru');
     $entity->setRecognizeLanguage('ru');
     $entity->setAvailableLanguages(['en', 'ru']);
     $entity->setCurrencies(['EUR', 'USD', 'RUB']);
     $manager->persist($entity);
     $manager->flush();
 }
 /**
  * GeoExporter constructor.
  * @param ContainerInterface $container
  */
 public function __construct(ContainerInterface $container)
 {
     $this->container = $container;
     $this->locations = $this->container->getParameter("locations");
     $this->dispatcher = new EventDispatcher();
     //var_dump($this->locations);
 }
 /**
  * @param ObjectManager|EntityManager $manager
  */
 public function load(ObjectManager $manager)
 {
     $settingsProvider = $this->container->get('orocrm_channel.provider.settings_provider');
     $lifetimeSettings = $settingsProvider->getLifetimeValueSettings();
     if (!array_key_exists(ChannelType::TYPE, $lifetimeSettings)) {
         return;
     }
     $magentoChannelSettings = $lifetimeSettings[ChannelType::TYPE];
     $customerIdentityClass = $magentoChannelSettings['entity'];
     $lifetimeField = $magentoChannelSettings['field'];
     $accountClass = $this->container->getParameter('orocrm_account.account.entity.class');
     $channelClass = $this->container->getParameter('orocrm_channel.entity.class');
     /** @var LifetimeHistoryRepository $lifetimeRepo */
     $lifetimeRepo = $manager->getRepository('OroCRMChannelBundle:LifetimeValueHistory');
     $brokenAccountQb = $this->getBrokenAccountsQueryBuilder($customerIdentityClass, $lifetimeField, $lifetimeRepo);
     $brokenAccountsData = new BufferedQueryResultIterator($brokenAccountQb);
     $toOutDate = [];
     foreach ($brokenAccountsData as $brokenDataRow) {
         /** @var Account $account */
         $account = $manager->getReference($accountClass, $brokenDataRow['account_id']);
         /** @var Channel $channel */
         $channel = $manager->getReference($channelClass, $brokenDataRow['channel_id']);
         $lifetimeAmount = $lifetimeRepo->calculateAccountLifetime($customerIdentityClass, $lifetimeField, $account, $channel);
         $history = new LifetimeValueHistory();
         $history->setAmount($lifetimeAmount);
         $history->setDataChannel($channel);
         $history->setAccount($account);
         $manager->persist($history);
         $toOutDate[] = [$account, $channel, $history];
     }
     $manager->flush();
     foreach (array_chunk($toOutDate, self::MAX_UPDATE_CHUNK_SIZE) as $chunks) {
         $lifetimeRepo->massStatusUpdate($chunks);
     }
 }
 public function testDefaultServicesAndParamsLookOkay()
 {
     $api = $this->container->get('amara_one_hydra.api');
     $this->assertInstanceOf(Api::class, $api);
     $httpRequestBuilder = $this->container->get('amara_one_hydra.api.http_request_builder');
     $this->assertInstanceOf(HttpRequestBuilder::class, $httpRequestBuilder);
     $transportGuzzle = $this->container->get('amara_one_hydra.api.transport.guzzle');
     $this->assertInstanceOf(GuzzleTransport::class, $transportGuzzle);
     $resultBuilderEngine = $this->container->get('amara_one_hydra.api.result_builder_engine');
     $this->assertInstanceOf(ResultBuilderEngine::class, $resultBuilderEngine);
     $guzzleClient = $this->container->get('amara_one_hydra.api.guzzle_client');
     $this->assertInstanceOf(Client::class, $guzzleClient);
     $pageManager = $this->container->get('amara_one_hydra.page_manager');
     $this->assertInstanceOf(PageManager::class, $pageManager);
     $pageStorage = $this->container->get('amara_one_hydra.page_storage');
     $this->assertInstanceOf(PageStorage::class, $pageStorage);
     $pageTransformStrategy = $this->container->get('amara_one_hydra.page_transform_strategy');
     $this->assertInstanceOf(DefaultPageTransformStrategy::class, $pageTransformStrategy);
     $twigExtension = $this->container->get('twig.onehydra_extension.default');
     $this->assertInstanceOf(OneHydraExtension::class, $twigExtension);
     $this->assertEquals(true, $this->container->getParameter('amara_one_hydra.is_uat'));
     $this->assertEquals(false, $this->container->getParameter('amara_one_hydra.is_not_uat'));
     $this->assertEquals('PT15M', $this->container->getParameter('amara_one_hydra.dateinterval'));
     $this->assertEquals(['example' => ['auth_token' => 'authtoken1'], 'example2' => ['auth_token' => 'authtoken2']], $this->container->getParameter('amara_one_hydra.programs'));
 }
Exemple #6
0
 public function load(ObjectManager $manager)
 {
     $yaml = new Parser();
     $symbonfy_base_dir = $this->container->getParameter('kernel.root_dir');
     $data_dir = $symbonfy_base_dir . '/Resources/data/';
     try {
         $value = Yaml::parse(file_get_contents($data_dir . 'tasks.yml'));
     } catch (ParseException $e) {
         printf("Unable to parse the YAML string: %s", $e->getMessage());
     }
     /*
     tasks:
         0: { id: 1, name: ''}
         1: { id: 1, name: ''}
     taskauthor:
         0: { id: 1, name: "Brad Taylor", isActive: true }
         1: { id: 2, name: "William O'Neil", isActive: false }
     */
     $tasks = array(0 => array('name' => 'Task 0', 'description' => 'Description Task 0', 'products' => [1, 2, 3]), 1 => array('name' => 'Task 1', 'description' => 'Description Task 1', 'products' => [1, 4]), 2 => array('name' => 'Task 2', 'description' => 'Description Task 2', 'products' => [2, 3]));
     foreach ($tasks as $task_id => $data) {
         $task = new Task();
         $task->setName($data['name']);
         $task->setDescription($data['description']);
         foreach ($data['products'] as $product) {
             $task->addProduct($this->getReference($product));
         }
         $manager->persist($task);
     }
     $manager->flush();
 }
Exemple #7
0
 /**
  * @param \Doctrine\Common\Persistence\ObjectManager $manager
  */
 public function load(ObjectManager $manager)
 {
     $languages = $this->container->getParameter('networking_init_cms.page.languages');
     foreach ($languages as $lang) {
         $this->createMenuItems($manager, $lang['locale']);
     }
 }
 /**
  * {@inheritDoc}
  */
 public function authenticate(TokenInterface $token)
 {
     $ownerName = $token->getResourceOwnerName();
     $oauthUtil = $this->container->get('glory_oauth.util.token2oauth');
     $oauth = $oauthUtil->generate($token);
     $connect = $this->container->get('glory_oauth.connect');
     if (!($user = $connect->getConnect($oauth))) {
         if ($this->container->getParameter('glory_oauth.auto_register')) {
             $user = $connect->connect($oauth);
         } else {
             $key = time();
             $this->container->get('session')->set('glory_oauth.connect.oauth.' . $key, [$oauth->getOwner(), $oauth->getUsername()]);
             $url = $this->container->get('router')->generate('glory_oauth_register', ['key' => $key]);
             return new RedirectResponse($url);
         }
     }
     if (!$user instanceof UserInterface) {
         throw new BadCredentialsException('');
     }
     try {
         $this->userChecker->checkPreAuth($user);
         $this->userChecker->checkPostAuth($user);
     } catch (BadCredentialsException $e) {
         if ($this->hideUserNotFoundExceptions) {
             throw new BadCredentialsException('Bad credentials', 0, $e);
         }
         throw $e;
     }
     $token = new OAuthToken($token->getRawToken(), $user->getRoles());
     $token->setOwnerName($ownerName);
     $token->setUser($user);
     $token->setAuthenticated(true);
     return $token;
 }
 private function getUrlPattern()
 {
     if (null == $this->_url_pattern) {
         $this->_url_pattern = File::getAllFilesPattern($this->container->getParameter('sf.web_assets_dir'));
     }
     return $this->_url_pattern;
 }
Exemple #10
0
 /**
  * @param string $parameter
  *
  * @return mixed
  */
 public static function getParameter($parameter)
 {
     if (self::$container->hasParameter($parameter)) {
         return self::$container->getParameter($parameter);
     }
     return false;
 }
Exemple #11
0
 /**
  * {@inheritDoc}
  */
 public function load(ObjectManager $manager)
 {
     $currency = new Currency();
     $currency->setLabel('EUR');
     $basket = new Basket();
     $basket->setCurrency($currency);
     $basket->setProductPool($this->getProductPool());
     $products = array($this->getReference('php_plush_blue_goodie_product'), $this->getReference('php_plush_green_goodie_product'), $this->getReference('travel_japan_small_product'), $this->getReference('travel_japan_medium_product'), $this->getReference('travel_japan_large_product'), $this->getReference('travel_japan_extra_large_product'), $this->getReference('travel_quebec_small_product'), $this->getReference('travel_quebec_medium_product'), $this->getReference('travel_quebec_large_product'), $this->getReference('travel_quebec_extra_large_product'), $this->getReference('travel_paris_small_product'), $this->getReference('travel_paris_medium_product'), $this->getReference('travel_paris_large_product'), $this->getReference('travel_paris_extra_large_product'), $this->getReference('travel_switzerland_small_product'), $this->getReference('travel_switzerland_medium_product'), $this->getReference('travel_switzerland_large_product'), $this->getReference('travel_switzerland_extra_large_product'));
     $nbCustomers = $this->container->hasParameter("sonata.fixtures.customer.fake") ? (int) $this->container->getParameter("sonata.fixtures.customer.fake") : 20;
     for ($i = 1; $i <= $nbCustomers; $i++) {
         $customer = $this->generateCustomer($manager, $i);
         $customerProducts = array();
         $orderProductsKeys = array_rand($products, rand(1, count($products)));
         if (is_array($orderProductsKeys)) {
             foreach ($orderProductsKeys as $orderProductKey) {
                 $customerProducts[] = $products[$orderProductKey];
             }
         } else {
             $customerProducts = array($products[$orderProductsKeys]);
         }
         $order = $this->createOrder($basket, $customer, $customerProducts, $manager, $i);
         $this->createTransaction($order, $manager);
         $this->createInvoice($order, $manager);
         if (!($i % 10)) {
             $manager->flush();
         }
     }
     $manager->flush();
 }
Exemple #12
0
 /**
  * @return array
  */
 protected function getFirstTemplate()
 {
     $templates = $this->container->getParameter('networking_init_cms.page.templates');
     foreach ($templates as $key => $template) {
         return $key;
     }
 }
 public function load(ObjectManager $manager)
 {
     $symbonfy_base_dir = $this->container->getParameter('kernel.root_dir');
     $data_dir = $symbonfy_base_dir . '/Resources/data/';
     $row = 0;
     $fd = fopen($data_dir . 'person.csv', "r");
     if ($fd) {
         while (($data = fgetcsv($fd)) !== false) {
             $row++;
             if ($row == 1) {
                 continue;
             }
             //skip header
             $person = new Person();
             $person->setName($data[0]);
             $person->setAge($data[1]);
             $birthDate = \DateTime::createFromFormat('d/m/Y', $data[2]);
             $person->setBirthDate($birthDate);
             $person->setHeight($data[3]);
             $person->setEmail($data[4]);
             $person->setPhone($data[5]);
             $person->setGender($data[6]);
             $person->setDescends($data[7]);
             $person->setVehicle($data[8]);
             $person->setPreferredLanguage($data[9]);
             $person->setEnglishLevel($data[10]);
             $person->setPersonalWebSite($data[11]);
             $person->setCardNumber($data[12]);
             $person->setIBAN($data[13]);
             $manager->persist($person);
         }
         fclose($fd);
     }
     $manager->flush();
 }
 /**
  * {@inheritdoc}
  */
 public function warmUp($cacheDir)
 {
     $serviceProxyIds = $this->container->getParameter('openclassrooms.service_proxy.service_proxy_ids');
     foreach ($serviceProxyIds as $serviceProxyId) {
         $this->container->get($serviceProxyId);
     }
 }
 /**
  * {@inheritdoc}
  */
 public function getItems()
 {
     /* @var TokenStorageInterface $tokenStorage */
     $tokenStorage = $this->container->get('security.token_storage');
     /* @var RequestStack */
     $requestStack = $this->container->get('request_stack');
     /* @var Request $request */
     $request = $requestStack->getCurrentRequest();
     if (null === $request) {
         return array();
     }
     /* @var Router $router */
     $router = $this->container->get('router');
     $locale = $request->getLocale();
     $runtimeConfig = $this->container->getParameter(ModeraMjrIntegrationExtension::CONFIG_KEY);
     $token = $tokenStorage->getToken();
     if ($token->isAuthenticated() && $token->getUser() instanceof User) {
         /* @var EntityManager $em */
         $em = $this->container->get('doctrine.orm.entity_manager');
         /* @var UserSettings $settings */
         $settings = $em->getRepository(UserSettings::clazz())->findOneBy(array('user' => $token->getUser()->getId()));
         if ($settings && $settings->getLanguage() && $settings->getLanguage()->getEnabled()) {
             $locale = $settings->getLanguage()->getLocale();
             $session = $request->getSession();
             $session->set('_backend_locale', $locale);
         }
     }
     return array('extjs_localization_runtime_plugin' => array('className' => 'Modera.backend.languages.runtime.ExtJsLocalizationPlugin', 'tags' => ['runtime_plugin'], 'args' => array(array('urls' => array($runtimeConfig['extjs_path'] . '/locale/ext-lang-' . $locale . '.js', $router->generate('modera_backend_languages_extjs_l10n', array('locale' => $locale)))))), 'modera_backend_languages.user_settings_window_contributor' => array('className' => 'Modera.backend.languages.runtime.UserSettingsWindowContributor', 'args' => ['@application'], 'tags' => ['shared_activities_provider']));
 }
 /**
  * @param \Symfony\Component\DependencyInjection\ContainerInterface $container
  * @param \Doctrine\Common\Persistence\ManagerRegistry $doctrine
  * @param \Doctrine\Common\Persistence\ObjectManager $manager
  * @param \Behat\Behat\Hook\Scope\ScenarioScope $event
  * @param \Behat\Gherkin\Node\FeatureNode $feature
  * @param \Behat\Gherkin\Node\ScenarioNode $scenario
  * @param \Knp\FriendlyContexts\Alice\Loader\Yaml $loader
  * @param \Doctrine\Common\Persistence\Mapping\ClassMetadataFactory $metadataFactory
  * @param \Doctrine\Common\Persistence\Mapping\ClassMetadata $userMetadata
  * @param \Doctrine\Common\Persistence\Mapping\ClassMetadata $placeMetadata
  * @param \Doctrine\Common\Persistence\Mapping\ClassMetadata $productMetadata
  */
 function let($container, $doctrine, $manager, $event, $loader, $feature, $scenario, $metadataFactory, $userMetadata, $placeMetadata, $productMetadata)
 {
     $doctrine->getManager()->willReturn($manager);
     $feature->getTags()->willReturn(['alice(Place)', 'admin']);
     $scenario->getTags()->willReturn(['alice(User)']);
     $event->getFeature()->willReturn($feature);
     $event->getScenario()->willReturn($scenario);
     $loader->load('user.yml')->willReturn([]);
     $loader->load('product.yml')->willReturn([]);
     $loader->load('place.yml')->willReturn([]);
     $loader->getCache()->willReturn([]);
     $loader->clearCache()->willReturn(null);
     $fixtures = ['User' => 'user.yml', 'Product' => 'product.yml', 'Place' => 'place.yml'];
     $config = ['alice' => ['fixtures' => $fixtures, 'dependencies' => []]];
     $container->has(Argument::any())->willReturn(true);
     $container->hasParameter(Argument::any())->willReturn(true);
     $container->get('friendly.alice.loader.yaml')->willReturn($loader);
     $container->get('doctrine')->willReturn($doctrine);
     $container->getParameter('friendly.alice.fixtures')->willReturn($fixtures);
     $container->getParameter('friendly.alice.dependencies')->willReturn([]);
     $manager->getMetadataFactory()->willReturn($metadataFactory);
     $metadataFactory->getAllMetadata()->willReturn([$userMetadata, $placeMetadata, $productMetadata]);
     $userMetadata->getName()->willReturn('User');
     $placeMetadata->getName()->willReturn('Place');
     $productMetadata->getName()->willReturn('Product');
     $this->initialize($config, $container);
 }
 /**
  * {@inheritdoc}
  */
 public function isApplicable(DatagridConfiguration $config)
 {
     if (!$this->container) {
         throw new \InvalidArgumentException('ContainerInterface not injected');
     }
     return is_a($this->container->get('oro_security.security_facade')->getLoggedUser(), $this->container->getParameter('orob2b_customer.entity.account_user.class'), true);
 }
 /**
  * @param Bundle          $bundle
  * @param OutputInterface $output
  * @param array           $parameters
  */
 public function generateBehatTests(Bundle $bundle, OutputInterface $output, array $parameters)
 {
     $dirPath = sprintf("%s/Features", $bundle->getPath());
     $skeletonDir = sprintf("%s/Features", $this->fullSkeletonDir);
     // First copy all the content
     $this->filesystem->mirror($this->fullSkeletonDir, $bundle->getPath());
     // Now render the Context files to replace the namespace etc.
     if ($handle = opendir($skeletonDir . "/Context")) {
         while (false !== ($entry = readdir($handle))) {
             // Check to make sure we skip hidden folders
             // And we render the files ending in .php
             if (substr($entry, 0, 1) != '.' && substr($entry, -strlen(".php")) === ".php") {
                 $this->renderFile("/Features/Context/" . $entry, $dirPath . "/Context/" . $entry, $parameters);
             }
         }
         closedir($handle);
     }
     $featureContext = $dirPath . "/Context/FeatureContext.php";
     if ($this->filesystem->exists($featureContext)) {
         $contents = file_get_contents($featureContext);
         $contents = str_replace('-adminpwd-', $this->container->getParameter('kunstmaan_admin.admin_password'), $contents);
         file_put_contents($featureContext, $contents);
     }
     $output->writeln('Generating Behat Tests : <info>OK</info>');
 }
 public function __construct(ContainerInterface $container)
 {
     $this->container = $container;
     $this->multiLanguage = $this->container->getParameter('multilanguage');
     $this->defaultLocale = $this->container->getParameter('defaultlocale');
     $this->requiredLocales = explode('|', $this->container->getParameter('requiredlocales'));
 }
 /**
  * Returns class metadata for a defined entity parameter
  *
  * @param string $entityParameter
  *
  * @return \Doctrine\Common\Persistence\Mapping\ClassMetadata
  */
 protected function getClassMetadata($entityParameter)
 {
     $entityClassName = $this->container->getParameter($entityParameter);
     $manager = $this->managerRegistry->getManagerForClass($entityClassName);
     $classMetadata = $manager->getClassMetadata($entityClassName);
     return $classMetadata;
 }
 /**
  * @dataProvider parametersProvider
  *
  * @param string $node  Array key from parametersProvider
  * @param string $value Array value from parametersProvider
  */
 public function testParameter($node, $value)
 {
     $name = 'liip_functional_test.' . $node;
     $this->assertNotNull($this->container);
     $this->assertTrue($this->container->hasParameter($name), $name . ' parameter is not defined.');
     $this->assertSame($value, $this->container->getParameter($name));
 }
Exemple #22
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->input = $input;
     $this->output = $output;
     $className = Utils::getSimpleClassName(get_class($this));
     if (substr($className, -4) !== "Task") {
         throw new SkrzException(sprintf("Task class name has to end with 'Task', class: '%s'.", $className));
     }
     $taskLogDirectory = $this->container->getParameter("kernel.logs_dir");
     $this->log->pushHandler(new RotatingFileHandler($taskLogDirectory . "/" . $className . ".log", $this->rotatingLogMaxFiles));
     try {
         $this->log->info("Task {$className} started.");
         $startTime = microtime(true);
         $this->work();
         $endTime = microtime(true);
         $this->log->info(sprintf("Task {$className} terminated with success in %.3fs.", $endTime - $startTime));
     } catch (\Exception $e) {
         if ($this->container->has("service.alert")) {
             // FIXME: do not rely on hostname
             /** @var AlertServiceInterface $alertService */
             $alertService = $this->container->get("service.alert");
             $alertService->sendEmailToAdmin($this->devEmail, "[" . gethostname() . "]: Task " . get_class($this) . " failed with exception: " . $e->getMessage(), $e->getMessage() . "\n\n" . $e->getTraceAsString());
         }
         $this->log->emergency("Task terminated with exception. " . get_class($e) . ": " . $e->getMessage() . "\n\n" . $e->getTraceAsString());
     }
     $this->log->popHandler();
 }
 /**
  * Get a parameter from the container.
  *
  * @param string $parameter
  *
  * @throws InvalidContainerParameterException
  *
  * @return mixed
  */
 public function getContainerParameter($parameter)
 {
     if ($this->hasContainerParameter($parameter)) {
         return $this->container->getParameter($parameter);
     }
     throw InvalidContainerParameterException::create()->setMessage('The container parameter requested (%s) does not exist.', $parameter);
 }
 /**
  * This function is specific to Wsse authentication and is only used to help this example
  *
  * For more information specific to the logic here, see
  * https://github.com/symfony/symfony-docs/pull/3134#issuecomment-27699129
  */
 protected function validateDigest($digest, $nonce, $created, $secret)
 {
     // we set Expire value
     $Expire_lifetime = (int) $this->container->getParameter("sfynx.wsse.security.nonce_lifetime");
     // Check created time is not in the future
     if (strtotime($created) > time()) {
         return false;
     }
     // Expire timestamp after 5 minutes
     if (time() - strtotime($created) > $Expire_lifetime) {
         return false;
     }
     // Validate that the nonce is *not* used in the last 5 minutes
     // if it has, this could be a replay attack
     if (file_exists($this->cacheDir . '/' . $nonce) && file_get_contents($this->cacheDir . '/' . $nonce) + $Expire_lifetime > time()) {
         throw new NonceExpiredException('Previously used nonce detected');
     }
     // If cache directory does not exist we create it
     if (!is_dir($this->cacheDir)) {
         mkdir($this->cacheDir, 0777, true);
     }
     file_put_contents($this->cacheDir . '/' . $nonce, time());
     // Validate Secret
     $expected = static::makeDigest($nonce, $created, $secret);
     return $digest === $expected;
 }
 private function getRichTextFilesPattern()
 {
     if (null === $this->richtext_files_pattern) {
         $this->richtext_files_pattern = \Symforce\AdminBundle\Entity\File::getRichTextFilesPattern($this->container->getParameter('sf.web_assets_dir'));
     }
     return $this->richtext_files_pattern;
 }
 /**
  * @param Schema $schema
  */
 public function up(Schema $schema)
 {
     if (AkeneoStorageUtilsExtension::DOCTRINE_ORM === $this->container->getParameter('pim_catalog_product_storage_driver')) {
         $this->addSql('CREATE INDEX version_idx ON pim_versioning_version (version)');
         $this->addSql('CREATE INDEX logged_at_idx ON pim_versioning_version (logged_at)');
     }
 }
 public function __construct(ContainerInterface $container, EntityManager $entityManager)
 {
     $this->entityManager = $entityManager;
     $this->__allowInserts = $container->getParameter(Configuration::CONFIG_ROOT . '.' . Configuration::ALLOW_INSERTS);
     $this->__selectAllAtFirst = $container->getParameter(Configuration::CONFIG_ROOT . '.' . Configuration::READ_ALL);
     $this->__returnNullOnNotFound = $container->getParameter(Configuration::CONFIG_ROOT . '.' . Configuration::RETURN_NULL);
 }
 /**
  * Get list of existing translation locales for current translation domain
  *
  * @return array
  */
 protected function getTranslationLocales()
 {
     if (null === $this->translationLocales) {
         $translationDirectory = str_replace('/', DIRECTORY_SEPARATOR, $this->translationDirectory);
         $translationDirectories = array();
         foreach ($this->container->getParameter('kernel.bundles') as $bundle) {
             $reflection = new \ReflectionClass($bundle);
             $bundleTranslationDirectory = dirname($reflection->getFilename()) . $translationDirectory;
             if (is_dir($bundleTranslationDirectory) && is_readable($bundleTranslationDirectory)) {
                 $translationDirectories[] = realpath($bundleTranslationDirectory);
             }
         }
         $domainFileRegExp = $this->getDomainFileRegExp();
         $finder = new Finder();
         $finder->in($translationDirectories)->name($domainFileRegExp);
         $this->translationLocales = array();
         /** @var $file \SplFileInfo */
         foreach ($finder as $file) {
             preg_match($domainFileRegExp, $file->getFilename(), $matches);
             if ($matches) {
                 $this->translationLocales[] = $matches[1];
             }
         }
         $this->translationLocales = array_unique($this->translationLocales);
     }
     return $this->translationLocales;
 }
 /**
  * Construct.
  *
  * @param ContainerInterface $container An ContainerInterface instance
  */
 public function __construct(ContainerInterface $container)
 {
     $this->publicKey = $container->getParameter('ewz_recaptcha.public_key');
     $this->secure = $container->getParameter('ewz_recaptcha.secure');
     $this->enabled = $container->getParameter('ewz_recaptcha.enabled');
     $this->language = $container->getParameter('session.default_locale');
 }
 /**
  * Construct.
  *
  * @param ContainerInterface $container An ContainerInterface instance
  */
 public function __construct(ContainerInterface $container)
 {
     $this->publicKey = $container->getParameter('rmzamora_form_extension.recaptcha.public_key');
     $this->secure = $container->getParameter('rmzamora_form_extension.recaptcha.secure');
     $this->enabled = $container->getParameter('rmzamora_form_extension.recaptcha.enabled');
     $this->language = $container->getParameter($container->getParameter('rmzamora_form_extension.recaptcha.locale_key'));
 }