/**
  * Ejecuta todo las configuraciones
  * @return JsonResponse
  */
 public function run()
 {
     $request = Request::createFromGlobals();
     $request->getPathInfo();
     $jsonResponse = new JsonResponse();
     if ($request->getMethod() == 'POST') {
         $this->action = $this->sanitize($request->request->get('action'));
         $path = $this->sanitize($request->request->get('path'));
         if ($this->validPath($path) == false) {
             $result = array("query" => "BE_RUN_NOT_VALID %s", "params" => array($path));
             $this->setInfo(array("msg" => $result));
             if ($this->config['debug']) {
                 $this->_log(__METHOD__ . ' - No valido $path: ' . $path);
             }
         } else {
             if ($this->action === 'getfolder') {
                 $folders = $this->getAllFiles($path);
                 if (is_array($folders)) {
                     $this->setInfo(array("data" => $folders));
                 }
             } elseif ($this->action === 'uploadfile') {
                 $files = $this->uploadAll($request->files->get('file'), $path);
                 if ($files) {
                     $this->setInfo(array("data" => $files));
                 }
             } elseif ($this->action === 'newfolder') {
                 $name = $this->sanitize($request->request->get('name'));
                 $this->newFolder($name, $path);
             } elseif ($this->action === 'renamefile') {
                 $nameold = $this->sanitize($request->request->get('nameold'));
                 $namenew = $this->sanitize($request->request->get('name'));
                 $this->rename($nameold, $namenew, $path);
             } elseif ($this->action === 'movefile') {
                 $nameold = $this->sanitize($request->request->get('nameold'));
                 $namenew = $this->sanitize($request->request->get('name'));
                 $this->move($nameold, $namenew, $path);
             } elseif ($this->action === 'deletefile') {
                 $name = $request->request->get('name');
                 $this->delete($name, $path);
             } else {
                 $this->setInfo(array("status" => 0));
             }
         }
     } elseif ($request->getMethod() == 'GET') {
         $this->action = $this->sanitize($request->query->get('action'));
         $path = $this->sanitize($request->query->get('path'));
         $name = $this->sanitize($request->query->get('name'));
         if ($this->validPath($path) == false) {
             $result = array("query" => "BE_RUN_NOT_VALID %s", "params" => array($path));
             $this->setInfo(array("msg" => $result));
             if ($this->config['debug']) {
                 $this->_log(__METHOD__ . ' - No valido $path: ' . $path);
             }
         } else {
             if ($this->action === 'download') {
                 $this->download($name, $path);
             }
         }
     }
     $jsonResponse->setData($this->info);
     return $jsonResponse->sendContent();
 }