示例#1
0
 public function testDynamicArrayAccessors()
 {
     $this->specify('Set and Get via array access', function () {
         $repo = new Repository($this->loader());
         $this->assertSame(include __DIR__ . '/testfiles' . '/app.php', $repo->get('app'));
         $new = array('new' => 'value');
         $repo['app'] = $new;
         $this->assertSame($new, $repo->get('app'));
         $this->assertSame($new, $repo['app']);
     });
 }
 public function getModules()
 {
     if (isset(static::$modules)) {
         return static::$modules;
     }
     //
     $modules = $this->config->get('modules.modules', array());
     $modules = array_map(function ($slug, $properties) {
         $autoload = array('config', 'events', 'filters', 'routes');
         $options = array_get($properties, 'autoload', array());
         if (!empty($options)) {
             $autoload = array_intersect($options, $autoload);
         }
         array_push($autoload, 'bootstrap');
         //
         $namespace = isset($properties['namespace']) ? $properties['namespace'] : Str::studly($slug);
         return array_merge(array('slug' => $slug, 'name' => isset($properties['name']) ? $properties['name'] : $namespace, 'namespace' => $namespace, 'enabled' => isset($properties['enabled']) ? $properties['enabled'] : true, 'order' => isset($properties['order']) ? $properties['order'] : 9001, 'autoload' => $autoload), $properties);
     }, array_keys($modules), $modules);
     return static::$modules = Collection::make($modules)->sortBy('order');
 }