lithium\g11n\Catalog::config PHP Method

config() public static method

Sets configurations for this Adaptable implementation.
public static config ( array $config = null ) : array
$config array Configurations, indexed by name.
return array `Collection` of configurations or void if setting configurations.
    public static function config($config = null)
    {
        $defaults = array('scope' => null);
        if (is_array($config)) {
            foreach ($config as $i => $item) {
                $config[$i] += $defaults;
            }
        }
        return parent::config($config);
    }

Usage Example

Esempio n. 1
0
    public function testDefaultConfiguration()
    {
        $file = "{$this->_path}/source/a.html.php";
        $data = <<<EOD
<h2>Flowers</h2>
<?=\$t('Apples are green.'); ?>
EOD;
        file_put_contents($file, $data);
        $configs = Catalog::config();
        $configKey1 = key($configs);
        next($configs);
        $configKey2 = key($configs);
        $this->_writeInput(array($configKey1, $configKey2, '', 'y'));
        $result = $this->command->run();
        $expected = 0;
        $this->assertIdentical($expected, $result);
        $expected = '/.*Yielded 1 item.*/';
        $result = $this->command->response->output;
        $this->assertPattern($expected, $result);
        $file = "{$this->_path}/destination/message_default.pot";
        $result = file_exists($file);
        $this->assertTrue($result);
        $result = file_get_contents($file);
        $expected = '/msgid "Apples are green\\."/';
        $this->assertPattern($expected, $result);
        $expected = '#/resources/tmp/tests/source(/|\\\\)a.html.php:2#';
        $this->assertPattern($expected, $result);
        $result = $this->command->response->error;
        $this->assertFalse($result);
    }
All Usage Examples Of lithium\g11n\Catalog::config