@param \Netgen\BlockManager\API\Values\Block\Block $value
@param \Netgen\BlockManager\Transfer\Output\VisitorInterface|null $subVisitor

@return mixed
359720
public function visit($value, ?VisitorInterface $subVisitor = null)
    {
        if ($subVisitor === null) {
            throw new RuntimeException('Implementation requires sub-visitor');
        }

        return [
            'id' => $value->getId(),
            'definition_identifier' => $value->getDefinition()->getIdentifier(),
            'is_translatable' => $value->isTranslatable(),
            'is_always_available' => $value->isAlwaysAvailable(),
            'main_locale' => $value->getMainLocale(),
            'available_locales' => $value->getAvailableLocales(),
            'view_type' => $value->getViewType(),
            'item_view_type' => $value->getItemViewType(),
            'name' => $value->getName(),
            'placeholders' => iterator_to_array($this->visitPlaceholders($value, $subVisitor)),
            'parameters' => $this->visitParameters($value, $subVisitor),
            'configuration' => iterator_to_array($this->visitConfiguration($value, $subVisitor)),
            'collections' => iterator_to_array($this->visitCollections($value, $subVisitor)),
        ];
    }
441876
protected function Sub( $value )
	{
		switch ( $value->GetValueCode() )
		{
			case YearMonthDurationProxyFactory::Code:
				/**
				 * @var YearMonthDurationProxy $value
				 */
				// return new YearMonthDurationProxy( new YearMonthDurationValue( $this->_value->HighPartValue - (/* YearMonthDurationValue */ $value->getValue() )->HighPartValue ) );
				$clone = new YearMonthDurationValue( $this->_value->Value );
				$clone->Sub( /* YearMonthDurationValue */ $value->getValue() );
				return new YearMonthDurationProxy( $clone );

			default:
				throw XPath2Exception::withErrorCodeAndParams( "XPTY0004", Resources::BinaryOperatorNotDefined,
					array(
						"op:sub",
						SequenceType::WithTypeCodeAndCardinality( SequenceType::GetXmlTypeCodeFromObject( $this->_value), XmlTypeCardinality::One ),
						SequenceType::WithTypeCodeAndCardinality( SequenceType::GetXmlTypeCodeFromObject( $value->getValue() ), XmlTypeCardinality::One )
					)
				);
		}
	}
1311961
public function rawClosure($value, BlockView $view)
    {
        if ($value instanceof \Closure) {
            $value = $value($view);
        }

        return $value;
    }
791409
private function resolveSubDefinition($value)
    {
        if (is_array($value)) {
            return array_map([$this, 'resolveSubDefinition'], $value);
        } elseif ($value instanceof DefinitionInterface) {
            return $this->resolve($value);
        }

        return $value;
    }
391274
public function getSampleBlock($blockNum)
    {
        // check preconditions
        if (!$this->_dataSize_valid) {
            $this->setDataSize();  // implicit setSize(), setActualSize(), setNumBlocks()
        }

        $offset = $blockNum * $this->_blockAlign;
        if ($offset + $this->_blockAlign > $this->_dataSize || $offset < 0) {
            return null;
        }


        // read data
        return substr($this->_samples, $offset, $this->_blockAlign);
    }
220386
protected function getSubIndex($value, $subindex = null, $type = null) {
		//if no subindex is specified just cast main argument
		if (is_null($subindex))
			return $this->castParameter($value, $type);
	
		//check if the value is null
		if (is_null($value))
			throw new \InvalidArgumentException("Trying to obtain a value from NULL parameter on index $index");
	
		//check whether this value is the first argument
		if (is_array($value) || is_object($value)) {
			$value = ArgumentWrapper::wrap($value);
			//check if the requested property exists
			if (!$value->offsetExists($subindex))
				throw new \InvalidArgumentException("Property '$subindex' not found on given parameter");
				
			if (is_null($type))
				$type = $value->getPropertyType($subindex);
				
			return $this->castParameter($value->offsetGet($subindex), $type);
		}
		elseif (($value = $this->toString($value)) !== false) {
			//check that subindex is numeric
			if (!is_numeric($subindex))
				throw new \InvalidArgumentException("Subindex '$subindex' is not a number");
				
			//convert subindex to a number
			$subindex = intval($subindex);		
			//check string length against index
			if ($subindex < strlen($value) && $subindex >= 0)
				return $this->castParameter($value[$subindex], $type);
	
			throw new \OutOfBoundsException("Index '$subindex' out of bounds for argument $index");
		}
	
		throw new \InvalidArgumentException("Cannot obtain index '$subindex' from a non-array type");
	}
