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

PHP object_get函数代码示例

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

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



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

示例1: composer

 /**
  * Format:
  *
  * n: name
  * v: version
  * l: location
  * p: parent
  */
 private function composer()
 {
     $path = app_path() . '\\..\\composer.lock';
     if (!file_exists($path)) {
         return;
     }
     // Parse composer.lock
     $content = @file_get_contents($path);
     $list = @json_decode($content);
     if (!$list) {
         return;
     }
     $list = object_get($list, 'packages', []);
     // Determe the parent of the composer modules, most likely this will
     // resolve to laravel/laravel.
     $parent = '';
     $parent_path = realpath(app_path() . '\\..\\composer.json');
     if (file_exists($parent_path)) {
         $parent_object = @json_decode(@file_get_contents($parent_path));
         if ($parent_object) {
             $parent = object_get($parent_object, 'name', '');
         }
     }
     // Store base package, which is laravel/laravel.
     $packages = [['n' => $parent, 'l' => $parent_path, 'v' => '']];
     // Add each composer module to the packages list,
     // but respect the parent relation.
     foreach ($list as $package) {
         $packages[] = ['n' => $package->name, 'v' => $package->version, 'p' => $parent, 'l' => $parent_path];
     }
     return $packages;
 }
开发者ID:patrolserver,项目名称:patrol-laravel,代码行数:40,代码来源:CollectSoftware.php


示例2: __invoke

 /**
  * На самом деле тут у меня фантация играет по полной, поймать мошеника это круто
  * можно было реализовать из hidden risk некую битовую маску и по ней уже обсчитывать мошеников
  * @param Collection $leaders
  * @param []Collection $prevLeaders
  * @return []Collection
  */
 public function __invoke(Collection $leaders, array $prevLeaders)
 {
     $leaders->each(function ($value) use($prevLeaders) {
         $id = object_get($value, 'id', null);
         $score = object_get($value, 'score', null);
         // Идем по списку лидеров
         foreach ($prevLeaders as $leaders) {
             $leaders->each(function ($leader) use($id, $score) {
                 // Если личдер найден
                 if ($leader->id === $id) {
                     // И он есть в  hidden risk
                     if (isset($this->hidRisk[$id])) {
                         // Удаляем его
                         unset($this->hidRisk[$id]);
                     }
                     // Если сейчас у него очков больше чем в прошлый раз
                     if ($leader->score < $score / static::RISK_GROWTH_SCOPE) {
                         $this->result[$id] = $leader;
                     } else {
                         $this->hidRisk[$id] = $leader;
                     }
                 }
             });
         }
         if (isset($this->hidRisk[$id])) {
             $this->result[$id] = $value;
         }
     });
     return $this->result;
 }
开发者ID:ftob,项目名称:php-leaderboard-bundle,代码行数:37,代码来源:GetAbnormalLeaders.php


示例3: responseHandler

 /**
  * @param ResponseInterface $responseInterface
  * @return mixed
  * @throws HttpResponseException
  * @throws \HttpInvalidParamException
  */
 protected function responseHandler(ResponseInterface $responseInterface)
 {
     // Проверяем код http, если не 200 или 201, то все нормально
     if ($this->checkHttpResponse($responseInterface)) {
         // Получаем тело запроса
         $body = json_decode($responseInterface->getBody());
         // Проверяем на json ошибки
         if (json_last_error() !== JSON_ERROR_NONE) {
             throw new HttpResponseException('Json invalid - ' . json_last_error_msg());
         }
         // Получем стус в ответе
         if ($status = object_get($body, 'status', null)) {
             if ($status === 'error') {
                 throw new HttpResponseException(object_get($body, 'message', null), object_get($body, 'code', 500));
             }
         }
         $parameter = 'leaderboard';
         if ($leaders = object_get($body, $parameter, null)) {
             return $leaders;
         } else {
             throw new \HttpInvalidParamException('Parameter - ' . $parameter);
         }
     }
     throw new HttpResponseException($responseInterface->getBody(), $responseInterface->getStatusCode());
 }
开发者ID:ftob,项目名称:php-leaderboard-bundle,代码行数:31,代码来源:LeaderRepository.php


