• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Config\Repository类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Illuminate\Config\Repository的典型用法代码示例。如果您正苦于以下问题:PHP Repository类的具体用法?PHP Repository怎么用?PHP Repository使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: __construct

 /**
  * Instance API.
  *
  * @param Repository $config  $router
  * @param Router     $router
  * @param Request    $request
  * @param Client     $remote
  */
 public function __construct(Repository $config, Router $router, Request $request, Client $remoteClient)
 {
     $this->config = $config->get('api::config');
     $this->router = $router;
     $this->request = $request;
     $this->remoteClient = $remoteClient;
 }
开发者ID:elijan,项目名称:laravel4-api,代码行数:15,代码来源:Api.php


示例2: handle

 /**
  * Handle the fields.
  *
  * @param PermissionFormBuilder $builder
  * @param AddonCollection       $addons
  * @param Translator            $translator
  * @param Repository            $config
  */
 public function handle(PermissionFormBuilder $builder, AddonCollection $addons, Translator $translator, Repository $config)
 {
     /* @var UserInterface $user */
     $user = $builder->getEntry();
     $fields = [];
     $namespaces = ['streams'];
     /* @var Addon $addon */
     foreach ($addons->withConfig('permissions') as $addon) {
         $namespaces[] = $addon->getNamespace();
     }
     foreach ($namespaces as $namespace) {
         foreach ($config->get($namespace . '::permissions', []) as $group => $permissions) {
             $label = $namespace . '::permission.' . $group . '.name';
             if (!$translator->has($warning = $namespace . '::permission.' . $group . '.warning')) {
                 $warning = null;
             }
             if (!$translator->has($instructions = $namespace . '::permission.' . $group . '.instructions')) {
                 $instructions = null;
             }
             $fields[$namespace . '::' . $group] = ['label' => $label, 'warning' => $warning, 'instructions' => $instructions, 'type' => 'anomaly.field_type.checkboxes', 'value' => function () use($user, $namespace, $group) {
                 return array_map(function ($permission) use($user, $namespace, $group) {
                     return str_replace($namespace . '::' . $group . '.', '', $permission);
                 }, $user->getPermissions());
             }, 'config' => ['options' => function () use($group, $permissions, $namespace) {
                 return array_combine($permissions, array_map(function ($permission) use($namespace, $group) {
                     return $namespace . '::permission.' . $group . '.option.' . $permission;
                 }, $permissions));
             }]];
         }
     }
     $builder->setFields($fields);
 }
开发者ID:tobz-nz,项目名称:users-module,代码行数:40,代码来源:PermissionFormFields.php


示例3: getCacheConfiguredBy

 /**
  * Configures cache for test-suites.
  *
  * @param Repository $config
  */
 protected function getCacheConfiguredBy(Repository $config)
 {
     // Configuration for Redis.
     $config->set('cache.stores.redis', ['cluster' => false, 'test_connection' => ['host' => '127.0.0.1', 'port' => 6379, 'database' => 0]]);
     // Configuration for Redis.
     $config->set('yacache', ['driver' => 'redis', 'default' => 'redis', 'connection' => 'test_connection', 'prefix' => 'prefix', 'codec' => 'Illuminate\\YetAnother\\Cache\\Serializer\\Codec\\MsgPack']);
 }
开发者ID:shingoOKAWA,项目名称:yacache-l5-php,代码行数:12,代码来源:IlluminateEnvironment.php


示例4: __construct

 /**
  *	Construct Magento Instance
  *
  *	@return void
  */
 public function __construct(Repository $config)
 {
     $this->connections = $config->get('magento::connections');
     if (is_array($this->connections)) {
         $this->batchRegister($this->connections);
     }
 }
开发者ID:Beaudinn,项目名称:laravel-magento-integration,代码行数:12,代码来源:Magento.php


示例5: __construct

 public function __construct(ConfigRepository $config, QueryFormatter $formatter)
 {
     $this->_defer = $config->get('dbprofiler.slow.defer', true);
     $this->_formatter = $formatter;
     $this->_filename = storage_path('/logs/query.' . date('d.m.y') . '.slow.log');
     $this->_time = $config->get('dbprofiler.slow.time', 500);
 }
开发者ID:shenaar,项目名称:dbprofiler,代码行数:7,代码来源:SlowQueryHandler.php


