Checks if a path is valid.

@param array $ancestors

@return boolean
506709
public function isPathValid(array $ancestors)
    {
        $continue = true;

        for ($i = 0, $size = count($ancestors); $i < $size; $i++) {
            if (isset($ancestors[$i + 1])) {
                if ($ancestors[$i + 1]->getParent() === $ancestors[$i]) {
                    $continue = true;
                } else {
                    $continue = $this->hasLinkTo($ancestors[$i], $ancestors[$i + 1]);
                }
            }

            if (!$continue) {
                return false;
            }
        }

        return true;
    }
1216936
public function isValid()
  {
    return ($this->checkUser() && $this->checkPass() && $this->checkHost() && $this->checkPort() && $this->checkPath() && $this->checkQuery() && $this->checkFragment());
  }
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;
    }
1177560
public function isValid(): bool
    {
        $uris = [];
        foreach ($this->members as $member) {
            $uri = $member->uri;
            if ($uri) {
                if (isset($uris[$uri])) {
                    return false;
                } else {
                    $uris[$uri] = true;
                }
            }
        }
        return true;
    }
935936
public function matchesFieldKeys(array $keys): bool
    {
        if ( ! count($keys)) return false;

        return count(array_intersect($keys, $this->descendantFieldKeys())) > 0;
    }
660102
public static function isAbsolutePath($path): bool
    {
        return strspn($path, '/\\', 0, 1)
            || (strlen($path) > 3 && ctype_alpha($path[0])
                && ':' === $path[1]
                && strspn($path, '/\\', 2, 1)
            )
            || null !== parse_url($path, PHP_URL_SCHEME);
    }
327122
public function validateStoragePath()
    {
        if (!$this->files->exists($this->storage)) {
            return $this->files->makeDirectory($this->storage);
        }

        return true;
    }
934609
protected function validate_path($value) {

        // The last item should be the parent ID.
        $id = $this->get('parentid');
        if (substr($value, -(strlen($id) + 2)) != '/' . $id . '/') {
            return new lang_string('invaliddata', 'error');

        } else if (!preg_match('@/([0-9]+/)+@', $value)) {
            // The format of the path is not correct.
            return new lang_string('invaliddata', 'error');
        }

        return true;
    }
916826
protected function hasParent()
    {
        list ($resource, ) = $this->getCurrent();

        return isset($this->parents[$resource->getHash()]);
    }
1223984
public function isValid($key = null)
    {
        if (parent::isValid()) {
            if ($key && parent::getKey() && parent::getKey() == $key) {
                return true;
            }
        }

        return false;
    }
553345
function asPath({ ancestors }) {
  const path = [];

  for (const { key } of ancestors) {
    if (key != null) {
      if (typeof key === 'number') {
        path.push(`[${key}]`);
      } else {
        path.push(`['${stringify(key).slice(1, -1)}']`);
      }
    }
  }

  return path.join('');
}
219811
protected function hasData(array $parents)
    {
        $countryCode = $parents[0];
        $addressFormat = $this->addressFormatRepository->get($countryCode);
        $depth = $addressFormat->getSubdivisionDepth();
        if ($depth == 0) {
            return false;
        }
        // At least the first level has data.
        $hasData = true;
        if (count($parents) > 1) {
            // After the first level it is possible for predefined subdivisions
            // to exist at a given level, but not for that specific parent.
            // That's why the parent definition has the most precise answer.
            $grandparents = $parents;
            $parentId = array_pop($grandparents);
            $parentGroup = $this->buildGroup($grandparents);
            if (isset($this->definitions[$parentGroup]['subdivisions'][$parentId])) {
                $definition = $this->definitions[$parentGroup]['subdivisions'][$parentId];
                $hasData = !empty($definition['has_children']);
            } else {
                // The parent definition wasn't loaded previously, fallback
                // to guessing based on depth.
                $neededDepth = count($parents);
                $hasData = ($neededDepth <= $depth);
            }
        }
        return $hasData;
    }
869537
protected function isValidArchive($validateLicenseFilePresence = false)
    {
        if ($validateLicenseFilePresence) {
            return $this->archiveValidator->shouldHaveLicenseFile()->validate(
                $this->analyser->collectExpectedExportIgnores()
            );
        }

        return $this->archiveValidator->validate(
            $this->analyser->collectExpectedExportIgnores()
        );
    }
671326
protected function is_valid_path($path)
	{
		if(strpos($path, $this->rootWrapperPath) !== 0) {
			return false;
		}

		$needleList = ['..', './'];
		foreach($needleList as $needle) {
			if (strpos($path, $needle) !== false) {
				return false;
			}
		}

		return true;
	}
695238
public function has ($path) {
		try {
			$this -> get($path);
			return true;
		} catch (InvalidKeyException $e) {
			return false;
		} catch (NonExistentKeyException $e) {
			return false;
		}
	}
1141848
public function valid() : bool
    {
        // The null check is cardinal; without it foreach runs out of bounds.
        $key = key($this->explorableIndex);
        return $key !== null && $key < count($this->explorableIndex);
    }
631318
public function valid() {
        if (!isset($this->za)) {
            return false;
        }

        // Skip over unwanted system files (get_info will return false).
        while (!$this->get_info($this->pos) && $this->pos < $this->za->numFiles) {
            $this->next();
        }

        // No files left - we're at the end.
        if ($this->pos >= $this->za->numFiles) {
            return false;
        }

        return true;
    }