@param Request     $request
@param string|null $schemaName

@return array
331287
private function processNormalQuery(Request $request, string $schemaName = null): array
    {
        $params = $this->requestParser->parse($request);

        return $this->requestExecutor->execute($schemaName, $params)->toArray();
    }
203417
protected function getColumnCreate($schema, $table, $columnName)
    {
        $columns = $schema['tables'][$table]['columns'];
        $columnData = $columns[$columnName];
        $phinxType = $this->getPhinxColumnType($columnData);
        $columnAttributes = $this->getPhinxColumnOptions($phinxType, $columnData, $columns);

        return [$table, $columnName, $phinxType, $columnAttributes];
    }
94424
public static function getHeadersFromRequest(Request $request)
    {
        $headers = array();
        foreach($request->headers as $key => $value)
        {
            if(isset($key) && isset($value) && isset($value[0]))
            {
                $headers[$key] = $value[0];
            }
        }
        return $headers;
    }
28904
private function validateAbstractSchemaName($schemaName) : void
    {
        if (class_exists($schemaName, true) || interface_exists($schemaName, true)) {
            return;
        }

        try {
            $this->getEntityManager()->getClassMetadata($schemaName);

            return;
        } catch (MappingException $mappingException) {
            $this->semanticalError(
                sprintf('Class %s could not be mapped', $schemaName),
                $this->lexer->token
            );
        }

        $this->semanticalError(sprintf("Class '%s' is not defined.", $schemaName), $this->lexer->token);
    }
1166113
private function findTableSchemas($schema = null)
    {
        $tableNames = $this->getTableNames($schema, true);

        if (is_callable($this->tableNameFilter)) {
            $tableNames = array_filter($tableNames,
                function($tableName) use ($schema) {
                    return call_user_func($this->tableNameFilter, $tableName, $schema);
                }
            );
        }

        $tableSchemas = array_map(
            function($tableName) use ($schema) {
                $tableSchema = new TableSchema();
                $tableNameFull = $schema === null ? $tableName : "$schema.$tableName";
                $this->resolveTableNames($tableSchema, $tableNameFull);
                return $tableSchema;
            },
            $tableNames);

        return $tableSchemas;
    }
319645
public static function routeNameTransformer ($name, $schemaParameterPattern, $queryRoute) {
        $multiLevelPath = explode('/', $name);
        $routeName = null;

        if (count($multiLevelPath) > 1) {
            if (is_lumen()) {
                array_walk($multiLevelPath, function (&$multiName) {
                    $multiName = "$multiName:$multiName";
                });
            }

            foreach ($multiLevelPath as $multiName) {
                $routeName = !$routeName ? null : $routeName . '/';
                $routeName =
                    $routeName
                    . preg_replace($schemaParameterPattern, '{' . $multiName . '}', $queryRoute);
            }
        }

        return $routeName ?: preg_replace($schemaParameterPattern, '{' . (is_lumen() ? "$name:$name" : $name) . '}', $queryRoute);
    }
277579
public function load($request, $formName = null) {
        $data = $request->getBodyParams();
        $keys = array_keys($this->getAttributes());

        if ($formName == null) {
            foreach($keys as $key) {
                if (isset($data[$key]) && !is_array($data[$key])) {
                    $this->setAttribute($key,$data[$key]);
                }
            }
            return true;
        } elseif (isset($data[$formName])) {
            foreach($keys as $key) {
                if (isset($data[$formName][$key]) && !is_array($data[$formName][$key])) {
                    $this->setAttribute($key,$data[$formName][$key]);
                }
            }
            return true;
        } else {
            return false;
        }
    }
1282373
protected function parseSchemaNameToArray($schemaName)
    {
        if (!isset($this->schemas[$this->schemaFolder][$schemaName])) {
            $file = $this->getSchemaFileName($this->schemaFolder, $schemaName);
            try {
                $this->schemas[$this->schemaFolder][$schemaName] = Yaml::parse(file_get_contents($file));
            } catch (ParseException $e) {
                throw new SchemaParserException(sprintf('Error in configuration file: %s', $e->getMessage()));
            }
            $this->mergeDefaultSchemaFile($schemaName);
            $this->mergeIncludedSchemas($schemaName);
            $this->validateSchemaDirectives($schemaName);
        }
    }
