Augmentation vers version 3.3.0

This commit is contained in:
Gauvain Boiché
2020-03-31 15:31:03 +02:00
parent d926806907
commit a1864c0414
2618 changed files with 406015 additions and 31377 deletions

View File

@@ -24,11 +24,17 @@ class DirectoryResource implements SelfCheckingResourceInterface, \Serializable
/**
* @param string $resource The file path to the resource
* @param string|null $pattern A pattern to restrict monitored files
*
* @throws \InvalidArgumentException
*/
public function __construct($resource, $pattern = null)
{
$this->resource = $resource;
$this->resource = realpath($resource) ?: (file_exists($resource) ? $resource : false);
$this->pattern = $pattern;
if (false === $this->resource || !is_dir($this->resource)) {
throw new \InvalidArgumentException(sprintf('The directory "%s" does not exist.', $resource));
}
}
/**
@@ -36,11 +42,11 @@ class DirectoryResource implements SelfCheckingResourceInterface, \Serializable
*/
public function __toString()
{
return md5(serialize(array($this->resource, $this->pattern)));
return md5(serialize([$this->resource, $this->pattern]));
}
/**
* {@inheritdoc}
* @return string The file path to the resource
*/
public function getResource()
{
@@ -98,11 +104,17 @@ class DirectoryResource implements SelfCheckingResourceInterface, \Serializable
return true;
}
/**
* @internal
*/
public function serialize()
{
return serialize(array($this->resource, $this->pattern));
return serialize([$this->resource, $this->pattern]);
}
/**
* @internal
*/
public function unserialize($serialized)
{
list($this->resource, $this->pattern) = unserialize($serialized);