@param Parameter $parameter
@param null $modelParameter

@return array|null
193672
protected function getParameterSelectedChoice(Parameter $parameter, $modelParameter = null): ?array
    {
        $modelParameterValue = $modelParameter->value;

        $value = $parameter->choices()
            ->where('id', $modelParameterValue)
            ->where('parameter_id', $parameter->id)
            ->first();

        if (! $value) {
            return null;
        }

        return [
            'id' => $value->id,
            'slug' => $value->slug,
            'name' => $value->translated_name,
        ];
    }
1301907
public function getParameterTypes(\ReflectionParameter $parameter) : array
    {
        $name = $parameter->getName();
        $function = $parameter->getDeclaringFunction();
        $types = $this->getFunctionParameterTypes($function);

        return isset($types[$name]) ? $types[$name] : [];
    }
47269
private function parseParameter($parameter)
    {
        if (!is_array($parameter)) {
            return print_r($parameter, true);
        }

        return $this->parseArrayParameter($parameter);
    }
559586
public function normalizeValue(Parameter $parameter, string $value = null)
    {
        if (\is_bool($default = $parameter->default())) {
            return !$default;
        }

        if ($parameter->variadic()) {
            return (array) $value;
        }

        if (null === $value) {
            return $parameter->required() ? null : true;
        }

        return $parameter->filter($value);
    }
1182235
private function extractOptionalParameter(string $parameter, array $data)
    {
        if (isset($data[$parameter])) {
            return $data[$parameter];
        }

        return null;
    }
1332208
public function findBy(AbstractModel $model, $param = [])
    {
        if ($this->useCache && $this->modelCache) {
            if (($ret = $this->modelCache->get($model, $param))) {
                return $ret;
            }
        }

        list($query, $param, $type) = $this->queryBuilder->generateSelectForModel($model, $param);

        $result = $this->executeQuery(
            $model,
            $this->prepare(
                $query,
                $this->prepareParam($param)
            )
        );

        if ($this->useCache && $this->modelCache) {
            $this->modelCache->set($model, $param);
        }

        return $result;
    }
1185287
public function getParameter($paramName) {
		if(isset($this->params[$paramName])) {
					return $this->params[$paramName];
		}
		return null;
	}
1293843
protected function getServerParameter($parameter, ServerRequestInterface $request, $default = null)
    {
        return isset($request->getServerParams()[$parameter]) ? $request->getServerParams()[$parameter] : $default;
    }
971384
private function resolveParameter($parameter, $default = null)
    {
        if (($request = $this->resolveRequest()) === null) {
            return $default;
        }

        return $request->attributes->get('_lug_'.$parameter, $default);
    }
1252593
private function filterParameter($parameter)
    {
        $para = [];
        foreach ($parameter as $key => $value) {
            if ('' == $value || 'm' == $key || 'a' == $key || 'c' == $key || 'code' == $key)
                continue;
            else
                $para [$key] = $value;
        }
        return $para;
    }
878414
protected function resolveClass(ReflectionParameter $parameter)
	{
		try
		{
			return $this->make($parameter->getClass()->name);
		}

		// If we can not resolve the class instance, we will check to see if the value
		// is optional, and if it is we will return the optional parameter value as
		// the value of the dependency, similarly to how we do this with scalars.
		catch (BindingResolutionException $e)
		{
			if ($parameter->isOptional())
			{
				return $parameter->getDefaultValue();
			}
			else
			{
				throw $e;
			}
		}
	}
557678
protected function getContextParameter($parameter, $default = null)
    {
        $parameters    = $this->getContextParameters();
        if (array_key_exists($parameter, $parameters)) {
            return $parameters[$parameter];
        } else {
            return $default;
        }
    }
650018
public function resolve(
        Parameter $parameter,
        ParameterBag $unresolvedParameters,
        ParameterBag $resolvedParameters,
        ResolvingContext $context = null,
        ParameterBag $previousResult = null,
        int $counter = 1
    ): ParameterBag {
        if (null === $previousResult) {
            $result = $this->resolver->resolve($parameter, $unresolvedParameters, $resolvedParameters, $context);

            return $this->resolve($parameter, $unresolvedParameters, $resolvedParameters, $context, $result);
        }

        $parameterKey = $parameter->getKey();
        $previousParameterValue = $previousResult->get($parameterKey);
        $counter = $this->incrementCounter($counter, $this->limit, $parameterKey);

        $newResult = $this->resolver->resolve(
            $parameter->withValue($previousParameterValue),
            $unresolvedParameters,
            $resolvedParameters,
            $context
        );
        $newParameterValue = $newResult->get($parameterKey);
        $result = $this->mergeResults($previousResult, $newResult);

        if ($previousParameterValue === $newParameterValue) {
            return $result;
        }

        return $this->resolve($parameter, $unresolvedParameters, $resolvedParameters, $context, $result, $counter);
    }
866599
private function determineParamValue(\ReflectionParameter $parameter)
    {
        $class = $parameter->getClass();

        if (!empty($class)) {
            // If this is a object we may be able to map it to something in our context
            $className = $class->getName();

            // Determine strong type-based link
            if (isset($this->instances[$className])) {
                return $this->instances[$className];
            }

            // Determine weak type-based link
            if (isset($this->weakLinks[$className])) {
                $lowerClassName = $this->weakLinks[$className];
                return $this->instances[$lowerClassName];
            }
        } else {
            // If this is a primitive type, attempt to determine it by its name
            $varName = $parameter->getName();

            if (isset($this->variablesByName[$varName])) {
                return $this->variablesByName[$varName];
            }
        }

        // We were unable to determine a suitable value based on this context. Pass back its default value if possible.
        if ($parameter->isDefaultValueAvailable()) {
            return $parameter->getDefaultValue();
        }

        // As a final fallback we will primitive pass NULL and let the function deal with it.
        return null;
    }
271359
protected function loadField($modelFieldInfo, &$parameter, $result) {
    if ($modelFieldInfo->isMABIModel) {
      if (empty($result)) {
        $parameter = NULL;
      }
      else {
        /**
         * @var $model \MABI\Model
         */
        $model = call_user_func($modelFieldInfo->type . '::init', $this->app);
        $model->load($result);
        $parameter = $model;
      }
    }
    else {
      switch ($modelFieldInfo->type) {
        case 'string':
          $parameter = $result;
          break;
        case 'int':
          $parameter = intval($result);
          break;
        case 'bool':
          $parameter = $result == TRUE;
          break;
        case 'float':
          $parameter = floatval($result);
          break;
        case 'DateTime':
        case '\DateTime':
          if (empty($result)) {
            $parameter = NULL;
          }
          else {
            $parameter = new \DateTime('@' . $result);
          }
          break;
        case '':
        case 'array':
          $parameter = $result;
      }
    };
  }
1276198
protected function get($parameter, $default=null) {
		return isset($this->parameters[$parameter]) ? $this->parameters[$parameter] : $default;
	}
674934
protected function transformDependency(ReflectionParameter $parameter, $parameters)
    {
        $class = $parameter->getClass();

        // If the parameter has a type-hinted class, we will check to see if it is already in
        // the list of parameters. If it is we will just skip it as it is probably a model
        // binding and we do not want to mess with those; otherwise, we resolve it here.
        if (! is_null($class) && ! $this->alreadyInParameters($className = $class->name, $parameters)) {
            return $parameter->isDefaultValueAvailable()
                ? $parameter->getDefaultValue()
                : $this->container->make($className);
        }
    }