public function getProperty(string $path, string $property = null)
{
// Asking random server
$path = $this->getFilePath($path);
$response = $this->sendRequest($path, self::METHOD_PROPFIND, ['Depth' => '0']);
if (self::STATUS_207_MULTI_STATUS !== $response->getStatusCode()) {
throw new FileNotExistException(sprintf('File %s does not exist.', $path));
}
// Fetches file properties from the server
$properties = $this->getProperties($response);
// Returns the requested property value
if ($property !== null && isset($properties[$property])) {
return $properties[$property];
}
// Returns all properties
return $properties;
}