示例6: __construct

 /**
  * Generate a new instance of the EloquentRouteRepository instance
  *
  * @param  \Leitom\Role\Eloquent\Route 	  $route
  * @param  \Illuminate\Config\repository  $config
  * @return void
  */
 public function __construct(Route $routes, Repository $config)
 {
     $this->routes = $routes;
     $this->config = $config;
     // Set role sync
     $this->roleSync = $this->config->get('role::super.admin.sync');
 }
开发者ID:leitom,项目名称:role,代码行数:14,代码来源:EloquentRouteRepository.php


示例7: __construct

 /**
  * Create an instance of EloquentRoleRepository
  *
  * @param  \Leitom\Role\Eloquent\Role 	  $roles
  * @param  \Illuminate\Config\repository  $config
  * @return void
  */
 public function __construct(Role $roles, Repository $config)
 {
     $this->roles = $roles;
     $this->config = $config;
     // Set the super admin identifier
     $this->superAdminIdentifier = $this->config->get('role::super.admin.id');
 }
开发者ID:leitom,项目名称:role,代码行数:14,代码来源:EloquentRoleRepository.php


示例8: __construct

 /**
  * Create a new command instance.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @param  \Illuminate\Filesystem\Filesystem $files
  * @param  \Illuminate\Config\Repository $config
  * @return void
  */
 public function __construct(Router $router, Filesystem $files, Repository $config)
 {
     parent::__construct();
     $this->router = $router;
     $this->files = $files;
     $this->config = $config->get('routecache::config');
 }
开发者ID:hrenos,项目名称:spreadit,代码行数:15,代码来源:RoutecacheCommand.php


示例9: connect

 /**
  * ConnectorInterface实现 返回一个Queue(就是自己)
  * @param array $config
  * @return $this
  */
 public function connect(array $config)
 {
     $config = new Config($config);
     $this->queue_name = $config->get('queue', 'default');
     $this->client = new MQSClient($config, app('httpClient'), app('Illuminate\\Contracts\\Cache\\Repository'), app('log'));
     return $this;
 }
开发者ID:xjtuwangke,项目名称:laravel-bundles,代码行数:12,代码来源:MQSQueue.php


示例10: __construct

 /**
  * Create a new ImagePaths instance.
  *
  * @param Repository  $config
  * @param Request     $request
  * @param Application $application
  */
 public function __construct(Repository $config, Request $request, Application $application)
 {
     $this->config = $config;
     $this->request = $request;
     $this->application = $application;
     $this->paths = $config->get('streams::images.paths', []);
 }
开发者ID:jacksun101,项目名称:streams-platform,代码行数:14,代码来源:ImagePaths.php


示例11: extractProperties

 /**
  * @param Repository $config
  */
 protected function extractProperties(Repository $config)
 {
     if ($config->has(self::REPOSITORY_KEY)) {
         $data = $config->get(self::REPOSITORY_KEY);
         $this->properties = $data['properties'][$data['use']];
     }
 }
开发者ID:CodeYellowBV,项目名称:laravel-amqp,代码行数:10,代码来源:Context.php


示例12: let

 function let(Application $app, Repository $cfg)
 {
     $cfg->get(Argument::type('string'), Argument::any())->willReturn([]);
     $cfg->set(Argument::type('string'), Argument::any())->willReturn([]);
     $app->offsetGet('config')->willReturn($cfg);
     $this->beConstructedWith($app);
 }
开发者ID:AtlasCM,项目名称:Core,代码行数:7,代码来源:CoreServiceProviderSpec.php


示例13: get

 /**
  * Retrieves the location from the driver MaxMind and returns a location object.
  *
  * @param string $ip
  *
  * @return Location
  */
 public function get($ip)
 {
     $location = new Location();
     $settings = $this->config->get('location' . $this->instance->getConfigSeparator() . 'drivers.MaxMind.configuration');
     try {
         if ($settings['web_service']) {
             $maxmind = new Client($settings['user_id'], $settings['license_key']);
         } else {
             $path = app_path('database/maxmind/GeoLite2-City.mmdb');
             /*
              * Laravel 5 compatibility
              */
             if ($this->instance->getConfigSeparator() === '.') {
                 $path = base_path('database/maxmind/GeoLite2-City.mmdb');
             }
             $maxmind = new Reader($path);
         }
         $record = $maxmind->city($ip);
         $location->ip = $ip;
         $location->isoCode = $record->country->isoCode;
         $location->countryName = $record->country->name;
         $location->cityName = $record->city->name;
         $location->postalCode = $record->postal->code;
         $location->latitude = $record->location->latitude;
         $location->driver = get_class($this);
     } catch (\Exception $e) {
         $location->error = true;
     }
     return $location;
 }
