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


PHP array_only函数代码示例

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


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

示例1: getConfig

 /**
  * Get the configuration data.
  *
  * @param string[] $config
  *
  * @throws \InvalidArgumentException
  *
  * @return string
  */
 protected function getConfig(array $config)
 {
     if (!array_key_exists('token', $config)) {
         throw new \InvalidArgumentException('The GitLab client requires configuration.');
     }
     return array_only($config, ['token', 'base_url', 'method', 'sudo']);
 }
开发者ID:rinodung,项目名称:gitlab,代码行数:16,代码来源:GitLabFactory.php

示例2: getConfig

 /**
  * Get the configuration data.
  *
  * @param string[] $config
  *
  * @throws \InvalidArgumentException
  *
  * @return array
  */
 protected function getConfig(array $config)
 {
     if (!array_key_exists('client_id', $config)) {
         throw new InvalidArgumentException('Missing configuration key [client_id].');
     }
     return array_only($config, ['client_id', 'client_secret', 'callback_url']);
 }
开发者ID:EhteshamMehmood,项目名称:instagram,代码行数:16,代码来源:InstagramFactory.php

示例3: getConfig

 /**
  * Get the configuration.
  *
  * @param string[] $config
  *
  * @throws \InvalidArgumentException
  *
  * @return string[]
  */
 protected function getConfig(array $config)
 {
     if (!array_key_exists('token', $config) || !array_key_exists('email', $config)) {
         throw new \InvalidArgumentException('The cloudflare client requires configuration.');
     }
     return array_only($config, ['token', 'email']);
 }
开发者ID:hoopyfrood,项目名称:Laravel-CloudFlare-API,代码行数:16,代码来源:ClientFactory.php

示例4: transform

 /**
  * Transform row data by columns definition.
  *
  * @param array $row
  * @param mixed $columns
  * @param string $type
  * @return array
  */
 public function transform(array $row, $columns, $type = 'printable')
 {
     if ($columns instanceof Collection) {
         return $this->buildColumnByCollection($row, $columns, $type);
     }
     return array_only($row, $columns);
 }
开发者ID:rafaelqm,项目名称:laravel-datatables,代码行数:15,代码来源:DataTransformer.php

示例5: testStore

 public function testStore()
 {
     $project = Factory::build('Project', ['name' => 'Foo']);
     $input = array_only($project->getAttributes(), $project->getFillable());
     $this->action('POST', 'Admin\\ProjectsController@store', $input);
     $this->assertRedirectedToRoute('admin.projects.show', 'foo');
 }
开发者ID:riehlemt,项目名称:neontsunami,代码行数:7,代码来源:AdminProjectsControllerTest.php

示例6: __construct

 /**
  * Creates a new Lavary\Menu\MenuItem instance.
  *
  * @param  string  $title
  * @param  string  $url
  * @param  array  $attributes
  * @param  int  $parent
  * @param  \Lavary\Menu\Menu  $builder
  * @return void
  */
 public function __construct($builder, $id, $title, $options)
 {
     $this->builder = $builder;
     $this->id = $id;
     $this->title = $title;
     $this->nickname = camel_case($title);
     $this->attributes = $this->builder->extractAttributes($options);
     $this->parent = is_array($options) && isset($options['parent']) ? $options['parent'] : null;
     // Storing path options with each link instance.
     if (!is_array($options)) {
         $path = array('url' => $options);
     } elseif (isset($options['raw']) && $options['raw'] == true) {
         $path = null;
     } else {
         $path = array_only($options, array('url', 'route', 'action', 'secure'));
     }
     if (!is_null($path)) {
         $path['prefix'] = $this->builder->getLastGroupPrefix();
     }
     $this->link = $path ? new Link($path) : null;
     // Activate the item if items's url matches the request uri
     if (true === $this->builder->conf('auto_activate')) {
         $this->checkActivationStatus();
     }
 }
开发者ID:R3alflash,项目名称:BFAdminCP,代码行数:35,代码来源:Item.php

示例7: getConfig

 /**
  * Get the configuration data.
  *
  * @param string[] $config
  *
  * @throws \InvalidArgumentException
  *
  * @return string[]
  */
 protected function getConfig(array $config)
 {
     if (!array_key_exists('app_key', $config) || !array_key_exists('app_secret', $config)) {
         throw new \InvalidArgumentException('The top client requires api keys.');
     }
     return array_only($config, ['app_key', 'app_secret', 'format']);
 }
开发者ID:remxcode,项目名称:taobao-top-client,代码行数:16,代码来源:TopClientFactory.php

示例8: verifyAndCreate

 public function verifyAndCreate($data)
 {
     $compcat = $this->compcat->verifyAndCreate(array_only($data, ['supno', 'catname']));
     $attr = ['code' => 'new', 'descriptor' => $data['comp'], 'compcatid' => $compcat->id, 'cost' => $data['ucost'], 'uom' => $data['unit']];
     //return $this->firstOrNew($attr, ['descriptor']);
     return $this->findOrNew($attr, ['descriptor']);
 }
