Factory method for use of a new UseCase class
Returns whole resource or just one part

@param string $useCaseName
@param string $resourcePart
@param Request $request
@return mixed
427424
public function reference($useCaseName, $resourcePart = null, Request $request = null)
    {
        if(null === $request) {
            $request = $this->getRequest();
        }
        return $this->getUseCaseFactoryInstance()
            ->setUseCaseName($useCaseName)
            ->setRequest($request)
            ->getResource($resourcePart);
    }
130609
public static function rChr($haystack, $needle, $part = null)
    {
        if (self::isMBString()) {
            return mb_strrchr($haystack, $needle, $part, self::$encoding);
        }

        return strrchr($haystack, $needle); // @codeCoverageIgnore
    }
1188357
public function batchEndpointAction(Request $request, string $schemaName = null)
    {
        return $this->createResponse($request, $schemaName, true);
    }
1330872
@Override
    public InputStream getPart(String partName) throws IOException {
        try {
            Part part = request.getPart(partName);
            return (part == null) ? null : part.getInputStream();
        } catch (ServletException e) {
            throw new IOException(e);
        }
    }
495899
public function validateRequest(Request $request): ResponseInterface
    {
        $case = $this->makeCase($request);

        $caseId = $this->getApiClient()->createCase($case);

        if (!$caseId) {
            throw new RequestException(
                'Could not create Signifyd Case: '
                . $this->getApiClient()->getLastErrorMessage()
            );
        }

        return new CaseIdResponse($caseId);
    }
750661
private static function cachingPartial($actionContext, $eventArgs) {
        $cacheKey = InternalHelper::getPropertyValue($actionContext, 'cacheKey');

        // no key, no cache
        if (empty($cacheKey)) {
            return;
        }

        $cache = $httpContext->getCache();
        $cachePartSeq = $cache->get($cacheKey . '_part_seq');

        if (!isset($cachePartSeq)) {
            $cachePartSeq = -1;
        }

        $dataToCache = array();
        $dataToCache['output'] .= $eventArgs['output'];
        $dataToCache['files'] = array_merge($dataToCache['files'], $eventArgs['files']);

        $cache->add($cacheKey . '_part_' . $cachePartSeq, $dataToCache, 30);
        $cache->add($cacheKey . '_part_seq', (int)$cachePartSeq + 1, 30);
    }
1300637
private function createRpbMessage(SearchRequest $request)
    {
        $rpbGetReq = new RpbSearchQueryReq();

        $rpbGetReq->setQ($request->q);
        $rpbGetReq->setIndex($request->index);

        if ($request->presort != null) {
            $rpbGetReq->setPresort($request->presort);
        }

        if ($request->sort != null) {
            $rpbGetReq->setSort($request->sort);
        }

        if ($request->start != null) {
            $rpbGetReq->setStart($request->start);
        }

        if ($request->rows != null) {
            $rpbGetReq->setRows($request->rows);
        }

        if ($request->op != null) {
            $rpbGetReq->setOp($request->op);
        }

        if ($request->fl != null) {
            $rpbGetReq->setFl($request->fl);
        }

        if ($request->df != null) {
            $rpbGetReq->setDf($request->df);
        }

        if ($request->filter != null) {
            $rpbGetReq->setFilter($request->filter);
        }

        return $rpbGetReq;
    }
1063127
public function build(): GetResourceContentRequest
	{
		$instance = new GetResourceContentRequest();
		if ($this->frameId === null) {
			throw new BuilderException('Property [frameId] is required.');
		}
		$instance->frameId = $this->frameId;
		if ($this->url === null) {
			throw new BuilderException('Property [url] is required.');
		}
		$instance->url = $this->url;
		return $instance;
	}
829671
public function callGetResources(Request $request, Response $response, array $args)
    {
        $resourceNamePlural = $args['resourceNamePlural'];
        $inflector          = $this->get(ServiceProvider::INFLECTOR);
        $methodName         = 'get'.$inflector->camelize($resourceNamePlural);

        return $this->callMethod($resourceNamePlural, $methodName, [$request, $response]);
    }
76185
public function loadRequestPath($paramName)
    {
        // parse from the end to the top
        $path = array_reverse(explode('/', $this->contextRequestPath));

        /**
         * -1 => current params
         * -2 => method
         * -3 => route
         */
        $datapath     = $this->__get('DataPath');
        $partDataPath = null;

        while (true) {
            if (!is_array($datapath) || empty($datapath)) {
                $partDataPath = null;
                break;
            }

            $partDataPath = array_pop($datapath);

            if (substr($partDataPath, 0, 1) == '/') {
                break;
            }
        }

        // parse from the end to the top
        $route = array_reverse(explode('/', $partDataPath));

        foreach ($route as $key => $partRoute) {

            if ($partRoute != '{' . $paramName . '}') {
                continue;
            }

            if (!array_key_exists($key, $path)) {
                $this->contextDataExists = false;
                $this->contextDataValue  = null;
                break;
            }

            $this->contextDataExists = true;
            $this->contextDataValue  = urldecode($path[$key]);
        }

        return $this->checkDataIsEmpty();
    }
924617
public function get($name, $usePeeringServiceManagers = true) {
		try {
			return parent::get($name,$usePeeringServiceManagers);
		} catch (ServiceNotFoundException $e) {
			if (isset($this->_decoree))
				return $this->getDecoree()->get($name,$usePeeringServiceManagers);
			else
				throw $e;
		}
	}
