@param GeometryInterface $geometry

@throws InvalidArgumentException
504148
private function checkEllipsoid(GeometryInterface $geometry)
    {
        if (bccomp($geometry->getPrecision(), $this->precision) === 1) {
            $this->precision = $geometry->getPrecision();
        }

        if ($this->ellipsoid === null) {
            $this->ellipsoid = $geometry->getEllipsoid();
        } elseif ($geometry->isEmpty() || $geometry->getEllipsoid() != $this->ellipsoid) {
            throw new InvalidArgumentException("Geometry is invalid");
        }
    }
716038
public function setGeometry(Geometry $geometry = null, bool $stopPropagation = false) {
        $this->geometry = $geometry;
        if($stopPropagation) {
            $this->stopPropagation();
        }
    }
1128509
public function init(ModuleManagerInterface $manager)
    {
        if (!$manager instanceof ModuleManager) {
            $errMsg =sprintf('Module manager not implement %s', ModuleManager::class);
            throw new Exception\InvalidArgumentException($errMsg);
        }

        
        /** @var ServiceLocatorInterface $sm */
        $sm = $manager->getEvent()->getParam('ServiceManager');

        if (!$sm instanceof ServiceLocatorInterface) {
            $errMsg = sprintf('Service locator not implement %s', ServiceLocatorInterface::class);
            throw new Exception\InvalidArgumentException($errMsg);
        }
        /** @var ServiceListenerInterface $serviceListener */
        $serviceListener = $sm->get('ServiceListener');
        if (!$serviceListener instanceof ServiceListenerInterface) {
            $errMsg = sprintf('ServiceListener not implement %s', ServiceListenerInterface::class);
            throw new Exception\InvalidArgumentException($errMsg);
        }


        $serviceListener->addServiceManager(
            EntryNameResolverManagerInterface::class,
            EntryNameResolverManager::CONFIG_KEY,
            EntryNameResolverProviderInterface::class,
            'getEntryNameResolverConfig'
        );

    }
714062
public function addCookie(CookieInterface $cookie)
    {
        if (!$cookie->getDomain() || !$cookie->getPath()) {
            throw new InvalidArgumentException('Cookie must have a domain and a path set.');
        }
        $this->_cookies = $this->_cookies->add($cookie);

        return $this;
    }
843902
public function serialize(EventInterface $event)
    {
        if (!$event instanceof \JsonSerializable) {
            throw new \InvalidArgumentException(sprintf('Cannot serialize %s event.', $event->getName()));
        }

        return json_encode($event);
    }
1030106
protected function sanitize_geometry( & $geometry)
	{
		list($width, $height) = $this->properties();

		// Turn off error reporting
		$reporting = error_reporting(0);

		// Width and height cannot exceed current image size
		$geometry['width']  = min($geometry['width'], $width);
		$geometry['height'] = min($geometry['height'], $height);

		// Set standard coordinates if given, otherwise use pixel values
		if ($geometry['top'] === 'center')
		{
			$geometry['top'] = floor(($height / 2) - ($geometry['height'] / 2));
		}
		elseif ($geometry['top'] === 'top')
		{
			$geometry['top'] = 0;
		}
		elseif ($geometry['top'] === 'bottom')
		{
			$geometry['top'] = $height - $geometry['height'];
		}

		// Set standard coordinates if given, otherwise use pixel values
		if ($geometry['left'] === 'center')
		{
			$geometry['left'] = floor(($width / 2) - ($geometry['width'] / 2));
		}
		elseif ($geometry['left'] === 'left')
		{
			$geometry['left'] = 0;
		}
		elseif ($geometry['left'] === 'right')
		{
			$geometry['left'] = $width - $geometry['height'];
		}

		// Restore error reporting
		error_reporting($reporting);
	}
43933
public function setContainer(ContainerInterface $container = null)
    {
        $this->container = $container;
        $this->eventDispatcher = $this->container->get('event_dispatcher');
    }
