Returns the strings contained in the given js file

@param string $file
@return array
766356
public function analyze_js(string $file): array
  {
    $res = [];
    $js = file_get_contents($file);
    if ( $tmp = \Gettext\Translations::fromJsCodeString($js, [
      'functions' => [
        '_' => 'gettext',
        'bbn._' => 'gettext'
      ],
      'file' => $file
      ]) ){
      foreach ( $tmp->getIterator() as $r => $tr ){
        $res[] = $tr->getOriginal();
      }
      $this->parser->mergeWith($tmp);
    }
    return array_unique($res);
  }
229445
protected function getFileContents($file)
    {
        if ($file instanceof ModuleResource) {
            $path = $file->getPath();
        } else {
            $path = Director::baseFolder() . '/' . $file;
        }
        if (!file_exists($path)) {
            return null;
        }
        $content = file_get_contents($path);

        // Remove UTF-8 BOM
        if (substr($content, 0, 3) === pack("CCC", 0xef, 0xbb, 0xbf)) {
            $content = substr($content, 3);
        }

        return $content;
    }
1204777
protected function load_file($file)
	{
		$contents = $this->parse_vars(file_get_contents($file));
		return json_decode($contents, true);
	}
554407
public function getLocalFile($file = '') {
        #判断数据不为空
        if (empty($file)) {
            return [];
        }
        $data = [];
        foreach ($file as $key => $value) {
            $path = ROOT_DIR . $value['name'];
            if (is_file($path)) {
                #获取文件内容
                $value['content'] = encrypt(file_get_contents($path));
                $data[]           = $value;
            }
        }
        return $data;
    }
1005771
private function get_strings($file, $directory) {
		$parts = explode('.', strrev($file), 2);
		$filename = strrev($parts[1]);
		$extension = strrev($parts[0]);

		switch ($extension) {
			case 'twig':
				$strings = $this->get_twig_strings($file, $directory);
				break;
			case 'tpl':
				$strings = $this->get_smarty_strings($file, $directory);
				break;
			default: throw new \Exception('Unknown template type');
		}

		return $strings;
	}
727157
protected function getSize($file)
    {
        if (! file_exists($file)) {
            return [];
        }

        $info = pathinfo($file);
        $image = null;
        switch (strtolower($info['extension'])) {
            case 'gif':
                $image = imagecreatefromgif($file);
                break;
            case 'jpg':
            case 'jpeg':
                $image = imagecreatefromjpeg($file);
                break;
            case 'png':
                $image = imagecreatefrompng($file);
                break;
            default:
                break;
        }
        if ($image == null) {
            return [];
        } else {
            return [imagesx($image), imagesy($image)];
        }
    }
455039
public function getFilesFromZip($file)
    {
        try {
            $files = $this->zip->set($file)->getList();
        } catch (Exception $e) {
            return array();
        }

        return count($files) < 2 ? array() : $files;
    }
1182980
public function getContents($file)
    {
        $file = $this->basePath.'/'.ltrim($file, '/\\');

        if(!file_exists($file))
            throw new \Exedra\Exception\NotFoundException("File [$file] not found");

        return file_get_contents($file);
    }
1349869
public function fetch($file=null)
    {
        if (!$file) {
            $file = $this->_file;
        }

        // Extract the vars to local namespace
        extract($this->_vars);

        // Start output buffering
        ob_start();

        include(PSI_APP_ROOT.$file);

        // Get the contents of the buffer
        $contents = ob_get_contents();

        // End buffering and discard
        ob_end_clean();

        return $contents;
    }
34265
private function getData(string $file): array
  {
    static $RESULT_STOP_WORDS_CACHE = array();

    if (isset($RESULT_STOP_WORDS_CACHE[$file])) {
      return $RESULT_STOP_WORDS_CACHE[$file];
    }

    $file = __DIR__ . '/stopwords/' . $file . '.php';
    if (file_exists($file)) {
      /** @noinspection PhpIncludeInspection */
      $RESULT_STOP_WORDS_CACHE[$file] = require $file;
    } else {
      $RESULT_STOP_WORDS_CACHE[$file] = array();
    }

    return $RESULT_STOP_WORDS_CACHE[$file];
  }
546179
private function getFileContents($file) {
    if (file_exists($file) === FALSE) {
      return NULL;
    }

    $contents = file_get_contents($file);
    if ($contents === FALSE) {
      return NULL;
    }

    return $contents;
  }
44835
public function loadFile($file)
    {
        if (is_array($file)) {
            return collect($file)->mapWithKeys(function ($subFile, $key) {
                return [$key => $this->loadFile($subFile)];
            })->toArray();
        }

        return $this->parser->parseFile($file);
    }
1105308
private function parseIniFile(string $file): array
    {
        $ini = parse_ini_file($file, true);

        if (!\is_array($ini)) {
            throw new \RuntimeException("File $file cannot be decoded");
        }

        if (!isset($ini['requires']) || !\is_array($ini['requires'])) {
            return [];
        }

        return $ini['requires'];
    }
894701
public static function parseYamlFile($file): array
    {
        if (file_exists($file)) {
            $data = file_get_contents($file);
            if (!empty($data)) {
                $data = static::replaceEnvVariables($data);
                return Yaml::parse($data);
            }
        }

        return [];
    }
1105728
protected function getFileContents($file)
    {
        // If the file is not readable
        if (!is_readable($file)) {
            throw new RuntimeException(
                sprintf(RuntimeException::INVALID_FILE_STR, $file),
                RuntimeException::INVALID_FILE
            );
        }

        return file_get_contents($file);
    }
903942
function readFile($file)
	{
		$fh = @fopen($file, 'r');

		$lines = false;
		if ($fh !== false) {
			$lines = array();
			while (!feof($fh)) {
				$lines[] = fgets($fh);
			}
			fclose($fh);
		}
		return $lines;
	}
187719
public function parseFile($file)
    {
        $bundleConfig = Yaml::parse(file_get_contents(realpath($file)));

        if (!is_array($bundleConfig)) {
            return array();
        }

        return $bundleConfig;
    }