public function setTargetDirectory($dir)
    {
        if (! is_string($dir) || empty($dir)) {
            throw new InvalidArgumentException(sprintf(
                'Invalid target directory provided; must be a non-empty '
                . 'string, "%s" received.',
                is_object($dir) ? get_class($dir) : gettype($dir)
            ));
        }
        $this->targetDirectory = $dir;
    }