Get mix file

@param string $path
@param string $manifestDirectory
@return string $manifest[$path]
165291
public static function make(string $path, string $manifestDirectory) : string
  {
    static $manifest;

    if ($manifestDirectory && strpos($manifestDirectory, DIRECTORY_SEPARATOR) !== 0) {
      $manifestDirectory = DIRECTORY_SEPARATOR . "{$manifestDirectory}";
    }
    if (!$manifest) {
      if (!file_exists($manifestPath = (DEPConfig::$appdir . 'public' . DIRECTORY_SEPARATOR . 'mix-manifest.json') )) {
        throw new MixException('The Mix manifest does not exist.');
      }
      $manifest = json_decode(file_get_contents($manifestPath), true);
    }

    if (strpos($path, DIRECTORY_SEPARATOR) !== 0) {
      $path = DIRECTORY_SEPARATOR . "{$path}";
    }

    if (! array_key_exists($path, $manifest)) {
      throw new MixException(
        "Unable to locate Mix file: $path. Please check your ".
        'webpack.mix.js output paths and try again.'
      );
    }

    return $manifest[$path];
  }
590257
public function fileAction($path)
    {
        try {
            $this->setPath($path);
        } catch (NotFoundException $e) {
            throw $e;
        }

        $dbfile = new WDBFile($this->getPath());
        if ($dbfile->isDir()) {
            return $this->directoryAction($this->getPath());
        }

        $tpl_params = array(
            'page'          => $dbfile->getWDBFullStack(),
            'breadcrumbs'   => TemplateHelper::getBreadcrumbs($this->getPath()),
            'title'         => TemplateHelper::buildPageTitle($this->getPath()),
        );
        if (empty($tpl_params['title'])) {
            if (!empty($tpl_params['breadcrumbs'])) {
                $tpl_params['title'] = TemplateHelper::buildPageTitle(end($tpl_params['breadcrumbs']));
            } else {
                $tpl_params['title'] = _T('Home');
            }
        }
        $content = $dbfile->viewFileInfos($tpl_params);

        return array('default',
            $content,
            $tpl_params);
    }
659892
function Manifest(options) {
  this.options = options;
  this.destDir = options.destDir || process.cwd();
  this.content = {};
  this.filePath = path.join(this.destDir, MANIFEST_FILENAME);

  // get or create manifest content
  this.content = this.read();
}
972456
public static function enumPHPFile($dirPath)
    {
        if (!is_dir($dirPath)) {
            return new \ArrayIterator();
        }
        $directory = new \RecursiveDirectoryIterator($dirPath);
        $iterator = new \RecursiveIteratorIterator($directory);
        $regex = new \RegexIterator($iterator, '/^.+\.php$/i', \RecursiveRegexIterator::GET_MATCH);
        return $regex;
    }
387128
public static function addPrefixToFile($path, $prefix = null)
    {
        if ($prefix === null || $prefix == '') {
            return $path;
        }

        $path = str_replace('\\', '/', $path);
        $dir = explode('/', $path);
        $lastIndex = count($dir) - 1;
        $dir[$lastIndex] = $prefix . $dir[$lastIndex];

        return implode('/', $dir);
    }