示例4: get_parent_behavior

 public function get_parent_behavior()
 {
     if (!$this->parent_behavior && $this->parent_obj) {
         $this->parent_behavior = object_get($this->parent_obj, 'acts_as_' . self::$name);
     }
     return $this->parent_behavior;
 }
开发者ID:nemoDreamer,项目名称:endo,代码行数:7,代码来源:behavior.sortable.php


示例5: __get

 public function __get($key)
 {
     if ($this->isEloquent()) {
         return $this->data->__get($key);
     }
     return object_get($this->data, $key);
 }
开发者ID:portonefive,项目名称:tabulator,代码行数:7,代码来源:Row.php


示例6: visitor

 /**
  * @param null                 $key
  * @param string               $guard
  *
  * @var \Illuminate\Auth\Guard $auth
  * @return \PortOneFive\Essentials\Users\User|false
  */
 function visitor($key = null, $guard = null)
 {
     $auth = app('auth');
     if (!$auth->guard($guard)->check()) {
         return false;
     }
     return $key == null ? $auth->guard()->user() : object_get($auth->guard()->user(), $key);
 }
开发者ID:portonefive,项目名称:essentials,代码行数:15,代码来源:helpers.php


示例7: getRawValueAttribute

 /**
  * Resolve value by uses as attribute as raw.
  *
  * @param  \SimpleXMLElement  $content
  * @param  string  $use
  * @param  mixed  $default
  *
  * @return mixed
  */
 protected function getRawValueAttribute(SimpleXMLElement $content, $use, $default = null)
 {
     list($value, $attribute) = explode('::', $use, 2);
     if (is_null($parent = object_get($content, $value))) {
         return $default;
     }
     $attributes = $parent->attributes();
     return Arr::get($attributes, $attribute, $default);
 }
开发者ID:andrehol,项目名称:parser-1,代码行数:18,代码来源:Document.php


示例8: ping

 /**
  * Ping our cachet installation.
  *
  * @return bool True, if we get a response.
  * @throws CachetException If the status code returned wasn't what we expected.
  */
 public function ping()
 {
     $res = $this->client->get('ping');
     if ($res->getStatusCode() !== 200) {
         throw new CachetException('Invalid response code!');
     }
     $json = $this->json($res);
     return object_get($json, 'data', '') == 'Pong!';
 }
开发者ID:nikkiii,项目名称:laravel-cachet,代码行数:15,代码来源:CachetConnection.php


示例9: get

 /**
  * @param      $key
  * @param null $default
  *
  * @return mixed
  */
 public function get($key, $default = null)
 {
     // Check for a Presenter Method first
     if (method_exists($this, $key)) {
         return $this->{$key}($default);
     }
     // Ok, now try to access the entities attribute
     return object_get($this->entity, $key, $default);
 }
开发者ID:wegnermedia,项目名称:melon,代码行数:15,代码来源:Presenter.php


示例10: smarty_function_admin_relations

function smarty_function_admin_relations($params = array(), &$smarty)
{
    require_once $smarty->_get_plugin_filepath('function', 'admin_link');
    $relations = array('parent' => 'edit ', 'children' => 'add/edit ');
    $object = null;
    $wrap = false;
    $links = array();
    $output = '';
    foreach ($params as $_key => $_value) {
        ${$_key} = $_value;
    }
    if (empty($object)) {
        $smarty->trigger_error("admin_relations: missing 'object' parameter", E_USER_NOTICE);
        return;
    }
    // cycle relations
    foreach ($relations as $relation_name => $relation_prefix) {
        // cycle object's 'get_' variables
        $i = 0;
        foreach ($object->{'get_' . $relation_name} as $model_name => $model_params) {
            AppModel::RelationNameParams($model_name, $model_params);
            // get controller
            $controller = Globe::Init($model_name, 'controller');
            // TODO replace by ::singleton, find others
            // action & text
            switch ($relation_name) {
                case 'parent':
                    $action = ($model = object_get($object, $model_name)) ? 'edit' . DS . $model->id : null;
                    $text = ucwords(AppInflector::titleize($model_name));
                    $image = 'page_white_edit';
                    break;
                case 'children':
                    $prefix = $i == 0 ? '' : AppInflector::tableize(get_class($object)) . '_id=';
                    $action = '?filter=' . $prefix . $object->id;
                    $text = ucwords(AppInflector::pluralize(AppInflector::titleize($model_name)));
                    $image = 'magnifier';
                    break;
                default:
                    $action = '';
                    $text = AppInflector::titleize($model_name);
                    $image = 'magnifier';
                    break;
            }
            // build link
            $links[] = smarty_function_admin_link(array('controller' => AppInflector::fileize(get_class($controller), 'controller'), 'action' => $action, 'text' => "<span>{$relation_prefix}{$text}</span>" . ' <img src="/assets/images/admin/silk/' . $image . '.png" width="16" height="16">'), $smarty);
            $i++;
        }
    }
    foreach ($links as $link) {
        $output .= "<li>{$link}</li>\n";
    }
    if ($wrap) {
        $output = '<ul class="relations">' . $output . '</ul>';
    }
    return $output;
}
开发者ID:nemoDreamer,项目名称:endo,代码行数:56,代码来源:function.admin_relations.php


