Проверка вложенных выражений

@param integer          $entryId
@param NestedExpression $nestedExpression

@return bool
@throws InvalidArgumentException
331221
private function checkNestedExpression($entryId, NestedExpression $nestedExpression)
    {
        $expressions = $nestedExpression->getExpressions();
        foreach ($expressions as $expression) {
            if ($expression->isNested()) {
                $expressionResult = $this->checkNestedExpression($entryId, $expression);
            } else {
                $expressionResult = $this->checkExpression($entryId, $expression);
            }

            if (false === $expressionResult && $nestedExpression->getExpressionOperator() === NestedExpression::AND_OPERATOR) {
                return $nestedExpression->isNegate();
            }
            if (true === $expressionResult && $nestedExpression->getExpressionOperator() === NestedExpression::OR_OPERATOR) {
                return !$nestedExpression->isNegate();
            }
        }


        if ($nestedExpression->getExpressionOperator() === NestedExpression::AND_OPERATOR) {
            return !$nestedExpression->isNegate();
        } elseif ($nestedExpression->getExpressionOperator() === NestedExpression::OR_OPERATOR) {
            return $nestedExpression->isNegate();
        }

        $errMsg = 'unknown field';
        throw new InvalidArgumentException($errMsg);
    }
852239
public function loadAutogeneratedEntry($action, $parentId = null)
    {
        try {
            return $this->innerGateway->loadAutogeneratedEntry($action, $parentId);
        } catch (DBALException $e) {
            throw new \RuntimeException('Database error', 0, $e);
        } catch (PDOException $e) {
            throw new \RuntimeException('Database error', 0, $e);
        }
    }
988096
protected static function createEntries(Container $container, array $entries)
    {
        $defaultShared = $container->isSharedByDefault();

        foreach ($entries as $entry) {
            foreach (self::$requiredEntryKeys as $key) {
                if (!isset($entry[$key])) {
                    $message = sprintf('Missing required entry key "%s" in "%s".', $key, __METHOD__);
                    throw new Exception\InvalidArgumentException($message);
                }
            }

            if (!in_array($entry[ContainerInterface::CONFIG_ENTRY_TYPE], self::$entryTypes)) {
                throw new Exception\InvalidArgumentException(sprintf(
                    'Value "%s" for "%s" is not valid; it must be one of "%s" in "%s".',
                    $entry[ContainerInterface::CONFIG_ENTRY_TYPE],
                    $key,
                    implode(', ', self::$types),
                    __METHOD__
                ));
            }

            $shared = isset($entry[ContainerInterface::CONFIG_ENTRY_SHARED]) ? (bool) $entry[ContainerInterface::CONFIG_ENTRY_SHARED] : $defaultShared;

            $container->add($entry[ContainerInterface::CONFIG_ENTRY_NAME], $entry[ContainerInterface::CONFIG_ENTRY_VALUE], $entry[ContainerInterface::CONFIG_ENTRY_TYPE], $shared);
        }
    }
1365534
public function archive($objectID, $categoryConst, $entryID) {
        $this->api->request(
            'cmdb.category.archive',
            [
                'object' => $objectID,
                'category' => $categoryConst,
                'entry' => $entryID
            ]
        );

        return $this;
    }
94247
public function onMoveContent(EventInterface $event)
    {
        $translator = $this->getTranslator();
        $mapper = $this->getLayoutMapper();
        if (is_null($event->getParam('tid'))) {
            throw new InvalidArgumentException(
                $translator->translate(
                    "Unknown transaction identifier. Missing event param 'tid'."
                )
            );
        }
        if (is_null($event->getParam('content'))) {
            throw new InvalidArgumentException(sprintf(
                $translator->translate(
                    "Missing event param '%s'."
                ),
                'content'
            ));
        }
        $mapper->unregisterContent(
            $event->getParam('content'),
            false,
            $event->getParam('tid')
        );
    }
458492
public function setEntryId($entryId)
    {
        if (!is_numeric($entryId)) {
            $errMsg = sprintf('Аргумент должен быть числом. Актуальное значение %s', $entryId);
            throw new ArgumentNotNumericException($errMsg);
        }

        $this->entryId = (integer)$entryId;

        return $this;
    }
