Check file from registered path

@param null $file
@return string
350034
public function path($file = null)
    {
        $base_path = Composer::getRootPath();

        $pieces = explode('/', $file);

        # Add public to the path

        array_splice($pieces, 2, 0, 'public');

        $vendor_path = implode('/', $pieces);

        if(is_file($base_path.'/workbench/'. $vendor_path)){
            return $base_path.'/workbench/'. $vendor_path;
        } elseif(is_file($base_path.'/vendor/'. $vendor_path)){
            return $base_path.'/vendor/'. $vendor_path;
        } else {
            foreach($this->_paths as $path){
                $currentPath = $base_path.'/'.$path.'/'. $file;
                if (is_file($currentPath)) {
                    return $currentPath;
                }
            }
        }

        return false;
    }
800209
public function getFiles($file = null)
    {
        if ($file !== null) {
            $return = array();
            foreach ($this->_files as $name => $content) {
                if ($name === $file) {
                    $return[$file] = $this->_files[$name];
                }

                if ($content['name'] === $file) {
                    $return[$name] = $this->_files[$name];
                }
            }

            if (count($return) === 0) {
                require_once 'Zend/Validate/Exception.php';
                throw new Zend_Validate_Exception("The file '$file' was not found");
            }

            return $return;
        }

        return $this->_files;
    }
115316
public function export($file = null)
    {
        if ($file) {
            return isset($this->_coverage[$file]) ? $this->_coverage($file, $this->_coverage[$file]) : [];
        }
        $result = [];
        $base = preg_quote($this->base(), '~');
        foreach ($this->_coverage as $file => $rawCoverage) {
            if ($coverage = $this->_coverage($file, $rawCoverage)) {
                $result[preg_replace("~^{$base}~", '', $file)] = $coverage;
            }
        }
        return $result;
    }
1183454
public static function getSystemPath($file = null)
    {
        $path = self::getStringBaseValue('system_files_path', 'resources/laravel-code-generator/system');

        return Helpers::getPathWithSlash($path) . $file;
    }
1093342
public function getFileWebPath(AbstractFile $file = null)
    {
        if (!$file) {
            return '';
        }
        return $this->assetsHelper->getUrl(sprintf('%s/%s',
            $this->getUploadDir($file->isUploaded() ? 'tmp_path' : 'upload_files_path'),
            $file->getPath()
        ));
    }
968466
protected function parse_file($file = null) {
        if (is_null($file)) {
            $file = $this->file;
        }

        if (empty($this->file_data)) {
            $this->load_data($file);
        }

        return !empty($this->file_data) ? $this->parse_string() : false;
    }
1179926
public function transformFileToFilePath($file)
    {
        //confirm we have a file
        $filePath = null;
        if (is_string($file)) {
            $filePath = $file;
        } elseif (is_object($file) && $file->is_a("File")) {
            $filePath = $file->Filename;
        }

        if (!$filePath) {
            throw new FileNotFoundException();
        }

        return $filePath;
    }
33439
private function getExamplePathFromSource(string $file): string
    {
        return sprintf(
            '%s%s%s',
            trim($this->getSourceDirectory(), '\\/'),
            DIRECTORY_SEPARATOR,
            trim($file, '"')
        );
    }
1258392
public static function database_path(?string $file = null)
  {
    $file = (substr($file, 0, 1) == DIRECTORY_SEPARATOR ? substr($file, 1) : $file);
    return config('app.dir') . 'database' . DIRECTORY_SEPARATOR . $file;
  }
567288
public function locateFile($file)
    {
        $components = $this->parseResource($file);
        if ($components['path']) {
            $path = dirname($components['path']) . '/public/';

            return $path . $components['file'];
        } else {
            return $components['file'];
        }
    }
1119406
final public function getPath($file = "", $default = null)
    {

        $file = (empty($file) && isset($this->file)) ? $this->file : $file;

        if (empty($file)) {
            return $default;
        }

        //Determine the file extension
        return pathinfo($file, PATHINFO_DIRNAME);
    }
63624
public function getResourceByFile(File $file) {
        if (isset($this->resources[md5($file->getAbsolutePath())])) {
            return $this->resources[md5($file->getAbsolutePath())];
        } else {
            return null;
        }
    }
217807
public function getFilePath($file): string
    {
        if (null === ($fileObj = $this->container->get('huh.utils.file')->getFileFromUuid($file))) {
            return '';
        }

        return $fileObj->path;
    }
572106
public static function check($filename)
    {
        if (!$filename = static::path($filename)) {
            return null;
        }

        if (!file_exists($filename)) {
            return null;
        }

        return filemtime($filename);
    }
1225663
public function validatePhpFile($file)
    {
        if (!$this->canValidatePhpCode()) {
            return null;
        }

        $output = shell_exec('php -l ' . escapeshellarg($file));

        $count = 0;
        $error = preg_replace('/Errors parsing.*$/', '', $output, -1, $count);
        return $count > 0 ? trim("$error") : true;
    }
1103695
public function getMatchRoad(File $file) {
        foreach ($this->roadMap as $road) {
            /* @var $road SourceRoad */
            if ($road->resourceCheck($file)) {
                return $road;
            }
        }
        return NULL;
    }
806740
static public function getFileExt($file)
    {
        $s = strrchr($file, '.');
        if ($s === false)
        {
            return false;
        }
        return strtolower(trim(substr($s, 1)));
    }