Example #1
0
 private function getUrl($params)
 {
     $key = Config::getKey();
     $sig = new Signaturer($key['public'], $key['private']);
     return $sig->getUrl($params);
 }
Example #2
0
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      Config $value A Config object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(Config $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getKey();
         }
         // if key === null
         self::$instances[$key] = $obj;
     }
 }
Example #3
0
 /**
  * @covers \BrightNucleus\Config\Config::__construct
  * @covers \BrightNucleus\Config\Config::resolveOptions
  * @covers \BrightNucleus\Config\Config::configureOptions
  */
 public function testConfigFileWithDefaults()
 {
     $schema = new ConfigSchema(new Config(__DIR__ . '/fixtures/schema_config_file.php'));
     $config = new Config(['negative_integer' => -333], $schema);
     $this->assertTrue($config->hasKey('random_string'));
     $this->assertTrue($config->hasKey('positive_integer'));
     $this->assertTrue($config->hasKey('negative_integer'));
     $this->assertTrue($config->hasKey('positive_boolean'));
     $this->assertFalse($config->hasKey('negative_boolean'));
     $this->assertFalse($config->hasKey('some_other_key'));
     $this->assertEquals('default_test_value', $config->getKey('random_string'));
     $this->assertEquals(99, $config->getKey('positive_integer'));
     $this->assertEquals(-333, $config->getKey('negative_integer'));
     $this->assertTrue($config->getKey('positive_boolean'));
     $this->setExpectedException('BrightNucleus\\Config\\Exception\\KeyNotFoundException', 'The configuration key some_other_key does not exist.');
     $this->assertFalse($config->getKey('some_other_key'));
 }