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

PHP Builder类代码示例

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

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



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

示例1: scopeNewestGrouped

 /**
  *
  *
  * @param Builder $query
  * @return Builder
  */
 public function scopeNewestGrouped($query)
 {
     // @todo: find a better way of doing this
     $newest = \DB::select("select max(id) as id from mail_statistics group by service_message_id");
     $newest = collect($newest)->pluck('id');
     return $query->whereIn('id', $newest->toArray())->newest();
 }
开发者ID:bitsoflove,项目名称:mailstats,代码行数:13,代码来源:MailStatistic.php


示例2: getChartWithNumberOfValuesDifferents

 /**
  * @test
  */
 public function getChartWithNumberOfValuesDifferents()
 {
     $mapsWithGroupedValues = $this->goupedListWithDifferentYears();
     $years = array(1989, 1992);
     $xml = str_replace('<?xml version="1.0"?>', '', $this->chartBuilder->build($mapsWithGroupedValues, $years));
     $this->assertEquals($this->xml2(), trim($xml));
 }
开发者ID:raigons,项目名称:bureauinteligencia,代码行数:10,代码来源:ChartBuilderTest.php


示例3: scopeSort

 /**
  * Sort
  *
  * @param \Illuminate\Database\Eloquent\Builder $builder
  * @param string|null                           $sort    Optional sort string
  *
  * @return \Illuminate\Database\Query\Builder
  */
 public function scopeSort(Builder $builder, $sort = null)
 {
     if ((is_null($sort) || empty($sort)) && Input::has($this->getSortParameterName())) {
         $sort = Input::get($this->getSortParameterName());
     }
     if (!is_null($sort)) {
         $sort = explode(',', $sort);
         foreach ($sort as $field) {
             $field = trim($field);
             $order = 'asc';
             switch ($field[0]) {
                 case '-':
                     $field = substr($field, 1);
                     $order = 'desc';
                     break;
                 case '+':
                     $field = substr($field, 1);
                     break;
             }
             $field = trim($field);
             if (in_array($field, $this->getSortable())) {
                 $builder->orderBy($field, $order);
             }
         }
     }
 }
开发者ID:classid,项目名称:Database,代码行数:34,代码来源:Sortable.php


示例4: calcola_prenotazione_online

function calcola_prenotazione_online($user)
{
    $builder = new Builder();
    $dispatcher = $builder->build('calcola-online', null, $user, $_REQUEST['rc_sito_parking']);
    $dispatcher->executeAjax($_REQUEST);
    $ar_errori = $dispatcher->get_errori();
    if (!empty($ar_errori)) {
        $ar_response['errori'] = $ar_errori;
        $ar_response['totale_giorni'] = 0;
        $ar_response['totale_costo'] = 0;
        return json_encode($ar_response);
    }
    $ar_so_selected = null;
    if ($_REQUEST['so']) {
        $ar_so_selected = json_decode($_REQUEST['so']);
    }
    $ar_data = array('sito_parking' => $_REQUEST['rc_sito_parking'], 'dt_p_iniziale' => $_REQUEST['rc_dt_checkin_checkout_in'], 'ora_p_iniziale' => $_REQUEST['rc_tm_checkin_checkout_in'], 'dt_p_finale' => $_REQUEST['rc_dt_checkin_checkout_out'], 'ora_p_finale' => $_REQUEST['rc_tm_checkin_checkout_out'], 'tipo_parcheggio' => $_REQUEST['rc_tipo_parcheggio'], 'tipo_cliente' => null, 'tipo_automezzo' => $_REQUEST['rc_tp_veicolo_cliente'], 'valore_sct_mag' => null, 'tipo_sct_mag' => null, 'p_online' => true, 'tp_sct_mag_v_p' => null, 'so' => $ar_so_selected, 'sop' => null);
    $calcoli = new CalcolaCostiStrategy();
    $calcoli->set_data($ar_data);
    $calcoli->calcola();
    $ar_response['totale_giorni'] = $calcoli->get_totale_giorni();
    $valore_sconto = floatval($calcoli->get_valore_sct_p_online());
    $ar_response['totale_costo'] = $calcoli->get_totale_costo() + $valore_sconto;
    if ($valore_sconto != 0) {
        $ar_response['totale_scontato'] = $ar_response['totale_costo'] - $valore_sconto;
        $ar_response['totale_risparmio'] = $ar_response['totale_costo'] - $ar_response['totale_scontato'];
    }
    return json_encode($ar_response);
}
开发者ID:remo-candeli,项目名称:remoc-test,代码行数:29,代码来源:calcola_costi.php