开发者ID:jrsalunga,项目名称:gi-cashier,代码行数:7,代码来源:ComponentRepository.php

示例9: register

 public static function register(array $input) : User
 {
     $defaults = ['role' => UserRole::MEMBER(), 'status' => UserStatus::ACTIVE()];
     $user = static::create($defaults + array_only($input, ['first_name', 'last_name', 'address', 'postal', 'city', 'country', 'telephone', 'email', 'password']));
     event(new UserRegistered($user));
     return $user;
 }
开发者ID:spatie-custom,项目名称:blender,代码行数:7,代码来源:User.php

示例10: getConfig

 /**
  * Get the configuration.
  *
  * @param string[] $config
  *
  * @return string[]
  */
 protected function getConfig(array $config)
 {
     if (!array_key_exists('container', $config)) {
         throw new InvalidArgumentException('The azure connector requires container configuration.');
     }
     return array_only($config, ['container']);
 }
开发者ID:summer11123,项目名称:Laravel-Flysystem,代码行数:14,代码来源:AzureConnector.php

示例11: compose

 /**
  * Bind data to the view.
  *
  * @param View $view
  *
  * @return void
  */
 public function compose(View $view)
 {
     $data = $view->getData();
     if (Auth::check()) {
         $notifications = Auth::user()->notifications()->with('user')->orderBy('created_at', 'desc')->take(15)->get();
         $view->with('notifications', $notifications);
         $unreadCount = Auth::user()->notifications()->wherePivot('read', false)->count();
         $view->with('newNotificationsCount', $unreadCount);
     }
     // Get object from which we can extract name to use as page title
     $currentGroup = head(array_only($data, ['group', 'folder', 'fakeGroup']));
     $view->with('currentGroup', $currentGroup);
     if (isset($currentGroup) && isset($currentGroup->name)) {
         $pageTitle = $currentGroup->name;
         // Homepage title shall always be Strimoid.pl
         if ($currentGroup->urlname == 'all' && !Setting::get('homepage_subscribed', false)) {
             $pageTitle = 'Strimoid';
         }
         if ($currentGroup->urlname == 'subscribed' && Setting::get('homepage_subscribed', false)) {
             $pageTitle = 'Strimoid';
         }
     } else {
         $pageTitle = 'Strimoid';
     }
     $view->with('pageTitle', $pageTitle);
     // Needed by top bar with groups
     $popularGroups = Cache::remember('popularGroups', 60, function () {
         return Group::orderBy('subscribers_count', 'desc', true)->take(30)->get(['id', 'name', 'urlname']);
     });
     $view->with('popularGroups', $popularGroups);
 }
开发者ID:vegax87,项目名称:Strimoid,代码行数:38,代码来源:MasterComposer.php

示例12: only

 /**
  * Get a subset of the items from the input data.
  *
  * @param array $keys
  * 
  * @return array
  */
 public function only($keys)
 {
     $keys = is_array($keys) ? $keys : func_get_args();
     $results = $this->input();
     $results = is_array($results) ? $results : array();
     return array_only($results, $keys) + array_fill_keys($keys, null);
 }
开发者ID:naturalweb,项目名称:nwsilex,代码行数:14,代码来源:Request.php

示例13: getConfig

 /**
  * Get the configuration data.
  *
  * @param string[] $config
  *
  * @throws \InvalidArgumentException
  *
  * @return array
  */
 protected function getConfig(array $config)
 {
     if (!array_key_exists('consumer_key', $config)) {
         throw new \InvalidArgumentException('The Twitter API client requires configuration.');
     }
     return array_only($config, ['consumer_key', 'consumer_secret', 'access_token', 'access_token_secret']);
 }
开发者ID:heosua91,项目名称:twitteroauthq,代码行数:16,代码来源:TwitterQFactory.php

示例14: testStore

 public function testStore()
 {
     $user = Factory::build('User');
     $input = array_only($user->getAttributes(), $user->getFillable());
     $this->action('POST', 'Admin\\UsersController@store', $input);
     $this->assertRedirectedToRoute('admin.users.show', User::first()->id);
 }
开发者ID:riehlemt,项目名称:neontsunami,代码行数:7,代码来源:AdminUsersControllerTest.php

示例15: setMetaDataOnCollection

 private function setMetaDataOnCollection()
 {
     $this->meta = [];
     if (isset($this->originalParsedData['ast'])) {
         $this->meta = array_only($this->originalParsedData['ast'], ['metadata', 'name', 'description']);
     }
 }
开发者ID:etiennemarais,项目名称:outline,代码行数:7,代码来源:ResourceCollection.php


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