1373664
public function delete($category, $attribute, $entryID) {
        $this->api->request(
            'cmdb.dialog.delete',
            [
                'category' => $category,
                'property' => $attribute,
                'entry_id' => $entryID
            ]
        );

        return $this;
    }
533707
public function generate(string $entryIdentifier, string $fileName, string $data)
    {
        $contentGzip = \gzencode($data, $this->getCompressionLevel());
        if ($contentGzip) {
            GeneralUtility::writeFile($fileName . '.gz', $contentGzip);
        }
    }
18272
public function has(string $entryIdentifier): bool
    {
        $success = false;
        apcu_fetch($this->identifierPrefix . 'entry_' . $entryIdentifier, $success);
        return $success;
    }
737306
public function overrideEntryPoint($id, Entrypoint $e)
    {
        $entryPoints = $this->getOption(self::OPTION_ENTRYPOINTS);
        $entryPoints[$id] = $e;
        $this->setOption(self::OPTION_ENTRYPOINTS, $entryPoints);
    }
1064175
public function setDataEntry($id, $key, $value)
    {
        if (!isset($this->data[$id])) {
            throw new InvalidArgumentException("Missing row with ID $id.");
        }
        if (!$this->isDetached and $key === $this->mapper->getPrimaryKey($this->table)) { // mapper is always set when Result is not detached
            throw new InvalidArgumentException("ID can only be set in detached rows.");
        }
        $this->modified[$id][$key] = true;
        $this->data[$id][$key] = $value;
    }
1256801
public function get($type, EntryQueryOptions $options)
    {
        return EntryModel::on($this->connection)
            ->withTelescopeOptions($type, $options)
            ->take($options->limit)
            ->orderByDesc('sequence')
            ->get()->reject(function ($entry) {
                return ! is_array($entry->content);
            })->map(function ($entry) {
                return new EntryResult(
                    $entry->uuid,
                    $entry->sequence,
                    $entry->batch_id,
                    $entry->type,
                    $entry->family_hash,
                    $entry->content,
                    $entry->created_at,
                    []
                );
            })->values();
    }
1315361
@SuppressWarnings("unchecked")
  public Query linksToEntryId(String entryId) {
    checkNotEmpty(entryId, "entryId must not be empty.");

    params.put(PARAMETER_LINKS_TO_ENTRY, entryId);

    return (Query) this;
  }
919014
public function parseXml($entryXml)
    {
        $this->_entry->parseXml($entryXml);
        $content = $this->_entry->getContent();
        if (is_null($content)) {
            $this->_subscriptionDescription = null;
        } else {
            $this->_subscriptionDescription = SubscriptionDescription::create(
                $content->getText()
            );
        }
    }
1191569
public function requireOnce(string $entryIdentifier)
    {
        if ($this->frozen === true) {
            if (isset($this->cacheEntryIdentifiers[$entryIdentifier])) {
                return require_once($this->cacheDirectory . $entryIdentifier . $this->cacheEntryFileExtension);
            }
            return false;
        }

        $pathAndFilename = $this->cacheDirectory . $entryIdentifier . $this->cacheEntryFileExtension;
        if ($entryIdentifier !== basename($entryIdentifier)) {
            throw new \InvalidArgumentException('The specified entry identifier (' . $entryIdentifier . ') must not contain a path segment.', 1282073036);
        }
        return ($this->isCacheFileExpired($pathAndFilename)) ? false : require_once($pathAndFilename);
    }
625126
public function generate(string $entryIdentifier, string $fileName, string $data)
    {
        GeneralUtility::writeFile($fileName, $data);
    }
350271
public function validate(
        ConstraintInterface $constraint,
        Value\ConcreteValueInterface &$value,
        PointerInterface $entryPoint = null
    ) {
        if (null === $entryPoint) {
            $entryPoint = new Pointer;
        }

        $this->clear();

        $this->pushContext(array($value, $entryPoint));
        $result = $constraint->accept($this);

        $this->clear();

        return $result;
    }