@param Expr\Variable  $instance
@param SetterMethod[] $setterMethods

@return Expr\MethodCall[]
339862
public function getSetterInjection(Expr\Variable $instance, array $setterMethods) : array
    {
        $setters = [];
        foreach ($setterMethods as $setterMethod) {
            $isOptional = ($this->privateProperty)($setterMethod, 'isOptional');
            $method = ($this->privateProperty)($setterMethod, 'method');
            $argumentsObject = ($this->privateProperty)($setterMethod, 'arguments');
            $arguments = ($this->privateProperty)($argumentsObject, 'arguments');
            $args = $this->getSetterParams($arguments, $isOptional);
            if (! $args) {
                continue;
            }
            $setters[] = new Expr\MethodCall($instance, $method, $args);
        }

        return $setters;
    }
1032350
protected function collectProxyMethods(\ReflectionClass $ref)
	{
		$methods = [];
		
		foreach($ref->getMethods() as $method)
		{
			if($method->isStatic() || $method->isPrivate())
			{
				continue;
			}
			
			if(substr($method->getName(), 0, 2) == '__')
			{
				continue;
			}
			
			if($method->isFinal())
			{
				throw new ScopedProxyException(sprintf('Unable to build scoped proxy due to final method %s->%s()', $ref->getName(), $method->getName()));
			}
			
			$methods[strtolower($method->getName())] = $method;
		}
	
		return $methods;
	}
567728
protected function callOnceAfterMethodHooks($classInstance, $method, array $args = [])
    {
        $method = self::getCalledMethod($method);

        $onceAfterMethodName = 'onceAfter'.ucfirst($method);
        if ( ! isset($this->instanceOnceCalledMethods['after'][$onceAfterMethodName])) {
            if (isset($this->hooks[$onceAfterMethodName])) {
                $this->instanceOnceCalledMethods['after'][$onceAfterMethodName] = true;

                foreach ($this->hooks[$onceAfterMethodName] as $callable) {
                    try {
                        $return = $this->callCallable($classInstance, $callable, $args, $method, false);
                    } catch (CancelPropagationException $e) {
                        break;
                    }

                    if ($return !== null) {
                        return $return;
                    }
                }
            }
        }

        $return = $this->callGlobalOnceAfterMethodHooks($classInstance, $method, $onceAfterMethodName);

        if ($return !== null) {
            return $return;
        }
    }
439195
protected function call($instance, $route, $method)
    {
        $parameters = $this->resolveClassMethodDependencies(
            $route->parametersWithoutNulls(), $instance, $method
        );

        if ($this->creator && method_exists($this->creator, 'modifyMethodParameters')) {
            $this->creator->modifyMethodParameters($instance, $method, $parameters);
        }

        return $instance->callAction($method, $parameters);
    }
988174
private function findInstanceByCallbackType($instanceName) {
		// Note: we execute the code in another thread. Always.
		// This prevent crashing the main thread.
		try {
			$fullyQualifiedClassName = MoufReflectionProxy::getReturnTypeFromCode($this->declaredInstances[$instanceName]["code"], $this->getScope() == self::SCOPE_ADMIN);
			unset($this->declaredInstances[$instanceName]["error"]);
			unset($this->declaredInstances[$instanceName]["constructor"]);
			unset($this->declaredInstances[$instanceName]["fieldProperties"]);
			unset($this->declaredInstances[$instanceName]["setterProperties"]);
			unset($this->declaredInstances[$instanceName]["fieldBinds"]);
			unset($this->declaredInstances[$instanceName]["setterBinds"]);
			$this->declaredInstances[$instanceName]["class"] = $fullyQualifiedClassName;
		} catch (\Exception $e) {
			$this->declaredInstances[$instanceName]["error"] = $e->getMessage();
			unset($this->declaredInstances[$instanceName]["class"]);
			$fullyQualifiedClassName = null;
		}
		return $fullyQualifiedClassName;
	}
991588
protected function invokeMethods($instance)
    {
        foreach ($this->methods as $method) {
            $args = $this->resolveArguments($method['arguments']);
            call_user_func_array([$instance, $method['method']], $args);
        }

        return $instance;
    }
592827
protected function populateGetterLists(array $methodList, $isInScope, ReflectionClass $ref)
    {
        /** @var \ReflectionMethod $method */
        foreach ($methodList as $method) {
            // Check, if the method is really available, inside the analysis
            // context. A inherited private method can not be called inside the
            // $this context.
            if ($isInScope === true &&
                $method->isPrivate() === true &&
                $method->getDeclaringClass()->getName() !== $ref->getName()
            ) {
                // We skip this one, it's out of scope.
                // Meh, as of 03-11-2018, I have never seen a private getter in
                // my whole life.
                continue;
            }

            if (strpos($method->getName(), 'get') === 0) {
                /** @var \ReflectionMethod $method */
                $parameters = $method->getParameters();
                if (empty($parameters)) {
                    $this->normalGetter[] = $method;
                }
            } elseif (strpos($method->getName(), 'is') === 0) {
                /** @var \ReflectionMethod $method */
                $parameters = $method->getParameters();
                if (empty($parameters)) {
                    $this->isGetter[] = $method;
                }
            } elseif (strpos($method->getName(), 'has') === 0) {
                /** @var \ReflectionMethod $method */
                $parameters = $method->getParameters();
                if (empty($parameters)) {
                    $this->hasGetter[] = $method;
                }
            }
        }
    }
