{@inheritdoc}

@throws \LogicException
@throws \OutOfBoundsException
@throws \InvalidArgumentException
@throws \RuntimeException
514354
protected function getFilterCriteria(array $parameters)
    {
        /** @var \Netgen\EzPlatformSiteApi\API\Values\Content $content */
        $content = $parameters['content'];
        $tagIds = $this->extractTagIds($content);

        if (empty($tagIds)) {
            return new MatchNone();
        }

        $criteria = [];
        $criteria[] = new TagId($tagIds);

        if ($parameters['exclude_self']) {
            $criteria[] = new LogicalNot(new ContentId($content->id));
        }

        return $criteria;
    }
155719
public function process(
        ObjectInterface $object,
        ResolvedFixtureSet $fixtureSet,
        GenerationContext $context,
        MethodCallInterface $methodCall
    ): ResolvedFixtureSet {
        if (false === ($methodCall instanceof OptionalMethodCall)) {
            throw new \LogicException('TODO');
        }

        if (null === $this->processor) {
            throw new \LogicException('TODO');
        }

        if (mt_rand(0, 99) >= $methodCall->getPercentage()) {
            return $fixtureSet;
        }

        return $this->processor->process(
            $object,
            $fixtureSet,
            $context,
            $methodCall->getOriginalMethodCall()
        );
    }
965827
protected function initializable()
    {
        if (!$this->getParamAdapter()) {
            throw new Exception\LogicException('Param Adapter is required');
        }

        if (!$this->getSource()) {
            throw new Exception\LogicException('Source data is required');
        }

        $this->init = true;

        if (count($this->headers)) {
            $this->setHeaders($this->headers);
        }

        $this->init();

        $this->initFilters($this->getSource()->getSource());
    }
838307
public function map(callable $f) {
        if( $this->value !== null ) return Result::success($f($this->value));
        if( $this->error !== null ) return $this;
        throw new \LogicException("Value and error cannot both be null");
    }
567506
public function unserialize($str)
    {
        $data = @unserialize($str);

        if ($data === false) {
            throw new \RuntimeException(sprintf('Can\'t unserialize model data: %s', $str));
        }

        if (!is_array($data)) {
            throw new \RuntimeException(sprintf('Unserialized data must be array, "%s" given.', gettype($data)));
        }

        foreach ($data as $propertyName => $propertyValue) {
            if (!property_exists($this, $propertyName)) {
                throw new \LogicException(sprintf('Undefined property "%s" in model "%s". Allowed properies: "%s".', $propertyName, get_class($this), implode('", "', array_keys(get_object_vars($this)))));
            }

            $this->{$propertyName} = $propertyValue;
        }
    }
1205350
public function unserialize($value) : void
    {
        if (isset($this->value)) {
            throw new \LogicException('unserialize() is an internal function, it must not be called directly.');
        }

        [$value, $scale] = \explode(':', $value);

        $this->value = $value;
        $this->scale = (int) $scale;
    }
677450
private function validate()
    {
        if (!class_exists($this->class)) {
            throw new \RuntimeException(sprintf('Class %s does not exist, is this the correct namespace?', $this->class));
        }
        if (!in_array($this->method, get_class_methods($this->class))) {
            throw new \RuntimeException(sprintf('The method "%s" does not exist in "%s" class.', $this->method, $this->class));
        }
    }
515733
public function execute(ReturnExpr $expr, FragmentInterface $query, Connection $connection, MapperInterface $mapper)
    {
        $name = $expr->getExecutionStrategy();

        if (!isset($this->strategies[$name])) {
            throw new LogicException(sprintf(
                'The execution strategy named "%s" is not available.',
                $name
            ));
        }

        return $this->strategies[$name]->execute($query, $connection, $mapper, $expr->getField(), $expr->getType());
    }
15594
public function transform($value)
    {
        // Not numeric and isn't blank (a value was actually provided)
        if ( ! is_numeric($value) && ! $this->isBlank($value)) {
            throw new LogicException("A valid integer is required.");
        }

        if ($value !== null) {
            return (int) $value;
        }

        return $value;
    }
750888
public function toString()
    {
        if ($this->isClosure()) {
            throw new LogicException('You cannot serialize a closure.');
        }

        if ($this->isFunction()) {
            return $this->getCallMethod();
        }

        $separator = $this->isStaticMethod() ? '::' : '->';

        return $this->getCallClass() . $separator . $this->getCallMethod();

    }
642432
public function offsetGet($key)
    {
        if (array_key_exists($key, $this->parameters)) {

            return $this->parameters[$key];
        }
        throw new \LogicException(sprintf('Parameter "%s" is not defined.', $key));
    }
1264415
public function getContent()
    {
        if (!($pathname = $this->getPathname())) {
            throw new \LogicException('No pathname was specified - maybe it came from DigiDoc web service?');
        }

        $level = error_reporting(0);
        $content = file_get_contents($pathname);
        error_reporting($level);

        if (false === $content) {
            $error = error_get_last();
            throw new RuntimeException($error['message']);
        }

        return $content;
    }
