当前位置: 首页>>代码示例>>PHP>>正文


PHP Container::make方法代码示例

本文整理汇总了PHP中Illuminate\Contracts\Container\Container::make方法的典型用法代码示例。如果您正苦于以下问题:PHP Container::make方法的具体用法?PHP Container::make怎么用?PHP Container::make使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Illuminate\Contracts\Container\Container的用法示例。


在下文中一共展示了Container::make方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: handle

 /**
  * Handle the command.
  *
  * @param Container $container
  */
 public function handle(Container $container)
 {
     /*
      * Set the default options handler based
      * on the builder class. Defaulting to
      * no handler.
      */
     if (!$this->builder->getRepository()) {
         $model = $this->builder->getFormModel();
         $entry = $this->builder->getEntry();
         $form = $this->builder->getForm();
         $repository = str_replace('FormBuilder', 'FormRepository', get_class($this->builder));
         if (!$this->builder->getRepository() && class_exists($repository)) {
             $this->builder->setRepository($container->make($repository, compact('form', 'model')));
         } elseif (!$this->builder->getRepository() && $model instanceof EntryModel) {
             $this->builder->setRepository($container->make(EntryFormRepository::class, compact('form', 'model')));
         } elseif (!$this->builder->getRepository() && $model instanceof EloquentModel) {
             $this->builder->setRepository($container->make(EloquentFormRepository::class, compact('form', 'model')));
         } elseif (!$this->builder->getRepository() && $entry instanceof EntryModel) {
             $this->builder->setRepository($container->make(EntryFormRepository::class, ['form' => $form, 'model' => $entry]));
         } elseif (!$this->builder->getRepository() && $entry instanceof EloquentModel) {
             $this->builder->setRepository($container->make(EloquentFormRepository::class, ['form' => $form, 'model' => $entry]));
         }
     }
 }
开发者ID:huglester,项目名称:streams-platform,代码行数:30,代码来源:SetRepository.php

示例2: make

 /**
  * Resolve the given resource name.
  *
  * @param  string                                               $name
  * @throws \ByCedric\Allay\Exceptions\ResourceNotFoundException
  * @return mixed
  */
 public function make($name)
 {
     if ($this->contains($name)) {
         return $this->container->make($this->resources[$name]);
     }
     throw new ResourceNotFoundException($name);
 }
开发者ID:bycedric,项目名称:allay,代码行数:14,代码来源:Manager.php

示例3: make

 public function make($class)
 {
     $command = $this->container->make($class);
     $command->setLaravel($this->container);
     $command->setServer($this->container->make('FluxBB\\Server\\ServerInterface'));
     return $command;
 }
开发者ID:fluxbb,项目名称:core,代码行数:7,代码来源:CommandFactory.php

示例4: add

 /**
  * @param string $class
  * @param int $priority
  * @return Storage
  */
 public function add($class, $priority = self::PRIORITY_DEFAULT) : Storage
 {
     $this->container->bind($class, $class);
     $instance = $this->container->make($class);
     $this->storage->insert($instance, $priority);
     return $this;
 }
开发者ID:Dualse,项目名称:GitterBot,代码行数:12,代码来源:Storage.php

示例5: failed

 /**
  * Call the failed method on the job instance.
  *
  * @param  array $data
  * @return void
  */
 public function failed(array $data)
 {
     $handler = $this->container->make($data['class']);
     if (method_exists($handler, 'failed')) {
         call_user_func_array([$handler, 'failed'], unserialize($data['data']));
     }
 }
开发者ID:scrobot,项目名称:Lumen,代码行数:13,代码来源:CallQueuedHandler.php

示例6: send

 /**
  * Execute the given API action class, pass the input and return its response.
  *
  * @param User $actor
  * @param string $actionClass
  * @param array $input
  * @return object
  */
 public function send(User $actor, $actionClass, array $input = [])
 {
     /** @var \Flarum\Api\Actions\JsonApiAction $action */
     $action = $this->container->make($actionClass);
     $response = $action->handle(new Request($input, $actor));
     return new Response($response);
 }
开发者ID:huytd,项目名称:core,代码行数:15,代码来源:Client.php

示例7: resolve

 /**
  * Add a command, resolving through the application.
  *
  * @param string $command
  *
  * @return \Symfony\Component\Console\Command\Command
  */
 public function resolve($command)
 {
     if (is_null($this->container)) {
         $this->container = Container::getInstance();
     }
     return $this->add($this->container->make($command));
 }