1257603
function parseManifest(manifest, docroot, callback)
{
  var inCache = false
    , lines = [];

    // get manifest file data
    fs.readFile(manifest, 'ascii', function(err, data)
    {
      var counter = 0;

      if (err)
      {
        // to prevent sudden continuation
        return callback(err);
      }

      cache[manifest] =
      {
        version: 0,
        files: [],
        manifest: data
      };

      lines = data.split('\n');

      lines.forEach(function(line)
      {
        var match;

        line = line.trim();

        // empty lines
        if (line.substr(0, 1) == '') return;

        // skip comments
        if (line.substr(0, 1) == '#') return;

        // process control keywords
        switch (line)
        {
          case 'CACHE MANIFEST':
          case 'CACHE:':
            inCache = true;
            return;
            break;

          // TODO: Add proper support for fallbacks
          case 'NETWORK:':
          case 'FALLBACK:':
            inCache = false;
            return;
            break;
        }

        // do nothing for network files
        if (!inCache) return;

        // check the file and setup monitoring
        if (!line.match(/^http(s)?:\/\//))
        {
          addWatcher(docroot+line, watcher(manifest), function(added, mtime)
          {
            // undo counter
            counter--;

            if (!added)
            {
              // check if everything is done
              if (counter == 0) callback();
              return;
            }

            if (mtime > cache[manifest].version) cache[manifest].version = mtime;

            cache[manifest].files.push(line);

            // check if everything is done
            if (counter == 0) callback();
          });

          // track inception
          counter++;
        }

      });
    });
}
1068140
protected function getContents(/*# string */ $path)/*# string */
    {
        // read in file
        $contents = @file_get_contents($path);

        // failed
        if (false === $contents) {
            throw new NotFoundException(
                Message::get(Message::CONFIG_FILE_NOTFOUND, $path),
                Message::CONFIG_FILE_NOTFOUND
            );
        }
        return $contents;
    }
457581
public static function getDirectory($path = null)
    {
        if (null === $path || DIRECTORY_SEPARATOR !== $path[0]) {
            $path = realpath($path);
        }

        return new Directory($path, static::getFilesystem());
    }
942166
private function getComponentManifest($manifestPath, $componentId)
    {
        $manifest = $this->getManifest($manifestPath);
        $index = $this->getManifestComponentModuleIndex($manifest, $componentId);

        return $manifest['modules'][$index];
    }
278870
public function get(string $path): File {
		return (new File(Paths::appendPath($this->getUrl(), $path)))->addFilters($this->recursiveFilter, true);
	}
301319
private function getManifestComponentModuleIndex($manifest, $componentId)
    {
        $manifest = is_array($manifest)
            ? $manifest
            : $this->getManifest($manifest);

        $modules = array_filter($manifest['modules'], function ($module) use ($componentId) {
            return ($module['id'] === $componentId);
        });

        return array_keys($modules)[0];
    }
638029
private function doLocateFiles(string $path, string $environment): array
    {
        $fullPaths = array_filter(array_map(static function (string $fixturePath) use ($environment, $path): string {
            return '' !== $environment
                ? sprintf('%s/%s/%s', $path, $fixturePath, $environment)
                : sprintf('%s/%s', $path, $fixturePath);
        }, $this->fixturePaths), function ($fullPath) {
            return $fullPath && file_exists($fullPath);
        });

        if ([] === $fullPaths) {
            return [];
        }

        $files = SymfonyFinder::create()->files()->in($fullPaths)->depth(0)->name('/.*\.(ya?ml|php)$/i');

        // this sort helps to set an order with filename
        // ( "001-root-level-fixtures.yml", "002-another-level-fixtures.yml", ... )
        $files = $files->sort(function ($a, $b) {
            return strcasecmp($a, $b);
        });

        $fixtureFiles = [];

        foreach ($files as $file) {
            $fixtureFiles[$file->getRealPath()] = true;
        }

        return array_keys($fixtureFiles);
    }
876346
protected function getPackageName($path)
    {
        if (ends_with($path, '.zip')) {
            $path = dirname($path);
        }
        $manifest = new Manifest(new Filesystem(), $path);
        return $manifest->get('package');
    }
52507
public function findAllFiles(DirectoryPath $path = null)
    {
        if (null === $path) {
            $path = new DirectoryPath();
        }

        $finder = new Finder();
        $searchPath = $path->prepend($this->gitService->getRepositoryPath());

        $finder->in($searchPath->toAbsoluteString(DIRECTORY_SEPARATOR));

        $filePaths = [];

        foreach ($finder->files() as $file) {
            /** @var SplFileInfo $file */
            $filePaths[] = FilePath::parse('/' . $file->getRelativePathname())->prepend($path);
        }

        return $filePaths;
    }
851009
public function directoryFiles($path)
  {
    $contents = [];

    // Scan directory
    $directoryFiles = scandir($path);

    foreach ($directoryFiles as $index => $filePath)  {

      // Ommit . and ..
      if ( ! in_array($filePath, ['.', '..']))  {

        // Check if this is a directory
        if (is_dir($path . DIRECTORY_SEPARATOR . $filePath)) {

          // Rescan and get files in this directory
          $contents = array_merge($contents, self::directoryFiles($path . DIRECTORY_SEPARATOR . $filePath));

        } else  {

          // Add file to contens array
          $contents[] = $path . DIRECTORY_SEPARATOR . $filePath;
        }
      }
    }

    return $contents;
  }
1212470
public function getFilesWithExtension($path, $ext = 'php')
    {
        if (is_dir($path)) {
            return new RegexIterator(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path, RecursiveDirectoryIterator::SKIP_DOTS), RecursiveIteratorIterator::SELF_FIRST, RecursiveIteratorIterator::CATCH_GET_CHILD // Ignore "Permission denied"
            ), '/^.+\.'.$ext.'$/i', RecursiveRegexIterator::GET_MATCH);
        } else {
            return [];
        }
    }
922746
public function getList(string $path)
    {
        $entity = $this->getEntity($path);

        if (null !== $entity && $entity->file_exists() && $entity->is_dir()) {
            $files = [];
            $changes = $this->getChanges();
            $own = $changes->own($path);

            if (!($entity instanceof VirtualInterface)) {
                $directory = $this->getRoot();
                $directoryPath = $directory->path().'/'.$path;

                $dirHandler = opendir($directoryPath);
                if ($dirHandler) {
                    while (true) {
                        $file = readdir($dirHandler);
                        if (false === $file) {
                            break;
                        } elseif ('.' == $file || '..' == $file) {
                            continue;
                        }

                        $changesKey = ($path ? $path.'/' : '').$file;
                        if (isset($own[$changesKey])) {
                            continue;
                        }
                        $files[$changesKey] = Entity::newInstance($changesKey);
                    }
                    closedir($dirHandler);
                }
            }

            foreach ($own as $changesKey => $file) {
                /* @var $file EntityInterface */
                if ($file instanceof DeletedInterface) {
                    unset($own[$changesKey]);
                }
            }

            $mergedFiles = array_merge($files, $own);
            ksort($mergedFiles);

            $result = array_values($mergedFiles);
        } else {
            $result = null;
        }

        return $result;
    }