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

PHP with函数代码示例

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

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



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

示例1: unmarshalFrom

 /**
  * Unmarshal return value from a specified node
  *
  * @param   xml.Node node
  * @return  webservices.uddi.BusinessList
  * @see     xp://webservices.uddi.UDDICommand#unmarshalFrom
  * @throws  lang.FormatException in case of an unexpected response
  */
 public function unmarshalFrom($node)
 {
     if (0 != strcasecmp($node->name, 'businessList')) {
         throw new \lang\FormatException('Expected "businessList", got "' . $node->name . '"');
     }
     // Create business list object from XML representation
     with($list = new BusinessList(), $children = $node->nodeAt(0)->getChildren());
     $list->setOperator($node->getAttribute('operator'));
     $list->setTruncated(0 == strcasecmp('true', $node->getAttribute('truncated')));
     for ($i = 0, $s = sizeof($children); $i < $s; $i++) {
         $b = new Business($children[$i]->getAttribute('businessKey'));
         for ($j = 0, $t = sizeof($children[$i]->getChildren()); $j < $s; $j++) {
             switch ($children[$i]->nodeAt($j)->name) {
                 case 'name':
                     $b->names[] = $children[$i]->nodeAt($j)->getContent();
                     break;
                 case 'description':
                     $b->description = $children[$i]->nodeAt($j)->getContent();
                     break;
             }
         }
         $list->items[] = $b;
     }
     return $list;
 }
开发者ID:treuter,项目名称:webservices,代码行数:33,代码来源:FindBusinessesCommand.class.php


示例2: withKeys

 public function withKeys()
 {
     with($keys = ['id', 'name', 'email']);
     $in = $this->newReader('');
     $this->assertEquals($in, $in->withKeys($keys));
     $this->assertEquals($keys, $in->getKeys());
 }
开发者ID:xp-framework,项目名称:csv,代码行数:7,代码来源:CsvMapReaderTest.class.php


示例3: insertRow

 public function insertRow($data, $id)
 {
     $table = with(new static())->table;
     $key = with(new static())->primaryKey;
     if ($id == NULL) {
         // Insert Here
         if (isset($data['createdOn'])) {
             $data['createdOn'] = date("Y-m-d H:i:s");
         }
         if (isset($data['updatedOn'])) {
             $data['updatedOn'] = date("Y-m-d H:i:s");
         }
         $id = \DB::table($table)->insertGetId($data);
     } else {
         // Update here
         // update created field if any
         if (isset($data['createdOn'])) {
             unset($data['createdOn']);
         }
         if (isset($data['updatedOn'])) {
             $data['updatedOn'] = date("Y-m-d H:i:s");
         }
         \DB::table($table)->where($key, $id)->update($data);
     }
     return $id;
 }
开发者ID:vinodjoshi,项目名称:laravel,代码行数:26,代码来源:Sximo.php


示例4: newInstance

 /**
  * Retrieve a new instance 
  *
  * @param   string oid
  * @param   ProtocolHandler handler
  * @return  RemoteInvocationHandler
  */
 public static function newInstance($oid, $handler)
 {
     with($i = new RemoteInvocationHandler());
     $i->oid = $oid;
     $i->handler = $handler;
     return $i;
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:14,代码来源:RemoteInvocationHandler.class.php


示例5: create

 /**
  * @return mixed
  */
 public function create()
 {
     $users = User::with('employee')->get()->reject(function ($user) {
         return $user->id === auth()->user()->id;
     });
     return response()->view('messages.create', with(compact('users')));
 }
开发者ID:rosemalejohn,项目名称:dnsc-hris,代码行数:10,代码来源:MessageController.php


示例6: make

 /**
  * Create a new Console application.
  *
  * @param  \Weloquent\Core\Application $app
  * @return \Illuminate\Console\Application
  */
 public static function make($app)
 {
     $app->boot();
     $console = with($console = new static('WEL. A w.eloquent console by artisan.', $app::VERSION))->setLaravel($app)->setExceptionHandler($app['exception'])->setAutoExit(false);
     $app->instance('artisan', $console);
     return $console;
 }
开发者ID:bruno-barros,项目名称:w.eloquent-framework,代码行数:13,代码来源:WelConsole.php


示例7: fire

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $names = $this->argument('name');
     foreach ($names as $name) {
         with(new ModuleGenerator($name))->setFilesystem($this->laravel['files'])->setModule($this->laravel['modules'])->setConfig($this->laravel['config'])->setConsole($this)->setForce($this->option('force'))->setPlain($this->option('plain'))->generate();
     }
 }
