Accept an object or class name that implements StripperInterface

@param string|StripperInterface $stripper
543525
public function addStripper($stripper)
    {
        if (is_string($stripper)) {
            if (!class_exists($stripper)) {
                $stripper = '\\' . __NAMESPACE__ . '\\Stripper\\' . $stripper;
                if (!class_exists($stripper)) {
                    throw new \InvalidArgumentException('Class ' . $stripper . ' can not be found');
                }
            }

            $stripper = new $stripper;
            if (!$stripper instanceof StripperInterface) {
                throw new InvalidArgumentException('Class "' . get_class($stripper) . '" must implement StripperInterface');
            }

        } elseif (!$stripper instanceof StripperInterface) {
            throw new InvalidArgumentException('Class "' . get_class($stripper) . '" must implement StripperInterface');
        }

        $this->_stippers[] = $stripper;
    }
1154848
public static function unregisterWrapper($wrapper)
    {
        $index = array_search((string) $wrapper, static::$wrapperRegistry, true);
        if ($index !== false) {
            unset(static::$wrapperRegistry[$index]);
        }
    }
887810
public function addValidator(ValidatorInterface $validator)
    {
        if ($validator instanceof ObjectValidatorInterface) {
            $validator->setValidatedInstancesContainer = $this->validatedInstancesContainer;
        }
        $this->validators->attach($validator);
    }
656937
public function setClass($class = '')
    {
        if (is_string($class) && (empty($class) === true || Format::isClass($class) === true)) {
            $class = trim($class);
            $this->class = $class;
        } else {
            $msg = "The 'class' argument must be a valid class name, '" . $class . "' given";
            throw new InvalidArgumentException($msg);
        }
    }
427410
private function doDetectByInterfaces($className)
    {
        $interfaces = $this->getOrderedInterfaces($className);
        foreach ($interfaces as $interface) {
            $candidate = $this->doDetectByRoutes($interface);
            if ($candidate) {
                return $candidate;
            }
        }

        return;
    }
566706
public function handle(ResourceInterface $resource, RepositoryInterface $repository): void
    {
        try {
            $this->decoratedHandler->handle($resource, $repository);
        } catch (ORMException $exception) {
            throw new DeleteHandlingException();
        }
    }
1035978
public function with($value): ValidableInterface
    {
        parent::with($value);
        
        if (false === ($value instanceof EntityInterface)) {
            throw new ValidatorException(sprintf('Validator accept only (%s) objects', EntityInterface::class));
        }
        
        return $this;
    }
673098
private function doDetect($className, $performInterfaceDetection = true)
    {
        $detection = $this->doDetectByRoutes($className);
        if ($detection) {
            return $detection;
        }
        //Nothing is found so far. We will check all of the class interfaces and base classes.
        //First - check base classes up to the 'root'
        $parentClass = get_parent_class($className);
        if ($parentClass) {
            $parentDetection = $this->doDetect($parentClass, false);
            if ($parentDetection instanceof ClassDetection) {
                return $parentDetection;
            }
        }
        //Check the class interfaces
        if ($performInterfaceDetection) {
            $definition = $this->doDetectByInterfaces($className);
            if ($definition) {
                return $definition;
            }
        }

        return new DefaultDetection($this->defaultRoute);
    }
769017
public function setApiVersion($version)
    {
        if (!in_array($version, $this->availableVersions, true)) {
            throw new UnsupportedStripeVersionException(sprintf(
                'The given Stripe version ("%s") is not supported by ZfrStripe. Value must be one of the following: "%s"',
                $version,
                implode(', ', $this->availableVersions)
            ));
        }

        $this->version = (string) $version;
        $this->setDefaultOption('headers', ['Stripe-Version' => $this->version]);

        if ($this->version < '2015-08-19') {
            $descriptor = __DIR__ . '/ServiceDescription/Stripe-v1.0.php';
        } else {
            $descriptor = __DIR__ . '/ServiceDescription/Stripe-v1.1.php';
        }

        // Note that we need to recreate a whole new CompositeFactory whenever the version is changed
        $this->setCommandFactory(new CompositeFactory());
        $this->setDescription(ServiceDescription::factory($descriptor));
    }
