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


PHP with函数代码示例

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


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


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