public __construct ( AppserverIo\Appserver\Application\Interfaces\ContextInterface $initialContext, string $name, string $directory, integer $interval = 1, string $extensionsToWatch = '' ) | ||
$initialContext | AppserverIo\Appserver\Application\Interfaces\ContextInterface | The initial context instance |
$name | string | The unique scanner name from the configuration |
$directory | string | The directory we want to scan |
$interval | integer | The interval in seconds we want scan the directory |
$extensionsToWatch | string | The comma separated list with extensions of files we want to watch |
public function __construct($initialContext, $name, $directory, $interval = 1, $extensionsToWatch = '')
{
// call parent constructor
parent::__construct($initialContext, $name);
// initialize the members
$this->interval = $interval;
$this->directory = $directory;
// explode the comma separated list of file extensions
$this->extensionsToWatch = explode(',', str_replace(' ', '', $extensionsToWatch));
// immediately start the scanner
$this->start();
}