1277459
public function getJsonParams(Request $request)
    {
        $request_params = [];

        if (0 === mb_strpos($request->headers->get('Content-Type'), 'application/json')) {
            $request_params = json_decode($request->getContent(), true);
        }

        return $request_params;
    }
584112
public function getTags(Request $request, $className)
    {
        $context = array();

        $tagRepository = $this->em->getRepository($className);
        $context['tags'] = $tagRepository->findBy(array(), array('name' => 'ASC'));

        $searchTag = $request->get('tag') ? explode(',', $request->get('tag')) : null;
        if ($searchTag) {
            $context['activeTag'] = true;
            $context['activeTags'] = $searchTag;
        }

        return $context;
    }
931449
protected function getContentAsArray(Request $request)
    {
        $content = json_decode($request->getContent(), true);

        if (json_last_error() !== JSON_ERROR_NONE) {
            throw new BadRequestException();
        }

        if ($content === null) {
            return [];
        }

        return $content;
    }
956112
public function getSchema(?string $name = null): Schema
    {
        if (empty($this->schemas)) {
            throw new \RuntimeException('At least one schema should be declare.');
        }

        if (null === $name) {
            $schema = \array_values($this->schemas)[0];
        } else {
            if (!isset($this->schemas[$name])) {
                throw new NotFoundHttpException(\sprintf('Could not found "%s" schema.', $name));
            }
            $schema = $this->schemas[$name];
        }

        return $schema;
    }
133360
public function getQueryMapping($schemaKey = 'default')
    {
        /** @noinspection PhpUndefinedFieldInspection */
        /** @noinspection StaticInvocationViaThisInspection */
        $pathWithKey = $this->getSchemaMapping();
        if (!isset($pathWithKey[$schemaKey])) {
            return [];
        }

        $path = trim($pathWithKey[$schemaKey]);
        $contents = trim(file_get_contents($path));
        $result = json_decode($contents, true);
        if (!is_array($result)) {
            return [];
        }

        return $result;
    }
471128
public function remoteEditFormSchema(HTTPRequest $request)
    {
        $schemaID = $request->getURL();
        try {
            $form = $this->remoteEditForm();
            return $this->getSchemaResponse($schemaID, $form);
        } catch (InvalidUrlException $exception) {
            $errors = ValidationResult::create()
                ->addError($exception->getMessage());
            // @todo - Don't create dummy form (pass $form = null)
            $form = Form::create(null, 'Form', FieldList::create(), FieldList::create());
            $code = $exception->getCode();

            if ($code < 300) {
                $code = 500;
            }

            return $this
                ->getSchemaResponse($schemaID, $form, $errors)
                ->setStatusCode($code);
        }
    }
1038327
protected function getColumnCreate(array $schema, string $tableName, string $columnName): array
    {
        $columns = $schema['tables'][$tableName]['columns'];
        $columnData = $columns[$columnName];
        $phinxType = $this->getPhinxColumnType($columnData);
        $columnAttributes = $this->getPhinxColumnOptions($phinxType, $columnData, $columns);

        return [$tableName, $columnName, $phinxType, $columnAttributes];
    }
1243
public function findBy(string $schema, string $typeName, array $criteria = []) : array
    {
        if (!$this->typeExists($schema, $typeName)) {
            return [];
        }

        foreach ($this->storage[$schema][$typeName] as $id => $data) {
            if ($this->matchesCriteria($criteria, $data)) {
                return $data;
            }
        }

        return [];
    }
395817
protected function loadSchema($schema_path)
    {
        $json = false;
        if (file_exists($schema_path)) {
            $contents = file_get_contents($schema_path);
            $json = json_decode($contents);
            if ($json == false) {
                $message = sprintf('Error decoding %s.', $schema_path);
                $this->logger->error($message);
            }
        } else {
            $message = sprintf('Could not load file %s.', $schema_path);
            $this->logger->error($message);
        }

        return $json;
    }