dependency injection
182093
function( m, opts ) {
        return function( o, cb ) {
            var r = __request.apply( this, arguments );
            m.trigger( "request", m, r, opts );
            return r;
        }
    }
407077
private function processCreateDI($name)
    {
        $this->dependencyService->processCommand('injectModel', $name);
        $this->dependencyService->create($name);
    }
330538
private function patchDependencyInjection()
    {
        $bundleDir = $this->bundle->getPath();
        $configurationFile = $bundleDir . '/DependencyInjection/Configuration.php';
        $resourceName = strtolower($this->model);
        $modelName = $this->registry->getAliasNamespace($this->bundle->getName()) . '\\' . $this->model;
        $controllerName = $this->configuration['namespace'] . '\\' . $this->model . 'Controller';

        $ref = <<<EOF
                        ->arrayNode('$resourceName')
                            ->addDefaultsIfNotSet()
                            ->children()
                                ->scalarNode('model')
                                    ->defaultValue('$modelName')
                                ->end()
                                ->scalarNode('controller')
EOF;

        if (!$this->refExist($configurationFile, $ref)) {
            $this->addError(sprintf('Cannot patch dependency injection "%s"', $configurationFile));

            return false;
        } elseif ($this->refExist($configurationFile, $ref . "\n                                    ->defaultValue('")) {
            $this->addError(sprintf(
                    'A default value is already define for "%s" controller in dependency injection "%s"',
                    $this->model,
                    $configurationFile
            ));

            return false;
        }

        $nodeDeclaration = <<<EOF
                                    ->defaultValue('$controllerName')
EOF;

        $this->dumpFile($configurationFile, "\n" . $nodeDeclaration . "\n                                ", $ref);
    }
1170605
public function registerAutoloaders($dependencyInjector)
    {
        if ($this::DIR != null) {
            $namespace = substr(get_class($this), 0, strripos(get_class($this), '\\'));
            $loader = $dependencyInjector->get('loader');
            $loader->registerNamespaces([$namespace => $this::DIR . '/']);
            $loader->register();
        }
    }
611464
private void registerGinjectorBinding() {
    Key<? extends Ginjector> ginjectorKey = Key.get(ginjectorInterface);
    rootGinjectorBindings.addBinding(ginjectorKey, bindingFactory.getGinjectorBinding());
  }
530224
void loadEagerSingletons(InjectorImpl injector, Stage stage, final Errors errors) {
    List<BindingImpl<?>> candidateBindings = new ArrayList<>();
    @SuppressWarnings("unchecked") // casting Collection<Binding> to Collection<BindingImpl> is safe
    Collection<BindingImpl<?>> bindingsAtThisLevel =
        (Collection) injector.state.getExplicitBindingsThisLevel().values();
    candidateBindings.addAll(bindingsAtThisLevel);
    synchronized (injector.state.lock()) {
      // jit bindings must be accessed while holding the lock.
      candidateBindings.addAll(injector.jitBindings.values());
    }
    InternalContext context = injector.enterContext();
    try {
      for (BindingImpl<?> binding : candidateBindings) {
        if (isEagerSingleton(injector, binding, stage)) {
          Dependency<?> dependency = Dependency.get(binding.getKey());
          Dependency previous = context.pushDependency(dependency, binding.getSource());

          try {
            binding.getInternalFactory().get(context, dependency, false);
          } catch (InternalProvisionException e) {
            errors.withSource(dependency).merge(e);
          } finally {
              context.popStateAndSetDependency(previous);
            }
        }
      }
    } finally {
      context.close();
    }
  }
198716
protected function registerCustomBindings(): void
    {
        $repositoryFactory = $this->app->make(IRepositoryFactory::class);

        foreach (config('laravel_repositories.bindings') as $className => $repository) {
            $repositoryFactory->register($className, $repository);
        }
    }
773303
def bind_to_provider(self, cls, provider):
        """"""
        self._check_class(cls)
        if provider is None:
            raise InjectorException('Provider cannot be None, key=%s' % cls)

        self._bindings[cls] = provider
        logger.debug('Bound %s to a provider %s', cls, provider)
        return self