示例5: scopeSearch

 /**
  * Search scope
  *
  * @param Builder $query
  * @param string $keywords
  * @return Builder
  */
 public function scopeSearch($query, $keywords)
 {
     //Return search results
     return $query->where(function ($query) use($keywords) {
         $query->where('first_name', 'like', $keywords . '%')->orWhere('last_name', 'like', $keywords . '%')->orWhereRaw('CONCAT(first_name, \' \',last_name) like \'' . $keywords . '%\'');
     });
 }
开发者ID:AshniSukhoo,项目名称:UOM_connect,代码行数:14,代码来源:User.php


示例6: testToAppShouldHandleEmptyStack

 function testToAppShouldHandleEmptyStack()
 {
     $b = new Builder();
     $a = $b->toApp();
     $this->assertInstanceOf('Middleware\\Runner', $a);
     $env = new \StdClass();
     $a->call($env);
 }
开发者ID:hypercharge,项目名称:php-middleware,代码行数:8,代码来源:BuilderTest.php


示例7: forFeature

 /**
  * Create a new Builder instance.
  *
  * @param string $slug
  *
  * @return \Zumba\Swivel\Builder
  *
  * @see \Zumba\Swivel\ManagerInterface
  */
 public function forFeature($slug)
 {
     $this->logger->debug('Swivel - Generating builder for feature "' . $slug . '"');
     $builder = new Builder($slug, $this->bucket);
     $builder->setLogger($this->logger);
     $this->metrics && $builder->setMetrics($this->metrics);
     return $builder;
 }
开发者ID:zumba,项目名称:swivel,代码行数:17,代码来源:Manager.php


示例8: scopeFriendsOf

 /**
  * Query scope that returns the friendships of a user
  * 
  * @param  Builder  $query  The query builder object
  * @param  int      $userId The ID of the user
  * @param  boolean      $confirmed   Only show confirmed friendships? Default = true
  * @return Builder
  */
 public function scopeFriendsOf($query, $userId, $confirmed = true)
 {
     if ($confirmed) {
         $query->whereConfirmed(1);
     }
     return $query->where(function ($query) use($userId) {
         $query->whereSenderId($userId)->orWhere('receiver_id', $userId);
     });
 }
开发者ID:chirilo,项目名称:Contentify,代码行数:17,代码来源:Friendship.php


示例9: scopePagedJson

 /**
  * Format a collection of items for our Vue viewmodel.
  * @param  Builder $query
  * @param  int     $perPage Number of items to show per page
  * @return array   Ready for JSON array of item data
  */
 public function scopePagedJson($query, $perPage)
 {
     $items = $query->orderby('pub_date', 'desc')->paginate($perPage);
     $json_data = $items->toArray();
     unset($json_data['data']);
     foreach ($items as $item) {
         $json_data['items'][] = ['date' => $item->pub_date->diffForHumans(), 'source' => $item->source(), 'title' => $item->title, 'categories' => $item->categories, 'link' => $item->link, 'id' => $item->id, 'viewed' => $item->viewed];
     }
     return $json_data;
 }
开发者ID:kevindoole,项目名称:laravel-feed-reader,代码行数:16,代码来源:RssItem.php