示例11: getTitleFields

 /**
  * Because a title slug can be created from multiple sources (such as an article title, a category title.etc.),
  * this allows us to search out those fields from related objects and return the combined values.
  *
  * @param array $fields
  * @return array
  */
 public function getTitleFields(array $fields)
 {
     $fields = array_map(function ($field) {
         if (str_contains($field, '.')) {
             return object_get($this, $field);
             // this acts as a delimiter, which we can replace with /
         } else {
             return $this->{$field};
         }
     }, $fields);
     return $fields;
 }
开发者ID:bronxct1,项目名称:eloquence,代码行数:19,代码来源:Sluggable.php


示例12: array_extract

function array_extract(&$array, $keys, $unset = false)
{
    if (is_string($keys)) {
        $keys = array($keys);
    }
    $output = array();
    foreach ($keys as $key) {
        $output[$key] = is_array($array) ? array_get($array, $key) : object_get($array, $key);
        if ($unset) {
            unset($array[$key]);
        }
    }
    return $output;
}
开发者ID:nemoDreamer,项目名称:endo,代码行数:14,代码来源:endo_bootstrap.php


示例13: replacePlaceholders

 /**
  * Replaces placeholders in title
  * Matches all {{rule}} placeholders, escaped @{{ blocks (w/ optional }})
  * Technically also matches "{{something"
  *
  * @param $title        string Title with placeholders
  * @param $replacedWith object Things to replace with
  *
  * @return mixed
  */
 protected function replacePlaceholders($title, $replacedWith)
 {
     return preg_replace_callback('/(\\@)?\\{\\{([\\w\\d\\.]+)(?:\\}\\})/', function ($matches) use($replacedWith) {
         if ($matches[1] == '@') {
             // Escape
             return substr($matches[0], 1);
         }
         // Find the requested thing
         $value = object_get($replacedWith, $matches[2]);
         if ($value) {
             return $value;
         }
         // No idea
         return $matches[0];
     }, $title);
 }
开发者ID:janusnic,项目名称:podcast-plugin,代码行数:26,代码来源:TitlePlaceholdersTrait.php


示例14: pluck

 public static function pluck($array, $value, $key = null)
 {
     $results = [];
     foreach ($array as $item) {
         $itemValue = is_object($item) ? object_get($item, $value) : array_get($item, $value);
         // If the key is "null", we will just append the value to the array and keep
         // looping. Otherwise we will key the array using the value of the key we
         // received from the developer. Then we'll return the final array form.
         if (is_null($key)) {
             $results[] = $itemValue;
         } else {
             $itemKey = is_object($item) ? object_get($item, $key) : array_get($item, $key);
             $results[$itemKey] = $itemValue;
         }
     }
     return $results;
 }
开发者ID:exolnet,项目名称:laravel-module,代码行数:17,代码来源:Arr.php


