/** * */ public function testLeaves() { $node = new Param\Node(['aa' => 11, 'bb' => 22, 'ss' => ['xx' => 77, 'yy' => 88], 'cc' => 33]); $leaves = Param\Util::leaves($node); $expected = array('aa' => 11, 'bb' => 22, 'ss.xx' => 77, 'ss.yy' => 88, 'cc' => 33); $this->assertEquals($leaves, $expected); }
/** * @param Resources $context * @return boolean */ public static function autostart(Resources $context) { $config = $context->get('config'); // [php] $ini = $config->node('php'); foreach (Param\Util::leaves($ini) as $key => $value) { if (!is_scalar($value) && !is_null($value)) { $type = is_object($value) ? get_class($value) : gettype($value); throw new Exception\RuntimeException("INI parameter '{$key}' is of wrong type ({$type})"); } ini_set($key, $value); } // [locale] $info = array(); $locale = $config->node('locale'); foreach ($locale as $category => $spec) { $info[$category] = setlocale($category, $spec->getData()); } $context->setResource('locale', $info); return true; }