예제 #1
0
파일: Helper.php 프로젝트: hiqdev/hidev
 /**
  * Recursively removes duplicate values from non-associative arrays.
  */
 public static function uniqueConfig($array)
 {
     return ArrayHelper::unique($array);
 }
예제 #2
0
 public function testXML()
 {
     $xml = simplexml_load_file(__DIR__ . '/test.xml');
     $a = ArrayHelper::toArray($xml);
     $this->assertEquals($a, ['@attributes' => ['backupGlobals' => 'false', 'backupStaticAttributes' => 'false', 'colors' => 'true', 'convertErrorsToExceptions' => 'true', 'convertNoticesToExceptions' => 'true', 'convertWarningsToExceptions' => 'true', 'processIsolation' => 'false', 'stopOnFailure' => 'false', 'syntaxCheck' => 'false', 'bootstrap' => './tests/bootstrap.php'], 'testsuites' => ['testsuite' => ['@attributes' => ['name' => 'PhpCollection Unit Test Suite'], 'directory' => './tests/']]]);
 }
예제 #3
0
 public function mergeItems(array $items)
 {
     $this->_items = ArrayHelper::merge($this->_items, $items);
 }
예제 #4
0
 /**
  * {@inheritdoc}
  */
 public function bootstrap($app)
 {
     if ($this->_isBootstrapped) {
         return;
     }
     $this->_isBootstrapped = true;
     $this->_app = $app;
     if ($this->cache) {
         Yii::trace('Bootstrap from cache', get_called_class() . '::bootstrap');
         $this->setItems($this->cache);
         // $this->toArray(); // TODO 2 SilverFire: check and remove this line
     } else {
         Yii::trace('Bootstrap plugins from the list of extensions', get_called_class() . '::bootstrap');
         foreach ($app->extensions as $name => $extension) {
             foreach ($extension['alias'] as $alias => $path) {
                 $class = strtr(substr($alias, 1) . '/' . 'Plugin', '/', '\\');
                 if (!class_exists($class)) {
                     continue;
                 }
                 $ref = new ReflectionClass($class);
                 if ($ref->isSubclassOf('hiqdev\\pluginmanager\\Plugin')) {
                     $plugin = Yii::createObject($class);
                     if ($plugin instanceof BootstrapInterface) {
                         $plugin->bootstrap($app);
                     }
                     //$this->setPlugins([$name => $plugin]);
                     $this->mergeItems($plugin->getItems());
                 }
             }
         }
         $this->saveCache($this->getItems());
     }
     if ($this->aliases) {
         $app->setAliases($this->aliases);
     }
     if ($this->modules) {
         $modules = ArrayHelper::getItems($app->modules, array_keys($this->modules));
         $this->modules = ArrayHelper::merge($this->modules, $modules);
         $app->setModules($this->modules);
     }
     if ($this->components) {
         $components = ArrayHelper::getItems($app->components, array_keys($this->components));
         $this->components = ArrayHelper::merge($this->components, $components);
         $app->setComponents($this->components);
     }
     if ($app->has('menuManager')) {
         $app->menuManager->bootstrap($app);
     }
     if ($app->has('themeManager')) {
         $app->themeManager->bootstrap($app);
     }
 }
예제 #5
0
파일: XmlHandler.php 프로젝트: hiqdev/hidev
 /**
  * {@inheritdoc}
  */
 public function parsePath($path, $minimal = null)
 {
     $this->_xml = simplexml_load_file(file_exists($path) ? $path : $minimal);
     return ArrayHelper::toArray($this->_xml);
 }