开发者ID:ktardthong,项目名称:beerhit,代码行数:37,代码来源:MaxMind.php


示例14: it_should_allow_a_put

 public function it_should_allow_a_put(FakeCacheStore $cache, Config $config)
 {
     $config->get(Argument::any())->shouldBeCalled()->willReturn(10);
     $config->get('forrest.storage.store_forever')->shouldBeCalled()->willReturn(false);
     $cache->put(Argument::any(), Argument::any(), Argument::type('integer'))->shouldBeCalled();
     $this->put('test', 'value');
 }
开发者ID:omniphx,项目名称:forrest,代码行数:7,代码来源:LaravelCacheSpec.php


示例15: fire

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $database = $this->option('database') ?: $this->config->get('database.default');
     if (!is_dir(storage_path() . '/aperture')) {
         mkdir(storage_path() . '/aperture');
     }
     $selection = array();
     foreach (scandir(storage_path() . '/aperture', SCANDIR_SORT_DESCENDING) as $file) {
         if (strpos($file, $this->argument('table') . '_' . $database)) {
             $selection[] = $file;
         }
     }
     if (count($selection) === 0) {
         return $this->error('No snapshots found.');
     } elseif (count($selection) === 1) {
         $choice = 0;
     } else {
         foreach ($selection as $key => $file) {
             echo '[' . $key . '] Snapshot from ';
             $parts = explode('_', $file);
             echo date('H:i, M jS', $parts[0]) . "\n";
         }
         $choice = (int) $this->ask('Which snapshot do you want to restore from? ');
     }
     if ($this->snapshot->hasRows($database, $this->argument('table'), $this->option('chunk')) && !$this->confirm('This will clear any existing data in ' . $this->argument('table') . '. Continue? [y|N]', false)) {
         return $this->error('Restoration aborted');
     }
     $file = fopen(storage_path() . '/aperture/' . $selection[$choice], 'r');
     $this->snapshot->handle = $file;
     $this->snapshot->restore($database, $this->argument('table'), $this->option('chunk'));
     fclose($file);
     $this->info('Snapshot restored!');
 }
开发者ID:mcprohosting,项目名称:aperture,代码行数:38,代码来源:RestoreSnapshot.php


示例16: handle

 /**
  * Handle the event.
  */
 public function handle()
 {
     if (!$this->config->get('app.debug') && !$this->session->get(__CLASS__ . 'warned') && $this->request->path() == 'admin/dashboard' && $this->modules->get('anomaly.module.installer')) {
         $this->session->set(__CLASS__ . 'warned', true);
         $this->messages->error('streams::message.delete_installer');
     }
 }
开发者ID:huglester,项目名称:streams-platform,代码行数:10,代码来源:CheckIfInstallerExists.php


示例17: handle

 /**
  * Handle the event.
  */
 public function handle()
 {
     if ($locale = $this->preferences->get('streams::locale')) {
         $this->application->setLocale($locale);
         $this->config->set('app.locale', $locale);
     }
 }
开发者ID:AkibaTech,项目名称:preferences-module,代码行数:10,代码来源:SetLocale.php