307961
private function transformer($transformer)
    {
        if (is_string($transformer) && class_exists($transformer)) {
            $transformer = new $transformer();
        }
        if (is_object($transformer) && method_exists($transformer, 'transform')) {
            $transformer = [$transformer, 'transform'];
        }

        return is_callable($transformer) ? $transformer : false;
    }
1370035
private function doesImplementEventInterface(string $classOrInterface): bool
    {
        $isClass     = class_exists($classOrInterface, true);
        $isInterface = interface_exists($classOrInterface, true);
        assert($isClass xor $isInterface);

        $isEvent = in_array(EventInterface::class, class_implements($classOrInterface));

        return $isEvent;
    }
145583
def with_wrapper(self, wrapper=None, name=None):
        
        name = name or '{}_custom_wrapper'.format(self.name)
        return self.__class__(self.data, name=name, wrapper=wrapper)
738703
public static function fromInvalidResolver($resolver) : self
    {
        return new self(sprintf(
            'Invalid resolver found, expected `' . ResolverInterface::class . '`, `%s` given.',
            is_object($resolver) ? get_class($resolver) : gettype($resolver)
        ));
    }
201063
function accept(&$renderer, $required=false, $error=null)
    {
        $this->_text .= $this->getHelpButton();
        $renderer->renderHeader($this);
    }
704254
public function attributeUseObject(
        string $attribute,
        ClassName $className,
        string $setter,
        string $getter
    ): ObjectInterface {
        $this->attributes[$attribute] = new Type\Object($className, $setter, $getter);

        return $this;
    }
1034255
public function addInterceptor(string $include, BaseInterface $interceptor, $exclude = null) {
		$add = ['handler' => $interceptor];
		if ($include === '**' || $include === '/**') {
			$add['all'] = true;
		} elseif (strpos($include, '*') !== false) {
			$regex = str_replace('/', '\\/', $include);
			$regex = str_replace('\\/**', '(.*?)', $regex);
			$regex = str_replace('**', '(.*?)', $regex);
			$regex = str_replace('*', '([^\/]?)', $regex);
			$add['regex'] = '/^' . $regex . '$/';
		} else {
			$add['uri'] = $include;
		}
		if ($exclude !== null) {
			$add['exclude'] = $exclude;
		}
		if ($interceptor instanceof BeforeInterface) {
			array_unshift($this->interceptor['before'], $add);
		}
		if ($interceptor instanceof AfterInterface) {
			array_unshift($this->interceptor['after'], $add);
		}
	}
752278
public function setAdapter($adapter)
    {
        if (!is_string($adapter) && !$adapter instanceof ConversionAlgorithmInterface) {
            throw new Exception\InvalidArgumentException(sprintf(
                '"%s" expects a string or an instance of ConversionAlgorithmInterface; received "%s"',
                __METHOD__,
                is_object($adapter) ? get_class($adapter) : gettype($adapter)
            ));
        }
        if (is_string($adapter)) {
            if (!class_exists($adapter)) {
                throw new Exception\RuntimeException(sprintf(
                    '"%s" unable to load adapter; class "%s" not found',
                    __METHOD__,
                    $adapter
                ));
            }
            $adapter = new $adapter();
            if (!$adapter instanceof ConversionAlgorithmInterface) {
                throw new Exception\InvalidArgumentException(sprintf(
                    '"%s" expects a string representing an instance of ConversionAlgorithmInterface; received "%s"',
                    __METHOD__,
                    is_object($adapter) ? get_class($adapter) : gettype($adapter)
                ));
            }
        }
        $this->adapter = $adapter;

        return $this;
    }