@param $file

@return array|bool
427871
public static function file2array($file)
    {
        $aFile = [];
        if ($file instanceof UploadedFile) {
            $aFile = file($file->getRealPath());
        } elseif (is_array($file) && isset($file[0]) && is_string($file[0])) {
            $aFile = $file;
        } elseif (is_string($file) && is_file($file) && file_exists($file)) {
            $aFile = file($file);
        } elseif (is_string($file) && strstr($file, PHP_EOL) !== false) {
            $file_content = explode(PHP_EOL, $file);
            if (empty(end($file_content))) {
                array_pop($file_content);
            }
            reset($file_content);
            $aFile = $file_content;
        }

        return array_map('\ForceUTF8\Encoding::toUTF8', $aFile);
    }
455039
public function getFilesFromZip($file)
    {
        try {
            $files = $this->zip->set($file)->getList();
        } catch (Exception $e) {
            return array();
        }

        return count($files) < 2 ? array() : $files;
    }
629088
private function _getDomainObjectsFromFile($file)
    {
        $result = array();

        if (fnmatch("*.php", $file)) {
            foreach ($this->_getClassFiles($file) as $namespace=>$classes) {
                foreach ($classes as $class) {
                    $fullClass = empty($namespace) ? "\\$class" : "\\$namespace\\$class";

                    $reflection = new \ReflectionClass($fullClass);
                    if (is_a($fullClass, "\Pheasant\DomainObject", true) && $reflection->isInstantiable()) {
                        $result []= $fullClass;
                    }
                }
            }
        }

        return $result;
    }
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'];
    }
44893
public function read($file)
    {
        $file = '/data/' . $file;

        /**
         * @todo validate that $file is a string
         */

        $result = [];

        $ext = pathinfo($file, PATHINFO_EXTENSION);

        if (isset($this->converters[$ext])) {

            $meta = [];

            $content = '';

            $file_contents = $this->source_filesystem->read($file);

            if ($file_contents) {

                $parts = preg_split('/\-{3}/', $file_contents, 3);

                if (count($parts) === 3) {

                    $meta = $parts[1] ?: [];

                    $content = $parts[2];
                } else {

                    $content = $file_contents;
                }

                $result = $this->yaml->parse($meta);

                $content = $this->converters[$ext]->convert($content);

                $result['content'] = trim($content);
            }
        }

        return $result;
    }
1204777
protected function load_file($file)
	{
		$contents = $this->parse_vars(file_get_contents($file));
		return json_decode($contents, true);
	}
626545
protected function getCacheKeys($file)
    {
        if (! file_exists($file)) {
            file_put_contents($file, null);
        }

        return json_decode(file_get_contents($file), true) ?: [];
    }
27007
private function parseFile($file)
    {
        $data = sscanf($file, '@%[^:]:%[^?]');

        if (empty($data[0])) {
            throw new \InvalidArgumentException(sprintf('File "%s" has invalid syntax', $file));
        }

        return $data;
    }
1359474
protected function loadConfig($file)
    {
        $file = $this->vendorDir . '/' . $file;
        if (!is_file($file)) {
            return [];
        }
        $this->opcacheInvalidate($file);
        return require($file);
    }
13974
static public function type($file) {
        $type = getimagesize($file);
        $type = $type[2];
        switch($type) {
            case IMAGETYPE_GIF:     return 'gif';
            case IMAGETYPE_JPEG:    return 'jpg';
            case IMAGETYPE_PNG:     return 'png';
        }
        return FALSE;
    }
1287821
public function find($file)
    {
        $found = false;
        $expanded = $this->_expandPrefix($file);
        if (file_exists($expanded)) {
            return $expanded;
        }
        foreach ($this->_paths as $path) {
            $file = $this->_normalizePath($file, DIRECTORY_SEPARATOR);
            $fullPath = $path . $file;

            if (file_exists($fullPath)) {
                $found = $fullPath;
                break;
            }
        }
        return $found;
    }
1017421
public static function getFile( $file ) {
		$file = Storage::getFile( Route::DOCUMENT_ROOT() . 'app/config/' . $file . '.json' );
		$out  = Parser::json( $file );

		return $out;
	}
852008
public static function get(String $file) : stdClass
    {
        $file = self::rpath($file);

        if( ! is_file($file) )
        {
            throw new Exception\FileNotFoundException(NULL, $file);
        }

        return (object)
        [
            'basename'   => self::pathInfo($file, 'basename'),
            'size'       => filesize($file),
            'date'       => filemtime($file),
            'readable'   => is_readable($file),
            'writable'   => is_writable($file),
            'executable' => is_executable($file),
            'permission' => fileperms($file)
        ];
    }
730779
protected function _fileGetContents($file)
    {
        if (!is_file($file)) {
            return false;
        }

        if ($this->_options['mode'] == 1) {
            $f = @fopen($file, 'r');
            @$data = fread($f, filesize($file));
            @fclose($f);
            return unserialize($data);
        } else {
            return include $file;
        }
    }
616419
public static function get(
        $file
    ) {
        if (is_string($file)) {
            $file = new \SplFileInfo($file);
        }

        $extension = mb_strtolower($file->getExtension());
        if ('' === $extension) {
            return static::MIME_TYPE_IF_UNKNOWN;
        }

        if (array_key_exists($extension, static::$mimeTypes)) {
            return static::$mimeTypes[$extension];
        }

        if (function_exists('finfo_open') && $file->isFile()) {
            $path = $file->getPath();

            $fileInfo = finfo_open(FILEINFO_MIME);
            $mimeType = finfo_file($fileInfo, $path);
            finfo_close($fileInfo);

            return $mimeType;
        }

        return static::MIME_TYPE_IF_UNKNOWN;
    }
870652
public function findByFile($file)
    {
        if ($file instanceof File) {
            $file = $file->getFileID();
        }

        return $this->findBy([
            'file_id' => $file
        ]);
    }
54826
final protected function getImageInfo($file)
    {
        $image = getimagesize($file);

        if ($image !== false) {
            return array(
                'width' => $image[0],
                'height' => $image[1],
                'type' => $image[2],
                'mime' => $image['mime'],
                'bits' => isset($image['bits']) ? $image['bits'] : null
            );
        } else {
            return false;
        }
    }