示例18: anyUpload

 public function anyUpload(InterfaceFileStorage $userFileStorage, AmqpWrapper $amqpWrapper, Server $server, UploadEntity $uploadEntity)
 {
     /* @var \App\Components\UserFileStorage $userFileStorage */
     $responseVariables = ['uploadStatus' => false, 'storageErrors' => [], 'uploadEntities' => []];
     if ($this->request->isMethod('post') && $this->request->hasFile('file') && $this->request->file('file')->isValid()) {
         $tmpDir = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'tmp-user-files-to-storage' . DIRECTORY_SEPARATOR;
         $tmpFilePath = $tmpDir . $this->request->file('file')->getClientOriginalName();
         $this->request->file('file')->move($tmpDir, $this->request->file('file')->getClientOriginalName());
         $userFileStorage->setValidationRules($this->config->get('storage.userfile.validation'));
         $newStorageFile = $userFileStorage->addFile($tmpFilePath);
         if ($newStorageFile && !$userFileStorage->hasErrors()) {
             /* @var \SplFileInfo $newStorageFile */
             // AMQP send $newfile, to servers
             foreach ($server->all() as $server) {
                 if (count($server->configs) > 0) {
                     foreach ($server->configs as $config) {
                         // Send server and file info to upload queue task
                         $amqpWrapper->sendMessage($this->config->get('amqp.queues.uploader.upload'), json_encode(['file' => $newStorageFile->getRealPath(), 'url' => $server->scheme . '://' . $config->auth . '@' . $server->host . '/' . trim($config->path, '\\/')]));
                     }
                 } else {
                     // The server has no configuration
                     $amqpWrapper->sendMessage($this->config->get('amqp.queues.uploader.upload'), json_encode(['file' => $newStorageFile->getRealPath(), 'url' => $server->scheme . '://' . $server->host]));
                 }
             }
             $responseVariables['uploadStatus'] = true;
         } else {
             $responseVariables['storageErrors'] = $userFileStorage->getErrors();
         }
         if ($this->request->ajax()) {
             return $this->response->json($responseVariables);
         }
     }
     $responseVariables['uploadEntities'] = $uploadEntity->limit(self::UPLOAD_ENTITIES_LIMIT)->orderBy('created_at', 'DESC')->get();
     return $this->view->make('upload.index', $responseVariables);
 }
开发者ID:ysaroka,项目名称:uploader,代码行数:35,代码来源:UploadController.php


示例19: __construct

 public function __construct(Config $config, SessionStore $session)
 {
     if ($config->has('ttwitter::config')) {
         $this->tconfig = $config->get('ttwitter::config');
     } else {
         if ($config->get('ttwitter')) {
             $this->tconfig = $config->get('ttwitter');
         } else {
             throw new Exception('No config found');
         }
     }
     $this->debug = isset($this->tconfig['debug']) && $this->tconfig['debug'] ? true : false;
     $this->parent_config = [];
     $this->parent_config['consumer_key'] = $this->tconfig['CONSUMER_KEY'];
     $this->parent_config['consumer_secret'] = $this->tconfig['CONSUMER_SECRET'];
     $this->parent_config['token'] = $this->tconfig['ACCESS_TOKEN'];
     $this->parent_config['secret'] = $this->tconfig['ACCESS_TOKEN_SECRET'];
     if ($session->has('access_token')) {
         $access_token = $session->get('access_token');
         if (is_array($access_token) && isset($access_token['oauth_token']) && isset($access_token['oauth_token_secret']) && !empty($access_token['oauth_token']) && !empty($access_token['oauth_token_secret'])) {
             $this->parent_config['token'] = $access_token['oauth_token'];
             $this->parent_config['secret'] = $access_token['oauth_token_secret'];
         }
     }
     $this->parent_config['use_ssl'] = $this->tconfig['USE_SSL'];
     $this->parent_config['user_agent'] = 'LTTW ' . parent::VERSION;
     $config = array_merge($this->parent_config, $this->tconfig);
     parent::__construct($this->parent_config);
 }
开发者ID:thujohn,项目名称:twitter,代码行数:29,代码来源:Twitter.php


示例20: make

 /**
  * Creates an Response object and executes the magic of the LAPI response layer.
  *
  * @param \Illuminate\Support\Contracts\ArrayableInterface|array $data
  * @param int   $code
  * @param \Illuminate\Support\Contracts\ArrayableInterface|array $headers
  *
  * @return \Illuminate\Http\Response
  */
 public function make($data, $code = 200, array $headers = array())
 {
     $httpHeaderConfig = $this->config->get('lapi::http_header_parameters');
     $headers = array_merge(array($httpHeaderConfig['http_header_contenttype'] => $this->getResponseContentType()), $headers);
     $data = $this->formatData($data);
     return new Response($data, $code, $headers);
 }
开发者ID:kyjan,项目名称:lapi,代码行数:16,代码来源:LapiResponse.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Console\Application类代码示例发布时间:2022-05-23
下一篇:
PHP Cache\Repository类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap