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


PHP Set::all方法代码示例

本文整理汇总了PHP中Slim\Helper\Set::all方法的典型用法代码示例。如果您正苦于以下问题:PHP Set::all方法的具体用法?PHP Set::all怎么用?PHP Set::all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Slim\Helper\Set的用法示例。


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

示例1: render

 /**
  * Render a template file
  *
  * NOTE: This method should be overridden by custom view subclasses
  *
  * @var    string $template     The template pathname, relative to the template base directory
  * @return string               The rendered template
  * @throws \RuntimeException    If resolved template pathname is not a valid file
  */
 protected function render($template)
 {
     $templatePathname = $this->getTemplatePathname($template);
     if (!is_file($templatePathname)) {
         throw new \RuntimeException("View cannot render `{$template}` because the template does not exist");
     }
     extract($this->data->all());
     ob_start();
     require $templatePathname;
     return ob_get_clean();
 }
开发者ID:karthy86,项目名称:Experiments,代码行数:20,代码来源:View.php

示例2: render

 /**
  * Render a template file
  *
  * NOTE: This method should be overridden by custom view subclasses
  *
  * @param  string $template     The template pathname, relative to the template base directory
  * @param  array  $data         Any additonal data to be passed to the template.
  * @return string               The rendered template
  * @throws \RuntimeException    If resolved template pathname is not a valid file
  */
 protected function render($template, $data = null)
 {
     #echo $this->getTemplatePathname($template);die;
     $templatePathname = $this->getTemplatePathname($template);
     if (!is_file($templatePathname)) {
         throw new \RuntimeException("View cannot render `{$template}` because the template does not exist");
     }
     $data = array_merge($this->data->all(), (array) $data);
     extract($data);
     ob_start();
     require $templatePathname;
     return ob_get_clean();
 }
开发者ID:lga37,项目名称:modelo,代码行数:23,代码来源:View.php

示例3: accessTokenPost

 /**
  * Tries to create a new access token.
  */
 public function accessTokenPost($request)
 {
     $body = $request->getBody();
     $body = json_decode($body, true);
     // Some clients escape the JSON - handle them
     if (is_string($body)) {
         $body = json_decode($body, true);
     }
     if (json_last_error() !== JSON_ERROR_NONE) {
         throw new \Exception('Invalid JSON posted. Cannot continue!', Resource::STATUS_BAD_REQUEST);
     }
     $requestParams = new Set($body);
     if ($requestParams->get('user')['email'] === null) {
         throw new \Exception('Invalid request, user.email property not present!', Resource::STATUS_BAD_REQUEST);
     }
     $currentDate = new \DateTime();
     $defaultParams = new Set(['user' => ['password' => 'password', 'permissions' => ['all']], 'scopes' => ['all'], 'name' => 'Token for ' . $requestParams->get('user')['email'], 'description' => 'Token generated at ' . Util\Date::dateTimeToISO8601($currentDate), 'expiresAt' => null]);
     $params = new Set(array_replace_recursive($defaultParams->all(), $requestParams->all()));
     $scopeDocuments = [];
     $scopes = $params->get('scopes');
     foreach ($scopes as $scope) {
         $scopeDocument = $this->getScopeByName($scope);
         $scopeDocuments[] = $scopeDocument;
     }
     $permissionDocuments = [];
     $permissions = $params->get('user')['permissions'];
     foreach ($permissions as $permission) {
         $permissionDocument = $this->getScopeByName($permission);
         $permissionDocuments[] = $permissionDocument;
     }
     if (is_numeric($params->get('expiresAt'))) {
         $expiresAt = $params->get('expiresAt');
     } else {
         if (null === $params->get('expiresAt')) {
             $expiresAt = null;
         } else {
             $expiresAt = new \DateTime($params->get('expiresAt'));
             $expiresAt = $expiresAt->getTimestamp();
         }
     }
     $userService = new UserService($this->getSlim());
     $user = $userService->addUser($params->get('user')['email'], $params->get('user')['password'], $permissionDocuments);
     $user->save();
     $this->addToken($params->get('name'), $params->get('description'), $expiresAt, $user, $scopeDocuments);
     return $this;
 }
开发者ID:rohanabraham,项目名称:lxHive,代码行数:49,代码来源:Basic.php

示例4: render

 public function render($name, $data = array())
 {
     $php = LightnCandy::compile($this->getTemplate($name), array('flags' => LightnCandy::FLAG_ERROR_EXCEPTION | LightnCandy::FLAG_ERROR_LOG | LightnCandy::FLAG_INSTANCE | LightnCandy::FLAG_MUSTACHE | LightnCandy::FLAG_HANDLEBARS, 'basedir' => $this->directories, 'fileext' => $this->extensions, 'helpers' => $this->helpers->all(), 'hbhelpers' => $this->block_helpers->all()));
     $renderer = LightnCandy::prepare($php);
     return $renderer(array_merge($data ?: array(), $this->all()), LCRun3::DEBUG_ERROR_LOG);
 }
开发者ID:CFLOVEYR,项目名称:hook,代码行数:6,代码来源:View.php

示例5: function

// CORS compatibility layer (Internet Explorer)
$app->hook('slim.before.router', function () use($app) {
    if ($app->request->isPost() && $app->request->get('method')) {
        $method = $app->request->get('method');
        $app->environment()['REQUEST_METHOD'] = strtoupper($method);
        mb_parse_str($app->request->getBody(), $postData);
        $parameters = new Set($postData);
        if ($parameters->has('content')) {
            $content = $parameters->get('content');
            $app->environment()['slim.input'] = $content;
            $parameters->remove('content');
        } else {
            // Content is the only valid body parameter...everything else are either headers or query parameters
            $app->environment()['slim.input'] = '';
        }
        $app->request->headers->replace($parameters->all());
        $app->environment()['slim.request.query_hash'] = $parameters->all();
    }
});
// Parse version
$app->hook('slim.before.dispatch', function () use($app) {
    // Version
    $app->container->singleton('version', function () use($app) {
        if ($app->request->isOptions() || $app->request->getPathInfo() === '/about' || strpos(strtolower($app->request->getPathInfo()), '/oauth') === 0) {
            $versionString = $app->config('xAPI')['latest_version'];
        } else {
            $versionString = $app->request->headers('X-Experience-API-Version');
        }
        if ($versionString === null) {
            throw new \Exception('X-Experience-API-Version header missing.', Resource::STATUS_BAD_REQUEST);
        } else {
开发者ID:rohanabraham,项目名称:lxHive,代码行数:31,代码来源:index.php


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