833936
public function getMethodAnnotations(\ReflectionMethod $method)
    {
        return array_merge(
            $this->reader->getMethodAnnotations($method),
            $this->converter->getMethodAnnotations($method)
        );
    }
274144
static function instance(array $setterOpts = [])
    {
        if (self::$instance and self::$instance instanceof self) {
            if (!empty($setterOpts))
                throw new \Exception('Application can only build once with setter options.');

            return self::$instance;
        }

        $Application = new self($setterOpts);
        self::$instance = $Application;

        return self::$instance;
    }
68517
def method_missing(m, *args, &block)
      if args.any?
        args = args.first if args.length == 1
        @var << { m.to_sym => args }
        instance_variable_set "@#{m}", args
      else
        instance_variable_get "@#{m}"
      end
    end
164090
private function callInitMethod($instance)
    {
        $args = [];
        foreach ($this->init_method_args as $arg) {
            if (is_string($arg) && preg_match('/^\$([\w_]+)$/', $arg, $matches)) {
                $arg = $this->container->get($matches[1]);
            }
            $args[] = $arg;
        }
        call_user_func_array(array($instance, $this->init_method_name), $args);
    }
970131
protected function _setValuesToObject($instance, $values = null) {
		if (URequest::isJSON ()) {
			if(is_string($values)){
				$values = \json_decode ( $values, true );
			}
		}
		$className = \get_class ( $instance );
		$fieldsInRelationForUpdate = OrmUtils::getFieldsInRelationsForUpdate_ ( $className );
		$manyToOneRelations = $fieldsInRelationForUpdate ["manyToOne"];
		
		$members = array_keys ( $values );
		OrmUtils::setFieldToMemberNames ( $members, $fieldsInRelationForUpdate ["relations"] );
		URequest::setValuesToObject ( $instance, $values );
		if ($manyToOneRelations) {
			$this->updateManyToOne ( $manyToOneRelations, $members, $className, $instance, $values );
		}
	}
42819
protected function bindClosureToInstance($closure, $instance)
    {
        if ($closure instanceof \Closure) {
            $closure = $closure->bind($closure, $instance, get_class($instance));
        }

        return $closure;
    }
1356078
public function getBoundComponentsOnSetter($instanceName, $setterName) {
		if (isset($this->declaredInstances[$instanceName]) && isset($this->declaredInstances[$instanceName]['setterBinds']) && isset($this->declaredInstances[$instanceName]['setterBinds'][$setterName]))
			return $this->declaredInstances[$instanceName]['setterBinds'][$setterName];
		else
			return null;
	}
67121
private function getRealCalledMethod(CompilationContext $compilationContext, Variable $caller, $methodName)
    {
        $compiler = $compilationContext->compiler;

        $numberPoly = 0;
        $method = null;

        if ('this' == $caller->getRealName()) {
            $classDefinition = $compilationContext->classDefinition;
            if ($classDefinition->hasMethod($methodName)) {
                ++$numberPoly;
                $method = $classDefinition->getMethod($methodName);
            }
        } else {
            $classTypes = $caller->getClassTypes();
            foreach ($classTypes as $classType) {
                if ($compiler->isInterface($classType)) {
                    continue;
                }

                if ($compiler->isClass($classType) ||
                    $compiler->isBundledClass($classType) ||
                    $compiler->isBundledInterface($classType)
                ) {
                    if ($compiler->isClass($classType)) {
                        $classDefinition = $compiler->getClassDefinition($classType);
                    } else {
                        $classDefinition = $compiler->getInternalClassDefinition($classType);
                    }

                    if (!$classDefinition) {
                        continue;
                    }

                    if ($classDefinition->hasMethod($methodName) && !$classDefinition->isInterface()) {
                        ++$numberPoly;
                        $method = $classDefinition->getMethod($methodName);
                    }
                }
            }
        }

        return [$numberPoly, $method];
    }
883975
public function getMiddleware( $instance, $method )
	{
		$results = new Collection;

		foreach ( $instance->getMiddleware() as $name => $options )
			if ( !$this->methodExcludedByOptions( $method, $options ) )
				$results[] = $this->router->resolveMiddlewareClassName( $name );

		return $results->flatten()->all();
	}
171572
protected function resolveClassMethodDependencies( array $parameters, $instance, $method )
	{
		if ( !method_exists( $instance, $method ) )
			return $parameters;

		return $this->resolveMethodDependencies( $parameters, new ReflectionMethod( $instance, $method ) );
	}