/**
  * @param string $action
  * @return array
  */
 protected function getFiles($action)
 {
     $packages = $this->getPackagesNames($action);
     // Get files form packages
     $files = array('css' => array(), 'js' => array());
     foreach ($packages as $name) {
         if (!isset($this->packages[$name])) {
             throw new InvalidStateException("Package '{$name}' not found.");
         }
         foreach ($this->packages[$name] as $value) {
             if (is_string($value)) {
                 $files[$this->compiler->detectType($value)][] = $value;
             } elseif (isset($value['file'], $value['type']) && ($value['type'] === 'css' || $value['type'] === 'js')) {
                 $files[$value['type']][] = $value['file'];
             } else {
                 throw new InvalidStateException("File must be either a string or array with correct values.");
             }
         }
     }
     return $files;
 }