Verify path exists and is non-empty

@param  string $path
@return bool
770837
protected function _verifyPath($path)
    {
        $path = realpath($path);
        $base = realpath($this->_options['public_dir']);
        return strncmp($path, $base, strlen($base)) !== 0;
    }
1150756
public static function checkPath($path)
    {
        if (!is_string($path)) {
            throw new InvalidArgumentException(sprintf("String expected as path, got '%s' instead", gettype($path)));
        }
        if (!file_exists($path)) {
            throw new InvalidArgumentException(sprintf("'%s' does not exist", $path));
        }

        if (!is_dir($path)) {
            throw new InvalidArgumentException(sprintf("'%s' is not a directory", $path));
        }

        if (!is_readable($path)) {
            throw new InvalidArgumentException(sprintf("'%s' is not readable", $path));
        }

        return true;
    }
338294
public function pathExists(string $path): bool
	{
		try
		{
			$this->getRenderer()->getLoader()->load($path);

			return true;
		}
		catch (\Mustache_Exception_UnknownTemplateException $e)
		{
			return false;
		}
	}
453411
function file_exists($path)
    {
        if ($this->use_stat_cache) {
            $path = $this->_realpath($path);

            $result = $this->_query_stat_cache($path);

            if (isset($result)) {
                // return true if $result is an array or if it's an stdClass object
                return $result !== false;
            }
        }

        return $this->stat($path) !== false;
    }
255019
public function folderExists($path)
    {
        $folderName = basename($path);
        $folderPath = dirname($path);

        $path = self::validatePath($folderPath);
        $fullPath = $this->getMediaPath($path);

        $folders = $this->getStorageDisk()->directories($fullPath);
        foreach ($folders as $folder) {
            if (basename($folder) == $folderName) {
                return true;
            }
        }

        return false;
    }
609107
public function hasDir($path)
    {
        $meta = $this->getMetadata($path);
        return ($meta && isset($meta['hasdir'])) ? $meta : [
            'hasdir' => true
        ];
    }
108116
public function isValidSolrPath($path)
    {
        $path = trim($path);

        if ((!empty($path)) && (preg_match('/^[^*?"<>|:#]*$/', $path))) {
            return true;
        }

        return false;
    }
1151546
public function has($path)
    {
        $x = $this->xpath($path);

        return count($x) ? true : false;
    }
680782
public function exists($path)
    {
        foreach ($this->route->getList() as $route) {
            if (isset($route['pattern']) && $route['pattern'] === $path) {
                return true;
            }
        }

        return (bool) $this->get(array('alias' => $path));
    }
701391
public function verify($path) {
		$full_path = realpath($path);
		$data = @getimagesize($full_path);
		if (!$data) {
			throw new FileException(sprintf('File "%s" cannot be read.', $path), 1);
		}
		if ($data[2] != IMG_JPG) {
			throw new FileException(sprintf('File "%s" is not a JPG.', $path), 240);
		}
		if ($data[0] < 600 || $data[1] < 600) {
			throw new FileException(sprintf('File "%s" is too small.', $path), 241);
		}
		return $full_path;
	}
1276347
public static function exists($path, $sensitive = false)
    {
        if ($sensitive === null) {
            return file_exists($path);
        }

        $path = Path::clean($path, DIRECTORY_SEPARATOR);

        if (!$sensitive) {
            $lowerfile = strtolower($path);

            foreach (glob(dirname($path) . DIRECTORY_SEPARATOR . '*') as $file) {
                if (strtolower($file) === $lowerfile) {
                    return true;
                }
            }
        } else {
            foreach (glob(dirname($path) . DIRECTORY_SEPARATOR . '*') as $file) {
                if ($file === $path) {
                    return true;
                }
            }
        }

        return false;
    }
648993
public function isEmpty($path)
    {
        try {
            $value = $this->get($path);
        } catch (\OutOfBoundsException $e) {
            return true;
        }
        return '' === $value || null === $value;
    }
715668
protected function nodeExists( $path )
    {
        if ( !isset( $this->cachedNodes[$path] ) )
        {
            $this->cachedNodes[$path] = $this->getNodeInfo( $path );
        }

        return $this->cachedNodes[$path]['nodeExists'];
    }
48429
public function imageExists($path) {
        $this->validateLocalFile($path);
        $checksum = md5_file($path);
        $query = new ImagesQuery();
        $query->originalChecksums(array($checksum))
              ->limit(1);

        $response = $this->getImages($query);

        return (boolean) $response['search']['hits'];
    }
692763
protected function isEmptyDir($path)
    {
        if ($this->fs->exists($path) === true) {
            $finder = new Finder();
            $finder->in($path);

            $iterator = $finder->getIterator();
            $iterator->next();

            return iterator_count($iterator) === 0;
        }

        return true;
    }
390572
public static function exists($path)
    {
        if (file_exists($path) === false) {
            return false;
        }

        $path = preg_replace('#^file:/+([a-z]:/|/)#i', '$1', $path);
        $pinfo = pathinfo($path);

        $rpath = strtr(realpath($path), '\\', '/');

        if ($pinfo['dirname'] !== '.') {
            $path = Uri::canonpath($pinfo['dirname']) . '/' . $pinfo['basename'];
        }

        $pinfo = null;

        return $rpath === $path || substr($rpath, strlen($rpath) - strlen($path)) === $path;
    }
294570
public function pathExists($path)
    {
        if (!is_string($path)) {
            throw new InvalidArgumentException('The path must be a string.');
        }

        return $this->globRecursive($this->basePath().'/'.$path, GLOB_BRACE);
    }