1306371
public function load(InputInterface $input): ConfigInterface
    {
        $configFile = $input->getOption('config');
        if (!$configFile || !$this->filesystem->fileExists($configFile)) {
            throw InvalidArgumentException::invalidConfigFile();
        }
        $config = include $configFile;
        if (!$config instanceof ConfigInterface) {
            throw InvalidArgumentException::invalidConfigFile();
        }

        return $config;
    }
1075548
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->injectOutputIntoLogger($output, $this->logger);
        $adapter = $this->shellAdapterManager->getAdapter($input->getOption('adapter'));
        if ($adapter instanceof LoggerAwareInterface) {
            $adapter->setLogger($this->logger);
        }

        $environmentVariables = [];
        if ($input->getOption('env')) {
            foreach ($input->getOption('env') as $value) {
                if (false === strpos($value, '=')) {
                    throw new Exception\InvalidArgumentException(
                        'Environment variables must be specified in the format --env myvar1=myval1 --env myvar2=myval2.'
                    );
                }
                [$key, $value] = explode('=', $value);
                $environmentVariables[$key] = $value;
            }
        }

        $output->write(
            $adapter->runShellCommand(
                $input->getArgument('cmd'),
                $input->getOption('working-directory'),
                $environmentVariables,
                $input->getOption('priority')
            )
        );
        return 0;
    }
679385
public function set($name, AssetInterface $asset)
    {
        if (!ctype_alnum(str_replace('_', '', $name))) {
            throw new \InvalidArgumentException(sprintf('The name "%s" is invalid.', $name));
        }

        $this->assets[$name] = $asset;
    }
418592
public function saveCart(CartInterface $cart)
    {
        if (!$cart->getCartLines()->isEmpty()) {
            $this->cartObjectManager->persist($cart);
        }

        $this
            ->cartObjectManager
            ->flush();
    }
760315
public function buildBucket(BucketInterface $bucket)
    {
        if ($bucket->getType() !== BucketInterface::TYPE_DATE_HISTOGRAM) {
            throw new \InvalidArgumentException("Query builder : invalid aggregation type {$bucket->getType()}.");
        }

        $aggParams = [
            'field'         => $bucket->getField(),
            'interval'      => $bucket->getInterval(),
            'min_doc_count' => $bucket->getMinDocCount(),
        ];

        return ['date_histogram' => $aggParams];
    }
332188
public function setHandler($handler, $handlerMethod = null) : void
    {
        if (!is_callable($handler) && is_null($handlerMethod)) {
            throw new \InvalidArgumentException(
                'In case the $handler is not a callable, $handlerMethod must specify a method to be called'
            );
        }
        $this->handler = $handler;
        $this->handlerMethod = $handlerMethod;
    }
727682
public function addAddress(AddressInterface $address)
    {
        if ($this->addresses->contains($address)) {
            throw new \InvalidArgumentException('This contact already owns this address');
        }

        $this->addresses->add($address);

        if (!$this->defaultAddress) {
            $this->setDefaultAddress($address);
        }
    }
1235333
public function buildPipeline(PipelineInterface $pipeline)
    {
        if ($pipeline->getType() !== PipelineInterface::TYPE_BUCKET_SELECTOR) {
            throw new \InvalidArgumentException("Query builder : invalid aggregation type {$pipeline->getType()}.");
        }

        $aggParams = [
            'buckets_path'  => $pipeline->getBucketsPath(),
            'script'        => $pipeline->getScript(),
            'gap_policy'    => $pipeline->getGapPolicy(),
        ];

        return ['bucket_selector' => $aggParams];
    }
960734
public function add($method)
    {
        if (!$method instanceof MethodInterface) {
            throw new \InvalidArgumentException('This Method must be a instance of \ClassGeneration\MethodInterface');
        }
        if ($method->getName() === null) {
            $method->setName('method' . ($this->count() + 1));
        }

        parent::set($method->getName(), $method);
        return true;
    }
844466
public function removeChild(GroupInterface $child)
    {
        if (!$this->hasChild($child)) {
            throw new \InvalidArgumentException('Trying to remove a non existing child group');
        }

        $this->children->removeElement($child);
    }