public function setDirectory($directory)
    {
        Assert::stringNotEmpty($directory, 'The factory directory must be a non-empty string. Got: %s');

        $this->directory = Path::canonicalize($directory);

        return $this;
    }