Ejemplo n.º 1
0
 /**
  *
  * @param array $array
  */
 public function __construct()
 {
     $this->yaml = new Yaml();
     $this->conf = ['conf' => $this->yaml->parse($this->confYaml), 'viewHelper' => $this->yaml->parse($this->viewHelperYaml), 'adminViewHelper' => $this->yaml->parse($this->adminViewHelperYaml)];
     $this->adminExtension = new AdminExtension($this->dir($this->conf['conf']['admin']['extensionDir'] ?? ''));
     $this->exceptionHandler = new ExceptionHandler();
     $this->registry = RegistryFactory::start();
     $this->viewHelper = new ViewHelper();
 }
Ejemplo n.º 2
0
 /**
  *
  * @return array
  */
 public function getAdminMenu() : array
 {
     $url = $this->registry->get('url');
     $http = $this->registry->get('http');
     $menus = [];
     foreach ($this->adminExtension->extensionsArray as $folder) {
         $conf = $this->yaml->parse("{$this->adminExtension->extensionDir}/{$folder}/conf.yml");
         $conf['active'] = $http->router->group() === $folder;
         if (isset($conf['menu'])) {
             foreach ($conf['menu'] as $key => $value) {
                 $conf['menu'][$key]['active'] = $http->router->name() === $conf['menu'][$key]['url'];
                 $conf['menu'][$key]['url'] = $url->url($conf['menu'][$key]['url'], $conf['menu'][$key]['tokens'] ?? []);
                 unset($conf['menu'][$key]['tokens']);
             }
         }
         $menus[] = $conf;
     }
     return $menus;
 }
Ejemplo n.º 3
0
 public function testReadFromYaml()
 {
     $yamlFile = MockTest::mockFile('anyYamlFile.yml', 0644, 'any: content');
     $this->assertEquals(['any' => 'content'], $this->yaml->parse($yamlFile));
 }