825537
public static function delete($object)
    {
        if (null === $object) {
            throw new \LogicException("No object");
        }

        $setterDelete = [
            $object,
            "setDeleted"
        ];

        if (false === is_callable($setterDelete)) {
            throw new \LogicException(sprintf("%s is not softdeletable", get_class($object)));
        }

        $object->setDeleted(true);

        $oReflectionClass = new \ReflectionClass($object);
        foreach ($oReflectionClass->getProperties() as $property) {
            $property->setAccessible(true);
            $propertyValue = $property->getValue($object);

            if ($propertyValue instanceof Collection || true === is_array($propertyValue)) {
                foreach ($propertyValue as $propertyValueRelation) {
                    $setterDelete = [
                        $propertyValueRelation,
                        "setDeleted"
                    ];

                    if (true === is_callable($setterDelete)) {
                        $propertyValueRelation->setDeleted(true);
                    }
                }
            }
        }
    }
623363
public function process(
        ObjectInterface $object,
        ResolvedFixtureSet $fixtureSet,
        GenerationContext $context,
        MethodCallInterface $methodCall
    ): ResolvedFixtureSet {
        /** @var StaticReference $reference */
        $reference = $methodCall->getCaller();

        if (false === ($reference instanceof StaticReference)) {
            throw new \LogicException('TODO');
        }

        $result = $reference->getId()::{$methodCall->getMethod()}(...$methodCall->getArguments());

        if ($context->needsCallResult()) {
            $object = $object->withInstance($result);
        }

        return $fixtureSet->withObjects(
            $fixtureSet->getObjects()->with($object)
        );
    }
1068065
public function start()
    {
        if ($this->isRunning()) {
            throw new LogicException('Process is already running');
        }

        $this->reset();

        $cmd = $this->cmd;
        if (substr($cmd, 0, 4) == 'php ') {
            $php = PHP_BINARY ?: PHP_BINDIR . '/php';
            $cmd = $php . substr($cmd, 3);
        }

        $descriptorspec = [
            0 => ['pipe', 'r'], // STDIN
            1 => ['pipe', 'w'], // STDOUT
            2 => ['pipe', 'w']  // STDERR
        ];

        $options = [
            'suppress_errors' => true,
            'binary_pipes'    => true,
        ];

        $this->process = proc_open($cmd, $descriptorspec, $this->pipes, base_path(), $this->env, $options);

        if (!is_resource($this->process)) {
            throw new RuntimeException('Unable to launch a new process.');
        }
    }
362111
public function nextList()
    {
        if (!$this->hasNext()) {
            return false;
        }

        if (!isset($this->dataObjectFactory)) {
            throw new \LogicException('setDataObjectFactory must be called before calling nextList.');
        }

        if (!isset($this->objectListQuery)) {
            throw new \LogicException('setByFields must be called before calling nextList.');
        }

        $byFields = clone $this->objectListQuery;
        $range = Range::nextRange($this);
        $byFields->setRange($range);

        return $this->dataObjectFactory->selectRequest($byFields);
    }
413191
function validate($value, $key, $fields, $options, $exists, \CharlotteDunois\Validation\Validator $validator) {
        if(!$exists) {
            return true;
        }
        
        if(!\is_callable($value)) {
            return 'formvalidator_make_callable';
        }
        
        if(empty($options)) {
            throw new \LogicException('Invalid options value given for callback rule');
        }
        
        /** @var \ReflectionMethod|\ReflectionFunction  $prototype */
        
        if(\is_array($value)) {
            $prototype = new \ReflectionMethod($value[0], $value[1]);
        } else {
            $prototype = new \ReflectionFunction($value);
        }
        
        $options = \explode('=', $options, 2);
        
        if(!empty($options[0])) {
            $params = \explode(',', $options[0]);
            
            /** @var \ReflectionParameter  $param */
            foreach($prototype->getParameters() as $pos => $param) {
                $type = $param->getType();
                
                if(!isset($params[$pos])) {
                    return array('formvalidator_make_callback_param_superfluos', array('{0}' => $pos));
                } elseif($params[$pos] === '') {
                    continue; // "mixed" type - wildcard
                } elseif(($type === null && $params[$pos] !== '') || \trim($params[$pos], '?') !== $type->getName()) {
                    return array('formvalidator_make_callback_param', array('{0}' => $pos, '{1}' => \trim($params[$pos], '?')));
                } elseif($params[$pos][0] === '?' && !$type->allowsNull()) {
                    return array('formvalidator_make_callback_param_nullable', array('{0}' => $pos));
                } elseif(\substr($params[$pos], -1) === '?' && !$param->isOptional()) {
                    return array('formvalidator_make_callback_param_optional', array('{0}' => $pos));
                }
            }
        }
        
        if(!empty($options[1])) {
            $return = $prototype->getReturnType();
            
            if($return === null) {
                return array('formvalidator_make_callback_return', array('{0}' => $options[1]));
            } elseif(($return->allowsNull() ? '?' : '').$return->getName() !== $options[1]) {
                return array('formvalidator_make_callback_return_type', array('{0}' => $options[1], '{1}' => $return->getName()));
            }
        }
        
        return true;
    }