@param ViewQuery $viewQuery
@param bool      $jsonAsArray

@return mixed
513725
public function execute(ViewQuery $viewQuery, bool $jsonAsArray = false)
    {
        if (isset($this->dispatcher)) {
            $this->dispatcher->dispatch(new ViewQuerying($viewQuery));
        }
        if (!is_null($this->consistency)) {
            $viewQuery = $viewQuery->consistency($this->consistency);
        }

        return $this->bucket->query($viewQuery, $jsonAsArray);
    }
441486
function loadJsonAsArray($pFile)
    {
        $contents = \file_get_contents($pFile);
        $returnValue = \json_decode($contents, true);

        if (!$this->isArray($returnValue)) {
            $returnValue = [];
        }

        return $returnValue;
    }
590724
public function findByUser(User $user, $asArray = true)
    {
        $groupQb = $this->_em->createQueryBuilder()
            ->select('g')
            ->from('Claroline\CoreBundle\Entity\Group', 'g')
            ->join('g.users', 'gu')
            ->where('gu = :user');

        $select = $asArray ? 'o.id, o.name, op.percentage AS progress, COUNT(oc) AS competencyCount' : 'o';

        $query = $this->createQueryBuilder('o')
            ->select($select)
            ->leftJoin('o.objectiveCompetencies', 'oc')
            ->leftJoin('o.users', 'ou')
            ->leftJoin('o.groups', 'og')
            ->leftJoin(
                'HeVinci\CompetencyBundle\Entity\Progress\ObjectiveProgress',
                'op',
                'WITH',
                'op.user = :user AND op.objective = o'
            )
            ->andWhere($groupQb->expr()->orX(
                'ou = :user',
                $groupQb->expr()->in('og', $groupQb->getQuery()->getDQL())
            ))
            ->groupBy('o.id')
            ->setParameter(':user', $user)
            ->getQuery();

        return $query->{$asArray ? 'getArrayResult' : 'getResult'}();
    }
399006
public function search(string $identifier, string $searchQuery): array
    {
        if (in_array($identifier, [static::SEARCH_NAME, static::SEARCH_IMDB, static::SEARCH_ZAP2IT]) === false) {
            throw new InvalidArgumentException('Given search identifier is invalid!');
        }
        $options = ['query' => [$identifier => $searchQuery]];

        $json = $this->parent->performAPICallWithJsonResponse('get', '/search/series', $options);
        return DataParser::parseDataArray($json, BasicSeries::class);
    }
804685
public JSONObject searchRules(RuleQuery query, RequestOptions requestOptions) throws AlgoliaException, JSONException {
    JSONObject body = new JSONObject();
    if (query.getQuery() != null) {
      body = body.put("query", query.getQuery());
    }
    if (query.getAnchoring() != null) {
      body = body.put("anchoring", query.getAnchoring());
    }
    if (query.getContext() != null) {
      body = body.put("context", query.getContext());
    }
    if (query.getPage() != null) {
      body = body.put("page", query.getPage());
    }
    if (query.getHitsPerPage() != null) {
      body = body.put("hitsPerPage", query.getHitsPerPage());
    }

    return client.postRequest("/1/indexes/" + encodedIndexName + "/rules/search", body.toString(), false, true, requestOptions);
  }
1298724
protected function getRequest(array $requestArguments = [], $pageId = 0, $languageId = 0)
    {
        $searchRequest = GeneralUtility::makeInstance(SearchRequest::class,
            /** @scrutinizer ignore-type */ $requestArguments,
            /** @scrutinizer ignore-type */ $pageId,
            /** @scrutinizer ignore-type */ $languageId,
            /** @scrutinizer ignore-type */ $this->typoScriptConfiguration);
        return $searchRequest;
    }
765131
public function render($viewPath, array $data = null, $bypass = false)
	{
	    $this->setView($viewPath);

        if (!is_null($data)) {
            $this->setData($data);
        }


        if (!$this->isAjax() && $this->getLayout() !== null && !$bypass) {
            return $this->renderLayout($this->getSharedData());
        }

        return $this->renderView($this->getView(), $this->getData());
	}