91579
private function processDependencies(&$binding): void
    {
        // Let's use the ReflectionClass object previously generated during binding.
        // If it's not instantiable, then we can do nothing... throw exception.
        if (! $binding['reflector']->isInstantiable()) {
            throw new ContainerException($binding['concrete'].' can not be instantiated.');
        }

        // Get the class constructor and see what we have. If there is no constructor,
        // then return an empty array of dependencies.
        if (! $binding['reflector']->getConstructor()) {
            $binding['dependencies'] = [];

            return;
        }

        // Otherwise get the constructor parameters and resolve them.
        $binding['dependencies'] = $this->resolveParameters($binding['reflector']->getConstructor()->getParameters());
    }
90217
public void installBindings(DependencyExplorerOutput output) {
    positions.position(output);
    
    // Install each implicit binding in the correct position
    for (Map.Entry<Key<?>, Binding> entry : output.getImplicitBindings()) {
      installBinding(output.getGraph(), entry.getKey(), entry.getValue());
    }
    
    // Make sure that each of the dependencies needed directly from the origin are available
    GinjectorBindings origin = output.getGraph().getOrigin();
    inheritBindingsForDeps(origin, origin.getDependencies());
  }
1337994
@Override
    public final InjectionBinding<A> createInjectionBinding(A annotation,
                                                            Class<?> instanceClass,
                                                            Member member,
                                                            String jndiName)
                    throws InjectionException
    {
        return createInjectionBinding(annotation, instanceClass, member);
    }
66188
def injectClassCallback(annotationName, depth, methodName, *args, **kwargs):
    
    locals = reflect.class_locals(depth, annotationName)
    annotations = locals.get(_CLASS_ANNOTATIONS_ATTR, None)
    if annotations is None:
        annotations = list()
        locals[_CLASS_ANNOTATIONS_ATTR] = annotations
    annotation = (annotationName, methodName, args, kwargs)
    annotations.append(annotation)
524073
public <T, K extends T> void bind(Class<T> abstraction, Class<K> implementation) {
        injectorConfiguration = injectorConfiguration.withAlias(abstraction, implementation);
    }
1074881
public void registerServices(boolean force) {
		Injector injector = Guice.createInjector(getGuiceModule());
		injector.injectMembers(this);
		registerInRegistry(force);
	}
1064408
public void injectInto(FactoryAccessor<?> accessor) {
        logger.trace(display(accessor.getNearType()));
        Class<?> nearType = accessor.getNearType();
        if (nearTypeToFactory.containsKey(nearType)) {
            BridgeFactory factory = nearTypeToFactory.get(nearType);
            accessor.set(factory);
        } else {
            Collection<FactoryAccessor<?>> typedAccessors;
            if (accessors.containsKey(nearType)) {
                typedAccessors = accessors.get(nearType);
            } else {
                typedAccessors = new ArrayList<>();
                accessors.put(nearType, typedAccessors);
            }
            typedAccessors.add(accessor);
        }
    }
853810
protected function registerInterfaceBindings()
    {
        $this->app->singleton(LocaleRepositoryInterface::class, LocaleRepository::class);
        $this->app->singleton(MenuConfigInterpreterInterface::class, MenuConfigInterpreter::class);
        $this->app->singleton(MenuModulesInterpreterInterface::class, MenuModulesInterpreter::class);
        $this->app->singleton(MenuPermissionsFilterInterface::class, MenuPermissionsFilter::class);

        return $this;
    }
145838
@Sensitive
    @Override
    public InjectionBinding<MailSessionDefinition> createInjectionBinding(@Sensitive MailSessionDefinition annotation, Class<?> instanceClass, Member member, String jndiName) throws InjectionException {
        InjectionBinding<MailSessionDefinition> injectionBinding =
                        new MailSessionDefinitionInjectionBinding(jndiName, ivNameSpaceConfig);
        injectionBinding.merge(annotation, instanceClass, null);
        return injectionBinding;
    }