示例10: testGetPageLayoutsConfig

 /**
  * Test get page layouts config
  *
  * @return void
  */
 public function testGetPageLayoutsConfig()
 {
     $files1 = ['content layouts_1.xml', 'content layouts_2.xml'];
     $files2 = ['content layouts_3.xml', 'content layouts_4.xml'];
     $theme1 = $this->getMockBuilder('Magento\\Theme\\Model\\Theme\\Data')->disableOriginalConstructor()->getMock();
     $theme2 = $this->getMockBuilder('Magento\\Theme\\Model\\Theme\\Data')->disableOriginalConstructor()->getMock();
     $this->themeCollection->expects($this->any())->method('loadRegisteredThemes')->willReturn([$theme1, $theme2]);
     $this->fileCollector->expects($this->exactly(2))->method('getFilesContent')->willReturnMap([[$theme1, 'layouts.xml', $files1], [$theme2, 'layouts.xml', $files2]]);
     $config = $this->getMockBuilder('Magento\\Framework\\View\\PageLayout\\Config')->disableOriginalConstructor()->getMock();
     $this->configFactory->expects($this->once())->method('create')->with(['configFiles' => array_merge($files1, $files2)])->willReturn($config);
     $this->assertSame($config, $this->builder->getPageLayoutsConfig());
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:17,代码来源:BuilderTest.php


示例11: scopeFindByUuid

 /**
  * Method returns models geted by uuid
  * @param  Builder $query
  * @param  array|tring $uuid  uuid or list of uuids
  * @return Collection|Model Single model or collection of models
  */
 public function scopeFindByUuid($query, $uuid)
 {
     if (!is_array($uuid)) {
         if (!Uuid::isValid($uuid)) {
             throw (new ModelNotFoundException())->setModel(get_class($this));
         }
         return $query->where('uuid', $uuid)->first();
     } elseif (is_array($uuid)) {
         array_map(function ($element) {
             if (!Uuid::isValid($element)) {
                 throw (new ModelNotFoundException())->setModel(get_class($this));
             }
         }, $uuid);
         return $query->whereIn('uuid', $uuid)->get();
     }
 }
开发者ID:beautycoding,项目名称:modelutils,代码行数:22,代码来源:UuidModel.php


示例12: article_edit

 public function article_edit($opt = array())
 {
     Builder::add_plugin('ckeditor');
     $articles_model = $this->model('articles_model');
     $contents = array();
     if (empty($opt)) {
         $contents = $articles_model->get_empty();
         $contents['article'] = '';
     } else {
         $contents = $articles_model->get_article(reset($opt), next($opt));
         $contents['article'] = '';
         $path = APPPATH . "views/articles/{$contents['lang']}/{$contents['type']}/{$contents['id']}.php";
         if (file_exists($path)) {
             $contents['article'] = file_get_contents($path);
         }
     }
     if (!empty($contents['id'])) {
         $contents['image_list'] = array();
         $dir = "./modules/images/articles/{$contents['id']}/";
         if (!file_exists($dir)) {
             mkdir($dir);
         }
         $include_images = scandir($dir);
         foreach ($include_images as $name) {
             if (!is_file($dir . $name) or in_array($name, array('.', '..'))) {
                 continue;
             }
             $contents['image_list'][] = str_replace('./', config('settings', 'base_url'), $dir . $name);
         }
     }
     $page = array();
     $page['content'] = $this->view('article_edit', $contents, TRUE);
     $this->view('backend/backend', $page);
 }
开发者ID:viking2000,项目名称:web-antarix,代码行数:34,代码来源:edit.php


示例13: getBuilder

 /**
  * Resolves all the ScopeInterface items into the current Builder.
  * @return \Illuminate\Database\Query\Builder $query
  */
 public function getBuilder()
 {
     $this->query = clone $this->baseQuery;
     //apply all direct scopes to the query.
     $this->directScopes->each(function ($scope) {
         $scope_method = 'apply';
         $this->query = $scope->{$scope_method}($this->query);
     });
     //chain all required scopes in "AND" blocks
     $this->requiredScopes->each(function ($scope) {
         $scope_method = 'applyAnd';
         $this->query = $scope->{$scope_method}($this->query);
     });
     //chain all optional scopes using "OR", nested within a single "AND" block.
     if ($this->optionalScopes->count()) {
         $this->query->where(function ($query) {
             $this->optionalScopes->each(function ($scope) use($query) {
                 $scope_method = 'applyOr';
                 return $scope->{$scope_method}($query);
             });
         });
     }
     collect([])->merge($this->directScopes)->merge($this->requiredScopes)->merge($this->optionalScopes)->each(function ($scope) {
         $this->parseScope($scope);
     });
     return $this->query;
 }
开发者ID:simmatrix,项目名称:laravel-query-builder-templates,代码行数:31,代码来源:Template.php


示例14: widget

     $model = $this->__get_module('__model_list', 'models', $model_name);
     if (!$model) {
         return Loader::get_model($model_name);
     }
     return $model;
 }
 public function widget($name, $options, $return = FALSE)
 {
     if (empty($name)) {
         return '';
     }
     $widget_name = (string) str_replace('/', '__', $name);
     $widget_path = $name;
     if (!function_exists($widget_name)) {
         $path = APPPATH . 'widgets/' . $widget_path . EXT;
         include_once $path;
         if (!function_exists($widget_name)) {
             Log::log_error("Widget does not exist. widgets:[{$widget_name}], path:[{$path}]");
             return '';
         }
     }
     if (!in_array($widget_name, self::$__widget_call_list)) {
         self::$__widget_call_list[] = $widget_name;
         //$path = Builder::get_style_path("/widgets/{$widget_path}");
         //Builder::set_head($path, 'css');
         $widget_path = str_replace('/', '-', $widget_path);
         Builder::add_css("widgets/{$widget_path}");
         Builder::add_js("widgets/{$widget_path}");
         //Builder::set_head($path.'_noscript', 'css');
         //Builder::set_head("./widgets/{$widget_path}", 'js', TRUE);
     }
     $result = $widget_name($options);
开发者ID:viking2000,项目名称:web-antarix,代码行数:32,代码来源:controller.php


示例15: querySql

 public function querySql($sql, $messageError)
 {
     $result = \Meta\Core\Db::query(Builder::replaceSQL($sql))->fetchColumn();
     if (!$result) {
         $this->error = $messageError;
     }
     return $result;
 }
开发者ID:moiseh,项目名称:metapages,代码行数:8,代码来源:Validations.php


示例16: enqueue

 /**
  * Enqueue control related scripts/styles
  */
 public function enqueue()
 {
     parent::enqueue();
     wp_enqueue_style('select2', get_template_directory_uri() . '/modules/builder/assets/vendor/select2/select2.css', [], '3.5.2');
     wp_enqueue_script('select2', get_template_directory_uri() . '/modules/builder/assets/vendor/select2/select2.min.js', ['jquery'], '3.5.2', true);
     wp_enqueue_script("customize-controls-{$this->type}", get_template_directory_uri() . "/modules/builder/assets/scripts/controls/customize-controls-{$this->type}.js", ['jquery', 'select2', 'customize-controls'], null, true);
     wp_localize_script("customize-controls-{$this->type}", 'customizeControlsBuilderPost', ['actions' => ['search' => \Builder::get_ajax_action('customize_control_post_search')], 'nonces' => ['search' => wp_create_nonce()]]);
 }
开发者ID:Viktor777,项目名称:wp-customize-builder,代码行数:11,代码来源:Post.php


示例17: init

 /**
  * Get builder instance
  * @param $db
  * @param $name
  * @return Builder
  */
 public static function init($db, $name)
 {
     if (null === self::$_instance) {
         self::$_instance = new Builder($db, $name);
     } else {
         self::$_instance->db($db)->name($name);
     }
     return self::$_instance;
 }
开发者ID:nikis,项目名称:Go,代码行数:15,代码来源:builder.php


示例18: __construct

 /**
  * Menu_Builder constructor.
  *
  * @param string        $title Title menu.
  * @param integer|float $position Position menu.
  */
 public function __construct($title, $position)
 {
     parent::__construct($title);
     if (!$this->position_is_valid($position)) {
         $this->position_exception();
     }
     $this->position = $position;
     $this->settings['position'] = $position;
 }
开发者ID:nocttuam,项目名称:lyric,代码行数:15,代码来源:menu-builder.php


示例19: scopeIsAccessible

 /**
  * Select only those forums the user has access to.
  * WARNING: Creates JOINs with the forum_threads and the forums table.
  *
  * @param Builder   $query  The Eloquent Builder object
  * @param User      $user   User model or null if it's the current client
  * @return Builder
  */
 public function scopeIsAccessible($query, $user = null)
 {
     $query->select('forum_posts.*')->join('forum_threads', 'forum_posts.thread_id', '=', 'forum_threads.id')->join('forums', 'forum_threads.forum_id', '=', 'forums.id');
     if (!$user) {
         $user = user();
     }
     if ($user) {
         $internal = $user->hasAccess('internal');
         $teamIds = DB::table('team_user')->whereUserId($user->id)->lists('team_id');
         $teamIds[] = -1;
         // Add -1 as team ID so the SQL statements (`team_id` in (...)) always has valid syntax
         return $query->where('internal', '<=', $internal)->where(function ($query) use($teamIds) {
             $query->whereNull('team_id')->orWhereIn('team_id', $teamIds);
         });
     } else {
         return $query->whereInternal(0)->whereNull('team_id');
     }
 }
开发者ID:exelv1,项目名称:Contentify,代码行数:26,代码来源:ForumPost.php


示例20: method

 protected function method()
 {
     if (Builder::get()) {
     }
     $code = array_map(function ($line) {
         return $line ? '  ' . $line : $line;
     }, explode("\n", $code));
     return sprintf("if (%s)\n{\n%s}\n", implode(' && ', $conditions), $code);
 }
开发者ID:kingsj,项目名称:core,代码行数:9,代码来源:testAnalyzerAlsoCalculatesCCNAndCCN2OfClosureInMethod.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP Bulk_Upgrader_Skin类代码示例发布时间:2022-05-23
下一篇:
PHP BuildEvent类代码示例发布时间: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