private static function determineParameters($arguments) {
		$constructor = (new \ReflectionClass(static::class))->getConstructor();
		$parameters = [];

		if (!is_null($constructor)) {
			foreach ($constructor->getParameters() as $parameter) {
				$parameterClass = $parameter->getClass();

				if (!is_null($parameterClass) && isset(self::$instance[$parameterClass->name])) {
					$parameters[] = self::$instance[$parameterClass->name];
				} elseif (!is_null($parameterClass) && $parameterClass->isSubclassOf(DependencyManager::class)) {
					if (isset(self::$loading[$parameterClass->name])) {
						throw new CsrOrmException(sprintf(self::ERROR_CIRCULAR_DEPENDENCY, $parameterClass->name, static::class));
					}

					$parameters[] = self::loadDependency($parameterClass->name);
				} elseif (count($arguments) > 0) {
					$argument = array_pop($arguments);
					self::assertTypeEqualOrSubClass($argument, $parameterClass);
					$parameters[] = $argument;
				} else {
					throw new CsrOrmException(self::ERROR_UNEXPECTED_AMOUNT_OF_PARAMETERS);
				}
			}
		}

		if (count($arguments) !== 0) {
			throw new CsrOrmException(self::ERROR_UNEXPECTED_AMOUNT_OF_PARAMETERS);
		}

		self::$loading = [];

		return $parameters;
	}
private static function determineParameters($arguments) {
		$constructor = (new \ReflectionClass(static::class))->getConstructor();
		$parameters = [];

		if (!is_null($constructor)) {
			foreach ($constructor->getParameters() as $parameter) {
				$parameterClass = $parameter->getClass();

				if (!is_null($parameterClass) && isset(self::$instance[$parameterClass->name])) {
					$parameters[] = self::$instance[$parameterClass->name];
				} elseif (!is_null($parameterClass) && $parameterClass->isSubclassOf(DependencyManager::class)) {
					if (isset(self::$loading[$parameterClass->name])) {
						throw new CsrOrmException(sprintf(self::ERROR_CIRCULAR_DEPENDENCY, $parameterClass->name, static::class));
					}

					$parameters[] = self::loadDependency($parameterClass->name);
				} elseif (count($arguments) > 0) {
					$argument = array_pop($arguments);
					self::assertTypeEqualOrSubClass($argument, $parameterClass);
					$parameters[] = $argument;
				} else {
					throw new CsrOrmException(self::ERROR_UNEXPECTED_AMOUNT_OF_PARAMETERS);
				}
			}
		}

		if (count($arguments) !== 0) {
			throw new CsrOrmException(self::ERROR_UNEXPECTED_AMOUNT_OF_PARAMETERS);
		}

		self::$loading = [];

		return $parameters;
	}
private static function determineParameters ( $ arguments ) { $ constructor = ( new \ ReflectionClass ( static :: class ) ) -> getConstructor ( ) ; $ parameters = [ ] ; if ( ! is_null ( $ constructor ) ) { foreach ( $ constructor -> getParameters ( ) as $ parameter ) { $ parameterClass = $ parameter -> getClass ( ) ; if ( ! is_null ( $ parameterClass ) && isset ( self :: $ instance [ $ parameterClass -> name ] ) ) { $ parameters [ ] = self :: $ instance [ $ parameterClass -> name ] ; } elseif ( ! is_null ( $ parameterClass ) && $ parameterClass -> isSubclassOf ( DependencyManager :: class ) ) { if ( isset ( self :: $ loading [ $ parameterClass -> name ] ) ) { throw new CsrOrmException ( sprintf ( self :: ERROR_CIRCULAR_DEPENDENCY , $ parameterClass -> name , static :: class ) ) ; } $ parameters [ ] = self :: loadDependency ( $ parameterClass -> name ) ; } elseif ( count ( $ arguments ) > 0 ) { $ argument = array_pop ( $ arguments ) ; self :: assertTypeEqualOrSubClass ( $ argument , $ parameterClass ) ; $ parameters [ ] = $ argument ; } else { throw new CsrOrmException ( self :: ERROR_UNEXPECTED_AMOUNT_OF_PARAMETERS ) ; } } } if ( count ( $ arguments ) !== 0 ) { throw new CsrOrmException ( self :: ERROR_UNEXPECTED_AMOUNT_OF_PARAMETERS ) ; } self :: $ loading = [ ] ; return $ parameters ; }
Determine the parameters to be used for initializing this Dependency.
A parameter can be one of the following

- A type available in the DependencyManager:
Will be loaded, can be any class. (cannot be scalar)

- Of type DependencyManager:
It will be loaded from the instances or created when it is not yet initialized

- Any other type:
It is expected to be in $arguments, if it isn't an Exception is thrown.

@param array $arguments
@return array
@throws CsrOrmException
Determine the parameters to be used for initializing this Dependency . A parameter can be one of the following