开发者ID:Avantinternet,项目名称:modules,代码行数:12,代码来源:MakeCommand.php


示例8: call

 public function call()
 {
     // The Slim application
     $app = $this->app;
     // The Environment object
     $environment = $app->environment;
     // The Request object
     $request = $app->request;
     // The Response object
     $response = $app->response;
     // Route Configuration
     $routeConfig = ['/api/user' => \App\Http\ApiUserController::class, '/api' => \App\Http\ApiSiteController::class, '/' => \App\Http\SiteController::class];
     // Request path info
     $pathInfo = $request->getPathInfo();
     // Searching per directory
     foreach ($routeConfig as $basePath => $controller) {
         if ($pathInfo === $basePath) {
             with(new $controller($app, $basePath))->map();
             break;
         }
         if (starts_with(ltrim($pathInfo, '/'), ltrim($basePath, '/'))) {
             with(new $controller($app, $basePath))->map();
             break;
         }
     }
     // Call next middleware
     $this->next->call();
 }
开发者ID:krisanalfa,项目名称:worx,代码行数:28,代码来源:ControllerMiddleware.php


示例9: __construct

    /**
     *
     * @param int $perSize 每次迭代的数据条数
     * @param bool $withRelations 是否带上关联查询
     * @param int $limit 总条数限制
     */
    public function __construct($perSize = 100, $withRelations = true, $limit = 0)
    {
        $this->post = new Post();
        $this->perSize = $perSize;
        $this->total_items = $this->post->count();
        if ($limit > 0) {
            $this->total_items = max($this->total_items, $limit);
        }
        $this->postsTableName = $this->post->getSource();
        $this->dbConnection = $this->post->getReadConnection();
        $this->textsTableName = with(new Texts())->getSource();
        $this->votesTableName = with(new Votes())->getSource();
        $this->tagsPostsTableName = with(new TagsPosts())->getSource();
        $this->tagsTableName = with(new Tags())->getSource();
        $this->categoriesTableName = with(new CategoriesPosts())->getSource();
        $this->endPosition = floor($this->total_items / $this->perSize);
        if ($withRelations) {
            $this->sql = <<<SQL
SELECT
\tpost.*,
\tvote.upVote,
\tvote.downVote,
\t(SELECT GROUP_CONCAT(`categoryId`) FROM `{$this->categoriesTableName}` WHERE postId=post.id) as categoryIds,
\t(SELECT GROUP_CONCAT(`tagName`) FROM  `{$this->tagsTableName}`  WHERE id IN (SELECT `tagId` FROM `{$this->tagsPostsTableName}` WHERE `postId`=post.id)) as tagNames,
    text.content
FROM `{$this->postsTableName}` as post
LEFT JOIN `{$this->textsTableName}` as text
\tON text.postId=post.id
LEFT JOIN `{$this->votesTableName}` as vote
  ON vote.postId=post.id
SQL;
        } else {
            $this->sql = "SELECT * FROM {$this->postsTableName}";
        }
    }
开发者ID:skybird,项目名称:phalcon,代码行数:41,代码来源:PostIterator.php


