public function fileExists($path, $trackContents = true)
    {
        $exists = file_exists($path);

        if (!$this->trackResources || $this->inVendors($path)) {
            return $exists;
        }

        if (!$exists) {
            $this->addResource(new FileExistenceResource($path));

            return $exists;
        }

        if (is_dir($path)) {
            if ($trackContents) {
                $this->addResource(new DirectoryResource($path, is_string($trackContents) ? $trackContents : null));
            } else {
                $this->addResource(new GlobResource($path, '/*', false));
            }
        } elseif ($trackContents) {
            $this->addResource(new FileResource($path));
        }

        return $exists;
    }
public function fileExists($path, $trackContents = true)
    {
        $exists = file_exists($path);

        if (!$this->trackResources || $this->inVendors($path)) {
            return $exists;
        }

        if (!$exists) {
            $this->addResource(new FileExistenceResource($path));

            return $exists;
        }

        if (is_dir($path)) {
            if ($trackContents) {
                $this->addResource(new DirectoryResource($path, is_string($trackContents) ? $trackContents : null));
            } else {
                $this->addResource(new GlobResource($path, '/*', false));
            }
        } elseif ($trackContents) {
            $this->addResource(new FileResource($path));
        }

        return $exists;
    }
public function fileExists ( $ path , $ trackContents = true ) { $ exists = file_exists ( $ path ) ; if ( ! $ this -> trackResources || $ this -> inVendors ( $ path ) ) { return $ exists ; } if ( ! $ exists ) { $ this -> addResource ( new FileExistenceResource ( $ path ) ) ; return $ exists ; } if ( is_dir ( $ path ) ) { if ( $ trackContents ) { $ this -> addResource ( new DirectoryResource ( $ path , is_string ( $ trackContents ) ? $ trackContents : null ) ) ; } else { $ this -> addResource ( new GlobResource ( $ path , '/*' , false ) ) ; } } elseif ( $ trackContents ) { $ this -> addResource ( new FileResource ( $ path ) ) ; } return $ exists ; }
Checks whether the requested file or directory exists and registers the result for resource tracking.

@param string      $path          The file or directory path for which to check the existence
@param bool|string $trackContents Whether to track contents of the given resource. If a string is passed,
it will be used as pattern for tracking contents of the requested directory

@return bool

@final
Checks whether the requested file or directory exists and registers the result for resource tracking .