@param mixed $instantiator

@return self
3869
public static function fromInvalidInstantiator($instantiator) : self
    {
        return new self(sprintf(
            'Invalid instantiator given, expected `callable`, `%s` given.',
            is_object($instantiator) ? get_class($instantiator) : gettype($instantiator)
        ));
    }
88585
public function createFromReflector(\Reflector $reflector)
    {
        if (method_exists($reflector, 'getDeclaringClass')) {
            $reflector = $reflector->getDeclaringClass();
        }

        $fileName = $reflector->getFileName();
        $namespace = $reflector->getNamespaceName();

        if (file_exists($fileName)) {
            return $this->createForNamespace($namespace, file_get_contents($fileName));
        }

        return new Context($namespace, []);
    }
124370
public static function instance(): self
    {
        if (!self::$instance) {
            self::$instance = new self(
                MatcherFactory::instance(),
                ExceptionAssertionRecorder::instance(),
                AssertionRenderer::instance()
            );
        }

        return self::$instance;
    }
488549
public static function createInstance($kind = ParserFactory::PREFER_PHP7): self
    {
        $parser = (new ParserFactory())->create($kind);
        $traverser = new NodeTraverser();
        $traverser->addVisitor(new NameResolver());
        $traverser->addVisitor(new ElementNameResolver());
        return new static($parser, $traverser);
    }
1101031
public function withSeparator(string $separator): self
    {
        if ($separator === $this->separator) {
            return $this;
        }

        $clone = clone $this;
        $clone->separator = $this->filterSeparator($separator);

        return $clone;
    }
27922
public function setTransformer($transformer)
    {
        if (!(new \ReflectionClass($transformer))->implementsInterface(TransformerInterface::class)) {
            throw new InvalidTransformer();
        }

        $this->transformer = $transformer;

        return $this;
    }
1138976
public function setValidator($validator)
    {
        $this->clearCache();
        $this->validators = [];
        $this->addValidator($validator);

        return $this;
    }
1031433
public static function create(
        array $visitors = [],
        InstantiatorInterface $instantiator = null,
        AccessorInterface $accessor = null,
        MutatorInterface $mutator = null
    ) {
        $instantiator = $instantiator ?: new DoctrineInstantiator();
        $accessor = $accessor ?: new ReflectionAccessor();
        $mutator = $mutator ?: new ReflectionMutator();

        return new static(array_replace_recursive([
            Direction::SERIALIZATION => [
                Format::CSV  => new CsvSerializationVisitor($accessor),
                Format::JSON => new JsonSerializationVisitor($accessor),
                Format::XML  => new XmlSerializationVisitor($accessor),
                Format::YAML => new YamlSerializationVisitor($accessor),
            ],
            Direction::DESERIALIZATION => [
                Format::CSV  => new CsvDeserializationVisitor($instantiator, $mutator),
                Format::JSON => new JsonDeserializationVisitor($instantiator, $mutator),
                Format::XML  => new XmlDeserializationVisitor($instantiator, $mutator),
                Format::YAML => new YamlDeserializationVisitor($instantiator, $mutator),
            ],
        ], $visitors));
    }
161624
public function addValidator($validator)
    {
        if (!($validator instanceof ValidatorInterface) && !is_callable($validator)) {
            $validator = ValidatorHelper::create($validator);
        }

        $this->validator->addValidator($validator);

        return $this;
    }
707942
public function setTenantor(?Tenantor $tenantor)
    {
        $this->tenantor = $tenantor;
        $this->connection = $tenantor->getTenantConnectionName();

        $this->setTable($this->getTenantTable());

        return $this;
    }
220393
public static function instance(Autoload\ClassLoader $classLoader = null): self
    {
        static $instance;
        if (!$instance) {
            $instance = new self($classLoader);
        }
        return $instance;
    }
918980
public function toInstance($instance) : self
    {
        $this->untarget = null;
        $this->bound = new Instance($instance);
        $this->container->add($this);

        return $this;
    }
33827
public static function instance(): self
    {
        if (!self::$instance) {
            self::$instance = new self(
                Sequencer::sequence('spy-label'),
                CallFactory::instance(),
                Invoker::instance(),
                GeneratorSpyFactory::instance(),
                IterableSpyFactory::instance()
            );
        }

        return self::$instance;
    }
57240
public static function instance(): self
    {
        if (!self::$instance) {
            self::$instance = new self(
                Sequencer::sequence('mock-label'),
                MockGenerator::instance(),
                HandleFactory::instance()
            );
        }

        return self::$instance;
    }
962728
public static function instance(): self
    {
        if (!self::$instance) {
            self::$instance = new self(
                InvocableInspector::instance(),
                Invoker::instance()
            );
        }

        return self::$instance;
    }
87510
public function setRenderer($renderer)
    {
        $this->renderer = $renderer instanceof AbstractRenderer ?: $this->getRendererManager()->getRenderer((string) $renderer);

        return $this;
    }
586426
public static function createInstance(): self
    {
        return new static(
            [
                new Factory\Argument(new PrettyPrinter()),
                new Factory\Class_(),
                new Factory\Constant(new PrettyPrinter()),
                new Factory\DocBlock(DocBlockFactory::createInstance()),
                new Factory\File(NodesFactory::createInstance()),
                new Factory\Function_(),
                new Factory\Interface_(),
                new Factory\Method(),
                new Factory\Property(new PrettyPrinter()),
                new Factory\Trait_(),
            ]
        );
    }