示例10: run

 /**
  * Run the application and save headers.
  * The response is up to WordPress
  *
  * @param  \Symfony\Component\HttpFoundation\Request $request
  * @return void
  */
 public function run(SymfonyRequest $request = null)
 {
     /**
      * On testing environment the WordPress helpers
      * will not have context. So we stop here.
      */
     if (defined('WELOQUENT_TEST_ENV') && WELOQUENT_TEST_ENV) {
         return;
     }
     $request = $request ?: $this['request'];
     $response = with($stack = $this->getStackedClient())->handle($request);
     // just set headers, but the content
     if (!is_admin()) {
         $response->sendHeaders();
     }
     if ('cli' !== PHP_SAPI) {
         $response::closeOutputBuffers(0, false);
     }
     /**
      * Save the session data until the application dies
      */
     add_action('wp_footer', function () use($stack, $request, $response) {
         $stack->terminate($request, $response);
         Session::save('wp_footer');
     });
 }
开发者ID:bruno-barros,项目名称:w.eloquent-framework,代码行数:33,代码来源:Application.php


示例11: postChangePassword

 public function postChangePassword()
 {
     $rules = array('old_password' => 'required', 'password' => 'required|min:5|confirmed');
     $input = Input::all();
     $v = Validator::make($input, $rules);
     if ($v->fails()) {
         return Redirect::route('admin.change-password')->withErrors($v)->withInput();
     }
     try {
         $user = Sentinel::getUser();
         $credentials = ['email' => $user->email, 'password' => $input['old_password']];
         if (Sentinel::validateCredentials($user, $credentials)) {
             $user->password = Hash::make($input['password']);
             $user->save();
             Session::flash('success', 'You have successfully changed your password');
             return Redirect::route('admin.change-password');
         } else {
             $error = "Invalid old password";
             $errors = with(new bag())->add('password', $error);
             return Redirect::route('admin.change-password')->withErrors($errors)->withInput();
         }
     } catch (Cartalyst\Sentinel\Users\UserNotFoundException $e) {
         return Redirect::route('admin.logout');
     }
 }
开发者ID:benhanks040888,项目名称:Laravel-5-starter-kit,代码行数:25,代码来源:AuthController.php


示例12: boot

 /**
  * Bootstrap the application events.
  *
  * @return void
  */
 public function boot()
 {
     $componenentsFileName = with(new ReflectionClass('\\Componeint\\Dashboard\\DashboardServiceProvider'))->getFileName();
     $componenentsPath = dirname($componenentsFileName);
     $this->loadViewsFrom($componenentsPath . '/../../resources/views', 'dashboard');
     // include $componenentsPath . '/../routes.php';
 }
开发者ID:componeint,项目名称:dashboard,代码行数:12,代码来源:DashboardServiceProvider.php