8458
public function visit(Criterion $criterion, CriterionVisitor $subVisitor = null)
    {
        $handler = $this->sectionHandler;

        $conditions = array_map(
            function ($value) use ($handler) {
                return 'content_section_id_id:"' . $handler->loadByIdentifier($value)->id . '"';
            },
            $criterion->value
        );

        return '(' . implode(' OR ', $conditions) . ')';
    }
30113
public function transform($value)
    {
        if ($value === null || $value == '') {
            return null;
        }
        if (!($value instanceof Page)) {
            throw new TransformationFailedException('Expected an instance of a concrete5 page object.');
        }
        return intval($value->getCollectionID());
    }
1112871
public function getNodeByValue($value): ?Node {
        if (!$this->containsValue($value)) {
            return null;
        }
        $tmp = $this->getHead();
        while ($tmp !== null) {
            $val = $tmp->getValue();
            if (Comparator::equals($val, $value)) {
                //if the value is found then return it
                return $tmp;
            }
            $tmp = $tmp->getNext();
        }
        return null;
    }
838002
private function visitCollections(Block $block, VisitorInterface $subVisitor): Generator
    {
        foreach ($block->getCollections() as $identifier => $collection) {
            yield $identifier => $subVisitor->visit($collection);
        }
    }
215537
public function push($value): CollectionInterface
    {
        return $this->wrap(function (Iterator $data) use ($value) {
            foreach ($data as $key => $item) {
                yield $key => $item;
            }

            yield $value;
        });
    }
25134
protected function transformRecursive($value)
    {
        if (is_array($value) || $value instanceof \Traversable) {
            foreach ($value as &$subvalue) {
                $subvalue = $this->transformRecursive($subvalue);
            }
        } else {
            $value = $this->transformer->transform($value);
        }

        return $value;
    }
842812
public function visit($value, ?VisitorInterface $subVisitor = null)
    {
        if ($subVisitor === null) {
            throw new RuntimeException('Implementation requires sub-visitor');
        }

        return [
            'id' => $value->getId(),
            'is_translatable' => $value->isTranslatable(),
            'is_always_available' => $value->isAlwaysAvailable(),
            'main_locale' => $value->getMainLocale(),
            'available_locales' => $value->getAvailableLocales(),
            'parameters' => $this->visitParameters($value, $subVisitor),
            'query_type' => $value->getQueryType()->getType(),
        ];
    }
1157691
public static function proxy($value, $isRecursive = null)
    {
        if ($value instanceof SafeInterface) {
            return $value;
        }
        if (is_object($value)) {
            return static::proxyObject($value, $isRecursive);
        }
        if (is_array($value)) {
            return static::proxyArray($value, $isRecursive);
        }

        return static::proxyPrimitive($value);
    }
1100708
public function resolve(
        ValueInterface $value,
        FixtureInterface $fixture,
        ResolvedFixtureSet $fixtureSet,
        array $scope,
        GenerationContext $context
    ): ResolvedValueWithFixtureSet {
        // Scope exclusive to the evaluated expression
        // We make use of the underscore prefix (`_`) here to limit the possible conflicts with the variables injected
        // in the scope.
        $_scope = $scope;
        try {
            $_scope['current'] = $fixture->getValueForCurrent();

            if ($_scope['current'] instanceof FixtureInterface) {
                $_scope['current'] = $fixtureSet->getObjects()->get($_scope['current'])->getInstance();
            }
        } catch (NoValueForCurrentException $exception) {
            // Continue
        }

        $expression = $this->replacePlaceholders($value->getValue());
        // Closure in which the expression is evaluated; This is done in a closure to avoid the expression to have
        // access to this method variables (which should remain unknown) and we injected only the variables of the
        // closure.
        $evaluateExpression = function ($_expression) use ($_scope) {
            foreach ($_scope as $_scopeVariableName => $_scopeVariableValue) {
                $$_scopeVariableName = $_scopeVariableValue;
            }

            return eval("return $_expression;");
        };

        try {
            $evaluatedExpression = $evaluateExpression($expression);
        } catch (Throwable $throwable) {
            throw UnresolvableValueExceptionFactory::createForCouldNotEvaluateExpression($value, 0, $throwable);
        }

        return new ResolvedValueWithFixtureSet($evaluatedExpression, $fixtureSet);
    }
923755
public function transform($value)
    {
        if (null === $value) {
            return null;
        }

        if (!$value instanceof APIRoleAssignment) {
            throw new TransformationFailedException('Expected a ' . APIRoleAssignment::class . ' object.');
        }

        return $value->id;
    }
224106
protected function popsProxySubValue($value)
    {
        if ($this->isPopsRecursive()) {
            $popsClass = static::popsProxyClass();

            return $popsClass::proxy($value, true);
        }

        return $value;
    }