示例15: __invoke

 /**
  * @param Collection $leaders
  * @param []Collection $prevLeaders Массив ранее собраных списков
  * @return array
  */
 public function __invoke(Collection $leaders, array $prevLeaders)
 {
     $leaders->each(function ($value) use($prevLeaders) {
         $id = object_get($value, 'id', null);
         $place = object_get($value, 'place', null);
         $this->result[$id] = 0;
         foreach ($prevLeaders as $leaders) {
             $leaders->each(function ($value) use($id, $place) {
                 if ($value->id === $id) {
                     if ($value->place !== $place) {
                         $this->result[$id]++;
                     }
                 }
             });
         }
     });
     return $this->result;
 }
开发者ID:ftob,项目名称:php-leaderboard-bundle,代码行数:23,代码来源:ChangesInTheNumberOfPositions.php


示例16: validate

 /**
  * {@inheritdoc}
  */
 public function validate($item)
 {
     if (!isset($item)) {
         $item = new stdClass();
     }
     if (!$this->test($item)) {
         return false;
     }
     foreach ($this->properties as $name => $validator) {
         if (!is_object($item) || object_get($item, $name) === null) {
             return false;
         }
         if (!$validator->validate(object_get($item, $name))) {
             return false;
         }
     }
     return true;
 }
开发者ID:wandu,项目名称:framework,代码行数:21,代码来源:ObjectValidator.php


示例17: redirectedFromProvider

 private function redirectedFromProvider($provider, $listener)
 {
     try {
         $userData = $this->getSocialUser($provider);
         $accessConfig = Config::get('socialite-login.limit-access', []);
         foreach ($accessConfig as $property => $regex) {
             $value = object_get($userData, $property);
             if (is_string($value) and preg_match($regex, $value)) {
                 continue;
             }
             throw new Exception('Access denied.');
         }
     } catch (Exception $e) {
         return $listener->loginFailure($provider, $e);
     }
     $user = $this->users->findOrCreateUser($provider, $userData);
     $remember = true;
     $this->auth->login($user, $remember);
     return $listener->loginSuccess($user);
 }
开发者ID:brothersco,项目名称:laravel-socialite-login,代码行数:20,代码来源:AuthenticateUser.php


示例18: getColumnDisplay

 /**
  * @param $columnId
  * @param $row
  *
  * @return mixed
  */
 public function getColumnDisplay($columnId, Model $row)
 {
     if ($this->hasColumnDisplayMutator($columnId)) {
         return $this->mutateColumn($columnId, $row);
     }
     return object_get($row, $columnId);
 }
开发者ID:portonefive,项目名称:tabulator,代码行数:13,代码来源:Tabulator.php


示例19: data_get

 /**
  * Get an item from an array or object using "dot" notation.
  *
  * @param  mixed   $target
  * @param  string  $key
  * @param  mixed   $default
  * @return mixed
  *
  * @throws \InvalidArgumentException
  */
 function data_get($target, $key, $default = null)
 {
     if (is_array($target)) {
         return array_get($target, $key, $default);
     } elseif (is_object($target)) {
         return object_get($target, $key, $default);
     } else {
         throw new \InvalidArgumentException("Array or object must be passed to data_get.");
     }
 }
开发者ID:ningcaichen,项目名称:laravel-4.1-quick-start-cn,代码行数:20,代码来源:helpers.php


示例20: filterPanel

 /**
  * Filter by Panels, if '*' is provided then
  * check this panel exists within the defined
  * panels. Else look for specific panels.
  *
  * @param $attrs
  * @param $filterWith
  * @return bool
  */
 public function filterPanel($attrs, $filterWith)
 {
     $panels = $this->app['panel']->getPanels();
     $page = $this->app['http']->get('page', false);
     if (!$page && function_exists('get_current_screen')) {
         $page = object_get(get_current_screen(), 'id', $page);
     }
     foreach ($filterWith as $filter) {
         $filtered = array_filter($panels, function ($panel) use($page, $filter) {
             return $page === $panel['slug'] && str_is($filter, $panel['slug']);
         });
         if (count($filtered) > 0) {
             return true;
         }
     }
     return false;
 }
开发者ID:bigbitecreative,项目名称:wordpress-git-content,代码行数:26,代码来源:Enqueue.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP object_input_date_tag函数代码示例发布时间:2022-05-15
下一篇:
PHP object_factory函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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