示例13: useAllOf

 /**
  * Issues a uses() command inside a new runtime for every class given
  * and returns a line indicating success or failure for each of them.
  *
  * @param   string[] uses
  * @param   string decl
  * @return  var[] an array with three elements: exitcode, stdout and stderr contents
  */
 protected function useAllOf($uses, $decl = '')
 {
     with($out = $err = '', $p = Runtime::getInstance()->newInstance(NULL, 'class', 'xp.runtime.Evaluate', array()));
     $p->in->write($decl . '
       ClassLoader::registerPath(\'' . strtr($this->getClass()->getClassLoader()->path, '\\', '/') . '\');
       $errors= 0;
       foreach (array("' . implode('", "', $uses) . '") as $class) {
         try {
           uses($class);
           echo "+OK ", $class, "\\n";
         } catch (Throwable $e) {
           echo "-ERR ", $class, ": ", $e->getClassName(), "\\n";
           $errors++;
         }
       }
       exit($errors);
     ');
     $p->in->close();
     // Read output
     while ($b = $p->out->read()) {
         $out .= $b;
     }
     while ($b = $p->err->read()) {
         $err .= $b;
     }
     // Close child process
     $exitv = $p->close();
     return array($exitv, explode("\n", rtrim($out)), explode("\n", rtrim($err)));
 }
开发者ID:Gamepay,项目名称:xp-framework,代码行数:37,代码来源:UsesTest.class.php


示例14: fromId

 /**
  * Generate a new 8-character slug.
  *
  * @param integer $id
  * @return Slug
  */
 public static function fromId($id)
 {
     $salt = md5($id);
     $alphabet = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
     $slug = with(new Hashids($salt, $length = 8, $alphabet))->encode($id);
     return new Slug($slug);
 }
开发者ID:floatingpointsoftware,项目名称:grapevine,代码行数:13,代码来源:Slug.php


示例15: entries

 public function entries()
 {
     $builder = with(new Entry())->newQuery();
     $groups = $this->groups;
     $builder->whereIn('group_id', $groups);
     return $builder;
 }
开发者ID:vegax87,项目名称:Strimoid,代码行数:7,代码来源:Folder.php


示例16: __construct

 /**
  * Creates a new CSV reader reading data from a given TextReader
  *
  * @param   io.streams.TextReader reader
  * @param   text.csv.CsvFormat format
  */
 public function __construct(TextReader $reader, CsvFormat $format = NULL)
 {
     $this->reader = $reader;
     with($f = $format ? $format : CsvFormat::$DEFAULT);
     $this->delimiter = $f->getDelimiter();
     $this->quote = $f->getQuote();
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:13,代码来源:CsvReader.class.php


示例17: tailLocalLogs

 /**
  * Tail a local log file for the application.
  *
  * @param  string  $path
  * @return string
  */
 protected function tailLocalLogs($path)
 {
     $output = $this->output;
     with(new Process('tail -f ' . $path))->setTimeout(null)->run(function ($type, $line) use($output) {
         $output->write($line);
     });
 }
开发者ID:yashb,项目名称:generator,代码行数:13,代码来源:TailCommand.php


示例18: testChildrenRelationObeysCustomOrdering

 public function testChildrenRelationObeysCustomOrdering()
 {
     with(new OrderedCategorySeeder())->run();
     $children = OrderedCategory::find(1)->children()->get()->all();
     $expected = array(OrderedCategory::find(5), OrderedCategory::find(2), OrderedCategory::find(3));
     $this->assertEquals($expected, $children);
 }
开发者ID:ArmSALArmy,项目名称:Banants,代码行数:7,代码来源:CategoryRelationsTest.php


示例19: shipment

 /**
  * Create the shipment for sticker.
  *
  * @param null $driver
  *
  * @return \Illuminate\Http\JsonResponse
  */
 public function shipment($driver = null)
 {
     try {
         \DB::beginTransaction();
         if (is_null($driver)) {
             $driver = $this->getAuthenticatedDriver();
         }
         $new_shipment = ["sticker_id" => $driver->sticker->id, "address" => \Input::get('address', $driver->address), "status" => "waiting", "paypal_payment_status" => "pending"];
         with(new CreateShipmentValidator())->validate($new_shipment);
         // Add paypal_metadata_id for future payment.
         $driver->paypal_metadata_id = \Input::get('metadata_id');
         if ($capturedPayment = $this->paypal->buySticker($driver)) {
             $new_shipment['paypal_payment_id'] = $capturedPayment->parent_payment;
             if ($shipment = Shipment::create($new_shipment)) {
                 \DB::commit();
                 return $this->setStatusCode(201)->respondWithItem($shipment);
             }
             return $this->errorInternalError('Shipment for buying sticker created failed.');
         }
         return $this->errorInternalError();
     } catch (ValidationException $e) {
         return $this->errorWrongArgs($e->getErrors());
     } catch (\Exception $e) {
         print_r($e->getMessage());
         return $this->errorInternalError();
     }
 }
开发者ID:xintang22,项目名称:Paxifi,代码行数:34,代码来源:ShipmentController.php


示例20: fire

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $host = $this->input->getOption('host');
     $port = $this->input->getOption('port');
     $this->info("Lumen ReactPHP server started on http://{$host}:{$port}");
     with(new \LaravelReactPHP\Server($host, $port))->run();
 }
开发者ID:cleytonbonamigo,项目名称:lumen-reactphp,代码行数:12,代码来源:ReactServe.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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