开发者ID:notadd,项目名称:framework,代码行数:14,代码来源:Application.php

示例8: getSlice

 /**
  * Get a Closure that represents a slice of the application onion.
  *
  * @return \Closure
  */
 protected function getSlice()
 {
     return function ($stack, $middleware) {
         return function ($request) use($stack, $middleware) {
             return $this->container->make($middleware)->handle($request, $stack);
         };
     };
 }
开发者ID:devonzara,项目名称:framework,代码行数:13,代码来源:Stack.php

示例9: make

 /**
  * Make a view.
  *
  * @param  array $parameters
  * @return ViewInterface
  */
 public function make(array $parameters)
 {
     if (!class_exists(array_get($parameters, 'view'))) {
         array_set($parameters, 'view', $this->view);
     }
     $this->hydrator->hydrate($view = $this->container->make(array_get($parameters, 'view'), $parameters), $parameters);
     return $view;
 }
开发者ID:jacksun101,项目名称:streams-platform,代码行数:14,代码来源:ViewFactory.php

示例10: createDecorator

 /**
  * Some decorators depend on others to complete their task.
  *
  * This is a helper method to easily create decorators that are available.
  *
  * @param string $class
  *
  * @throws \McCool\LaravelAutoPresenter\Exceptions\DecoratorNotFound
  *
  * @return object
  */
 public function createDecorator($class)
 {
     $decoratorClass = implode('\\', [__NAMESPACE__, $class . 'Decorator']);
     if (!class_exists($decoratorClass)) {
         throw new DecoratorNotFound($decoratorClass);
     }
     return $this->container->make($decoratorClass);
 }
开发者ID:ssomenzi,项目名称:silence,代码行数:19,代码来源:BaseDecorator.php

示例11: getValidatorForCommand

 /**
  * Retrieves the validator for a specified command
  *
  * @param string $commandName
  * @return null|object
  */
 public function getValidatorForCommand($commandName)
 {
     $class_name = sprintf('%sValidator', $commandName);
     if (false === class_exists($class_name)) {
         return null;
     }
     return $this->app->make($class_name);
 }
开发者ID:DeSmart,项目名称:laravel-commandbus,代码行数:14,代码来源:ValidatorLocatorFactory.php

示例12: resolve

 /**
  * Resolve the current request.
  *
  * @return \Bugsnag\Request\RequestInterface
  */
 public function resolve()
 {
     if ($this->app->runningInConsole()) {
         return new NullRequest();
     }
     $request = $this->app->make(Request::class);
     return new LaravelRequest($request);
 }
开发者ID:bugsnag,项目名称:bugsnag-laravel,代码行数:13,代码来源:LaravelResolver.php

示例13: resolveServiceClass

 /**
  * Resolve a class based on the driver configuration
  *
  * @return \Indatus\Dispatcher\Scheduling\ScheduleService
  */
 public function resolveServiceClass()
 {
     try {
         return $this->container->make($this->getDriver() . '\\ScheduleService');
     } catch (ReflectionException $e) {
         return $this->container->make('Indatus\\Dispatcher\\Drivers\\' . $this->getDriver() . '\\ScheduleService');
     }
 }
开发者ID:priestd09,项目名称:dispatcher,代码行数:13,代码来源:ConfigResolver.php

示例14: getHandlerForCommand

 /**
  * Returns the handler located in the same directory for a specified command.
  *
  * @param  string  $command
  * @return object
  *
  * @throws \League\Tactician\Exception\MissingHandlerException
  */
 public function getHandlerForCommand($command)
 {
     $handler = substr_replace($command, 'CommandHandler', strrpos($command, 'Command'));
     if (!class_exists($handler)) {
         throw MissingHandlerException::forCommand($command);
     }
     return $this->container->make($handler);
 }
开发者ID:tillkruss,项目名称:laravel-tactician,代码行数:16,代码来源:AdjacentLocator.php

示例15: requestHandler

 /**
  * @param $requestClass
  * @return RequestHandlerInterface
  */
 private function requestHandler($requestClass)
 {
     $handler = $this->container->make($requestClass);
     if (!$handler instanceof RequestHandlerInterface) {
         throw new RuntimeException("Class {$requestClass} is not a request handler.");
     }
     return $handler;
 }
开发者ID:cloudcreativity,项目名称:laravel-json-api,代码行数:12,代码来源:HandleRequest.php


注:本文中的Illuminate\Contracts\Container\Container::make方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。