@param mixed            $value
@param ContextInterface $context

@return array

@SuppressWarnings(PHPMD.StaticAccess)
197621
public static function execute($value, ContextInterface $context): array
    {
        $context->getStates()->setState(static::STATE_HAS_BEEN_CALLED, true);

        return static::createSuccessReply($value);
    }
395518
public static function execute($value, ContextInterface $context): array
    {
        if (is_string($value) === true) {
            $lcValue = strtolower($value);
            if ($lcValue === 'true' || $lcValue === '1' || $lcValue === 'on' || $lcValue === 'yes') {
                $reply = static::createSuccessReply(true);
            } elseif ($lcValue === 'false' || $lcValue === '0' || $lcValue === 'off' || $lcValue === 'no') {
                $reply = static::createSuccessReply(false);
            } else {
                $reply = static::createErrorReply($context, $value, ErrorCodes::IS_BOOL, Messages::IS_BOOL, []);
            }
        } elseif (is_bool($value) === true) {
            $reply = static::createSuccessReply($value);
        } else {
            $reply = static::createErrorReply($context, $value, ErrorCodes::IS_BOOL, Messages::IS_BOOL, []);
        }

        return $reply;
    }
1364686
public static function Create( $context, $value )
	{
		if ( $value instanceof PathStep )
		{
			return new PathExprNode( $context, $value );
		}

		if ( $value instanceof AbstractNode )
		{
			return $value;
		}

		return new ValueNode( $context, $value );
	}
534791
public static function execute($value, ContextInterface $context): array
    {
        $count = 0;

        if (is_scalar($value) === true) {
            $tableName   = $context->getProperties()->getProperty(static::PROPERTY_TABLE_NAME);
            $primaryName = $context->getProperties()->getProperty(static::PROPERTY_PRIMARY_NAME);

            /** @var Connection $connection */
            $connection = $context->getContainer()->get(Connection::class);
            $builder    = $connection->createQueryBuilder();
            $statement  = $builder
                ->select('count(*)')
                ->from($tableName)
                ->where($builder->expr()->eq($primaryName, $builder->createPositionalParameter($value)))
                ->execute();

            $count = $statement->fetchColumn();
        }

        $reply = $count > 0 ?
            static::createSuccessReply($value) :
            static::createErrorReply(
                $context,
                $value,
                ErrorCodes::EXIST_IN_DATABASE_SINGLE,
                Messages::EXIST_IN_DATABASE_SINGLE,
                []
            );

        return $reply;
    }
1165235
public function setContext($name, $value = null)
    {
        if (is_array($name)) {
            $this->context = $name + $this->context;
        } else {
            $this->context[$name] = $value;
        }
        return $this;
    }
184782
private function getSuitableIds(
        FixtureMatchReferenceValue $value,
        ResolvedFixtureSet $fixtureSet,
        GenerationContext $context
    ): array {
        $pattern = $value->getValue();

        try {
            $cache = $context->getCachedValue(self::IDS_BY_PATTERN_CACHE_KEY);
        } catch (CachedValueNotFound $exception) {
            $cache = [];
        }

        if (array_key_exists($pattern, $cache)) {
            return $cache[$pattern];
        }

        $suitableIds = $this->findSuitableIds($pattern, $fixtureSet);

        $cache[$pattern] = $suitableIds;
        $context->cacheValue(self::IDS_BY_PATTERN_CACHE_KEY, $cache);

        return $suitableIds;
    }
1296868
protected function initContext($context)
    {
        foreach ($context as $key => &$value) {
            switch (gettype($value)) {
                case 'string':
                case 'integer':
                case 'double':
                    // These types require no conversion
                    break;
                case 'array':
                case 'boolean':
                    $value = json_encode($value);
                    break;
                case 'object':
                    if (method_exists($value, '__toString')) {
                        $value = (string)$value;
                    } else {
                        $value = '[object (' . get_class($value) . ')]';
                    }
                    break;
                case 'NULL':
                    $value = 'NULL';
                    break;
                default:
                    $value = '[' . gettype($value) . ']';
                    break;
            }
        }

        return $context;
    }
