public function track($trackingId, $resource, $eventsMask = FilesystemEvent::ALL)
    {
        if ('all' === $trackingId) {
            throw new InvalidArgumentException(
                '"all" is a reserved keyword and can not be used as tracking id'
            );
        }

        if (!$resource instanceof ResourceInterface) {
            if (is_file($resource)) {
                $resource = new FileResource($resource);
            } elseif (is_dir($resource)) {
                $resource = new DirectoryResource($resource);
            } else {
                throw new InvalidArgumentException(sprintf(
                    'Second argument to track() should be either file or directory resource, '.
                    'but got "%s"',
                    $resource
                ));
            }
        }

        $trackedResource = new TrackedResource($trackingId, $resource);
        $this->getTracker()->track($trackedResource, $eventsMask);
    }
public function track($trackingId, $resource, $eventsMask = FilesystemEvent::ALL)
    {
        if ('all' === $trackingId) {
            throw new InvalidArgumentException(
                '"all" is a reserved keyword and can not be used as tracking id'
            );
        }

        if (!$resource instanceof ResourceInterface) {
            if (is_file($resource)) {
                $resource = new FileResource($resource);
            } elseif (is_dir($resource)) {
                $resource = new DirectoryResource($resource);
            } else {
                throw new InvalidArgumentException(sprintf(
                    'Second argument to track() should be either file or directory resource, '.
                    'but got "%s"',
                    $resource
                ));
            }
        }

        $trackedResource = new TrackedResource($trackingId, $resource);
        $this->getTracker()->track($trackedResource, $eventsMask);
    }
public function track ( $ trackingId , $ resource , $ eventsMask = FilesystemEvent :: ALL ) { if ( 'all' === $ trackingId ) { throw new InvalidArgumentException ( '"all" is a reserved keyword and can not be used as tracking id' ) ; } if ( ! $ resource instanceof ResourceInterface ) { if ( is_file ( $ resource ) ) { $ resource = new FileResource ( $ resource ) ; } elseif ( is_dir ( $ resource ) ) { $ resource = new DirectoryResource ( $ resource ) ; } else { throw new InvalidArgumentException ( sprintf ( 'Second argument to track() should be either file or directory resource, ' . 'but got "%s"' , $ resource ) ) ; } } $ trackedResource = new TrackedResource ( $ trackingId , $ resource ) ; $ this -> getTracker ( ) -> track ( $ trackedResource , $ eventsMask ) ; }
Track resource with watcher.

@param string                   $trackingId id to this track (used for events naming)
@param ResourceInterface|string $resource   resource to track
@param integer                  $eventsMask event types bitmask

@throws InvalidArgumentException If 'all' is used as a tracking id
Track resource with watcher .