971480
public function read( $asArray = NULL )
	{
		$json	= FS_File_Reader::load( $this->filePath );
		$data	= json_decode( $json, $asArray );
		if( json_last_error() !== JSON_ERROR_NONE ){
			$message	= 'Decoding JSON failed (%s): %s';
			$message	= vsprintf( $message, array(
				ADT_Constant::getKeyByValue( 'JSON_ERROR_', json_last_error() ),
				json_last_error_msg()
			) );
			throw new RuntimeException( $message, json_last_error() );
		}
		return $data;
	}
42236
public function decodeJson($jsonValue, $assoc = false, $depth = null, $options = null)
    {
        return $this->utilEncodingService->decodeJson($jsonValue, $assoc, $depth, $options);
    }
54310
public function render($viewPath, array $params = [])
    {
        ob_start();
        ob_implicit_flush(false);
        $this->params = $params;
        extract(array_merge($params, $this->getBlocks()), EXTR_OVERWRITE);
        require(file_exists($viewPath) ? $viewPath : '../'.$viewPath);

        return ob_get_clean();
    }
289795
public function view(string $viewName, array $params = [], string $type = '')
    {
        if (empty($type)) {
            $type = $this->type;
        }

        $jsExternal = $this->getJsExternal();
        if (!empty($jsExternal[$this->output][$type])) {
            $this->codejs[$type] = $jsExternal[$this->output][$type];
        }

        if (!empty($this->view) && View::exists($this->view.'.'.$viewName)) {
            return view($this->view.'.'.$viewName, $params);
        } elseif (isset($this->config['view']) && View::exists($this->config['view'].'.'.$viewName)) {
            return view($this->config['view'].'.'.$viewName, $params);
        }

        return view('sirtrevorjs::html.'.$viewName, $params);
    }
381485
public static function load( $filePath, $asArray = NULL )
	{
		$reader	= new FS_File_JSON_Reader( $filePath );
		return $reader->read( $asArray );
	}
724890
public function createQueryBuilderFromArray(array $data, ActionManagerInterface $actionManager = null)
    {
        return $this->createQueryBuilder()
            ->fromArray($data, $actionManager)
        ;
    }
206525
private static JsonArray getJsonValueAsArray(JsonValue value) {
        return (value != null && value.getValueType() == ValueType.ARRAY) ? value.asJsonArray() : null;
    }
1195528
protected final JSONArray getPages(Iterator<Page> pages, int depth, PageFilter pageFilter) throws JSONException {
    JSONArray pagesArray = new JSONArray();

    while (pages.hasNext()) {
      Page page = pages.next();

      // map page attributes to JSON object
      JSONObject pageObject = getPage(page);
      if (pageObject != null) {

        // write children
        Iterator<Page> children = listChildren(page.adaptTo(Resource.class), pageFilter);
        if (!children.hasNext()) {
          pageObject.put("leaf", true);
        }
        else if (depth < getMaxDepth() - 1) {
          pageObject.put("children", getPages(children, depth + 1, pageFilter));
        }

        pagesArray.put(pageObject);
      }
    }

    return pagesArray;
  }
216631
public function getFiltersComponent(SearchQuery $searchQuery)
    {
        $criteriaComponent = $this->getCriteriaComponent($searchQuery);

        $components = array_merge(
            $this->getRequireFiltersComponent($searchQuery),
            $this->getExcludeFiltersComponent($searchQuery)
        );

        if ($criteriaComponent !== null) {
            $components[] = $criteriaComponent;
        }

        return $components;
    }
694263
public function lookup(array $queries = array())
    {
        try {
            $request  = $this->requestLookup($queries);
            $response = $this->getClient()->send($request);
        } catch(\Exception $ex) {
            throw new \RuntimeException('Failed to get response', 0, $ex);
        }

        // if success level, 
        if(2 == floor($response->getStatusCode()/100)) {
            $contentType = $response->getHeader('Content-Type');

            switch($contentType) {
            case 'application/json':
                return $response->json();
            case 'application/xml':
                return $response->xml();
            default:
                //throw new UnsupportedFormatException(sprintf('Content-Type "%s" is not supported.', $response->getHeader('Content-Type')));
                throw new \RuntimeException(sprintf('Content-Type "%s" is not supported.', $contentType));
            }
        }

        throw new \RuntimeException(sprintf('Failed to get the response: StatusCode [%d]', $response->getStatusCode()));
    }