860731
public function isValid($value, $context = null)
    {
        $context = array_change_key_case($context, CASE_LOWER);

        switch ($this->hashAlgorithm) {
            case WirecardCEE_Stdlib_Fingerprint::HASH_ALGORITHM_HMAC_SHA512:
            case WirecardCEE_Stdlib_Fingerprint::HASH_ALGORITHM_SHA512:
                $stringLength = 128;
                break;
            case WirecardCEE_Stdlib_Fingerprint::HASH_ALGORITHM_MD5:
                $stringLength = 32;
                break;
            default:
                throw new WirecardCEE_Stdlib_Exception_UnexpectedValueException(sprintf("Used hash algorithm '%s' is not supported. MD5, SHA512, or HMAC_SHA512 are currently supported.",
                    $this->hashAlgorithm));
                break;
        }

        if (strlen($value) != $stringLength) {
            return false;
        }

        if ($this->fingerprintOrderType == self::TYPE_FIXED) {
            $fingerprintOrder = $this->fingerprintOrder;
        } else {
            if (array_key_exists($this->fingerprintOrderField, $context)) {
                $fingerprintOrder = new WirecardCEE_Stdlib_FingerprintOrder(strtolower($context[$this->fingerprintOrderField]));
            } else {
                $this->_error(self::FINGERPRINTORDER_MISSING);

                return false;
            }
        }

        $fingerprintOrder->setOrder(array_map('strtolower', $this->fingerprintOrder->__toArray()));
        if (!in_array('secret', $fingerprintOrder->__toArray())) {
            throw new WirecardCEE_Stdlib_Exception_UnexpectedValueException();
        }

        $fingerprintFields = Array();
        foreach ($fingerprintOrder as $fingerprintFieldKey) {
            if ($fingerprintFieldKey == 'secret') {
                $fingerprintFields[$fingerprintFieldKey] = $this->secret;
            } else {
                $fingerprintFields[$fingerprintFieldKey] = isset( $context[$fingerprintFieldKey] ) ? $context[$fingerprintFieldKey] : '';
            }
        }

        if (!WirecardCEE_Stdlib_Fingerprint::compare($fingerprintFields, $fingerprintOrder, $value)) {
            $this->_error(self::INVALID);

            return false;
        }

        return true;
    }
310489
public function dump($value)
    {
        $context = $this->contextFactory->createDumpContext();

        return $this->dumper->dump($value, $context);
    }
1275953
public function getContextValue(HasNodeInterface $page, array $context)
    {
        $controllerClass = substr(str_replace('Entity', 'Controller', ClassLookup::getClass($page)), 0, -strlen('Page')) . 'Controller';

        if (false === class_exists($controllerClass)) {
            return [];
        }

        /** @var PageControllerInterface|ContainerAwareInterface $controller */
        $controller = $this->container->has($controllerClass)
            ? $this->container->get($controllerClass)
            : new $controllerClass;

        if (false === $controller instanceof PageControllerInterface) {
            throw new \RuntimeException("$controllerClass needs to implement " . PageControllerInterface::class);
        }

        if ($controller instanceof ContainerAwareInterface) {
            $controller->setContainer($this->container);
        }

        return $controller->serviceAction($page, $context);
    }
1296492
public static function execute($value, ContextInterface $context): array
    {
        $reply = null;

        $result = [];
        if (is_array($value) === true) {
            foreach ($value as $key => $mightBeString) {
                if (is_string($mightBeString) === true || is_numeric($mightBeString) === true) {
                    $result[$key] = (int)$mightBeString;
                } else {
                    $reply = static::createErrorReply(
                        $context,
                        $mightBeString,
                        ErrorCodes::IS_STRING,
                        Messages::IS_STRING,
                        []
                    );
                    break;
                }
            }
        } else {
            $reply = static::createErrorReply($context, $value, ErrorCodes::IS_ARRAY, Messages::IS_ARRAY, []);
        }

        return $reply !== null ? $reply : static::createSuccessReply($result);
    }
458739
public function checkDuplicateCouponCode($value, ExecutionContextInterface $context)
    {
        $exists = CouponQuery::create()->filterByCode($value)->count() > 0;

        if ($exists) {
            $context->addViolation(
                Translator::getInstance()->trans(
                    "The coupon code '%code' already exists. Please choose another coupon code",
                    ['%code' => $value]
                )
            );
        }
    }
1240741
public function isValid( $id, $value, $context = null )
    {
        return $this->createRegeneratable( array( 'id' => $id ) )
                    ->isValid( $value, $context );
    }
233036
public static function addTranslationContext($value, $context) {
		if (is_array($value) || $value instanceof Traversable) {
			$array = array();
			foreach ($value as $key => $string) {
				$array[$key] = self::addTranslationContext($string, $context);
			}
			return $array;
		}
		return (string)$context . chr(4) . (string)$value;
	}
568539
public static function execute($value, ContextInterface $context): array
    {
        $properties = $context->getProperties();

        return static::createErrorReply(
            $context,
            $value,
            $properties->getProperty(self::PROPERTY_ERROR_CODE),
            $properties->getProperty(self::PROPERTY_ERROR_MESSAGE_TEMPLATE),
            $properties->getProperty(self::PROPERTY_ERROR_MESSAGE_PARAMETERS)
        );
    }
233231
public static function execute($value, ContextInterface $context): array
    {
        if (is_string($value) === true || is_numeric($value) === true) {
            return static::createSuccessReply((int)$value);
        }

        return static::createErrorReply($context, $value, ErrorCodes::IS_INT, Messages::IS_INT, []);
    }
1271356
public static function execute($value, ContextInterface $context): array
    {
        $idExists = is_int($value) === true && $value < 3;

        return $idExists === true ?
            static::createSuccessReply($value) :
            static::createErrorReply(
                $context,
                $value,
                Errors::IS_VALID_SKU,
                static::MESSAGE_TEMPLATE,
                []
            );
    }