964176
public void used( final TestCaseDef testCase)
    {
    // Note: must accumulate tuples into a separate list to avoid ConcurrentModificationException when updating used/unused membership.
    List<Tuple> usedTuples =
      IteratorUtils.toList(
        IteratorUtils.filteredIterator(
          IteratorUtils.chainedIterator(
            unused_.iterator(),
            used_.iterator()),
          tuple -> testCase.usesTuple( tuple)));

    for( Tuple tuple : usedTuples)
      {
      used( tuple);
      }
    }
932611
public function cgetAction(Request $request)
    {
        try {
            // check if context exists and filters are enabled for the given context
            $context = $request->get('context');

            if (!$this->getManager()->hasContext($context)) {
                throw new UnknownContextException($context);
            }

            if (!$this->getManager()->isFeatureEnabled($context, 'filters')) {
                throw new MissingFeatureException($context, 'filters');
            }

            if ('true' == $request->get('flat')) {
                $list = $this->getListRepresentation($request);
            } else {
                $list = new CollectionRepresentation(
                    $this->getManager()->findFiltersForUserAndContext(
                        $context,
                        $this->getUser()->getId(),
                        $this->getRequestParameter($request, 'locale', true)
                    ),
                    self::$entityKey
                );
            }
            $view = $this->view($list, 200);
        } catch (UnknownContextException $exc) {
            $exception = new RestException($exc->getMessage());
            $view = $this->view($exception->toArray(), 400);
        } catch (MissingFeatureException $exc) {
            $exception = new RestException($exc->getMessage());
            $view = $this->view($exception->toArray(), 400);
        }

        return $this->handleView($view);
    }
72327
public function parse(Request $request)
    {
        foreach($this->rules as $url => $items)
        {
            $result = $this->checkUrl($request, $url, $params);
            if($result['result'] || $result['resultIgnoreCase'])
            {
                foreach($items as $item)
                {
                    if(
                        ($result['result'] || ($this->ignoreCase || $item['annotation']->ignoreCase)) &&
                        $this->checkMethod($request, $item['annotation']->method) &&
                        $this->checkDomain($request, $item['annotation']->domain, $domainParams) &&
                        $this->checkParamsGet($request, $item['annotation']->paramsGet) &&
                        $this->checkParamsPost($request, $item['annotation']->paramsPost) &&
                        $this->checkHeader($request, $item['annotation']->header) &&
                        $this->checkRequestMime($request, $item['annotation']->requestMime)
                    )
                    {
                        $params = array_merge($params, $domainParams);
                        return [
                            'params'        => $params,
                            'callable'      => $this->parseCallable($params, $item['callable']),
                            'middlewares'   => $item['middlewares'] ?? [],
                            'wsConfig'      => $item['wsConfig'],
                        ];
                    }
                }
            }
        }
        return null;
    }
365516
public function findResources ($resourceName) {
        $request = get_request();
        $resource = Resources::get($resourceName);
        if ($request->has("rawQuery")) {
            $query = unserialize($request->get("rawQuery"));
            $resource->limit($query->getLimit());
            $resource->offset($query->getOffset());
            $resource->distinct($query->getDistinct());
            $resource->selectFields($query->getSelectFields());
            $resource->orderByFields($query->getOrderByFields());
            $resource->groupByFields($query->getGroupByFields());
            $resource->whereConditionGroup($query->getwhereConditionGroup());
            $resource->havingConditionGroup($query->getHavingConditionGroup());
            $resource->joins($query->getJoins());
        }
        else {
            $resource->limit(100);
            $parameters = $request->params();
            foreach ($parameters as $key=>$value) {
                switch ($key) {
                    case "limit":
                        $resource->limit($value);
                        break;
                    case "offset":
                        $resource->offset($value);
                        break;
                    case "distinct":
                        $resource->distinct($value);
                        break;
                    case "select":
                        $resource->selectFields(explode(",", $value));
                        break;
                    case "orderBy":
                        $resource->orderByFields(explode(",", $value));
                        break;
                    case "groupBy":
                        $resource->groupByFields(explode(",", $value));
                        break;
                    case "where":
                        $resource->whereConditionGroup($this->createConditionGroup($value));
                        break;
                    case "having":
                        $resource->havingConditionGroup($this->createConditionGroup($value));
                        break;
                    case "filters":
                        $filters = $value;
                        foreach ($filters as $filter) {
                            if (!empty($filter["operator"])) {
                                $resource->where($filter["property"], $filter["operator"], $filter["property"]);
                            } else {
                                $resource->where($filter["property"], $filter["value"]);
                            }
                        }
                        break;
                    default:
                        $resource->where($key, $value);
                        break;
                }
            }
        }
        return $resource->find();
    }
729037
private function matchPart($rulePart, $queryPart, &$args)
    {
        $match = false;
        $first = isset($rulePart[0]) ? $rulePart[0] : '';
        switch ($first) {
            case '*':
                $match = true;
                break;

            case '{':
                $match = $this->checkPartAsArgument($rulePart, $queryPart, $args);
                break;

            default:
                $match = ($rulePart == $queryPart);
                break;
        }
        return $match;
    }
1273481
public function getPart($partId)
    {
        if (!isset($this->_batchParts[$partId])) {
            throw new ClientException('Request batch part does not exist.');
        }

        return $this->_batchParts[$partId];
    }