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


PHP Debug::increment方法代码示例

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


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

示例1: parse

 /**
  * Parse a block of YAML into PHP
  *
  * @param string  $yaml  YAML-formatted string to parse
  * @param string  $mode  Parsing mode to use
  * @return array
  */
 public static function parse($yaml, $mode = null)
 {
     // start measuring
     $hash = Debug::markStart('parsing', 'yaml');
     $mode = $mode ? $mode : self::getMode();
     switch ($mode) {
         case 'loose':
             $result = Spyc::YAMLLoad($yaml);
             break;
         case 'strict':
             $result = sYAML::parse($yaml);
             break;
         case 'transitional':
             try {
                 $result = sYaml::parse($yaml);
             } catch (Exception $e) {
                 Log::error($e->getMessage() . ' Falling back to loose mode.', 'core', 'yaml');
                 $result = Spyc::YAMLLoad($yaml);
             }
             break;
         default:
             // check for new lines, is this a file?
             $has_newline = strpos($yaml, "\n") !== false;
             if (!$has_newline && File::exists($yaml)) {
                 // seems like it is
                 $yaml = File::get($yaml);
             }
             $result = Statamic\Dipper\Dipper::parse($yaml);
     }
     // end measuring
     Debug::markEnd($hash);
     Debug::increment('parses', 'yaml');
     return $result;
 }
开发者ID:andorpandor,项目名称:git-deploy.eu2.frbit.com-yr-prototype,代码行数:41,代码来源:yaml.php

示例2: parse

 /**
  * Parse a block of YAML into PHP
  *
  * @param string  $yaml  YAML-formatted string to parse
  * @param string  $mode  Parsing mode to use
  * @return array
  */
 public static function parse($yaml, $mode = null)
 {
     // start measuring
     $hash = Debug::markStart('parsing', 'yaml');
     $mode = $mode ? $mode : self::getMode();
     switch ($mode) {
         case 'loose':
             $result = Spyc::YAMLLoad($yaml);
             break;
         case 'strict':
             $result = sYAML::parse($yaml);
             break;
         case 'transitional':
             try {
                 $result = sYaml::parse($yaml);
             } catch (Exception $e) {
                 Log::error($e->getMessage() . ' Falling back to loose mode.', 'core', 'yaml');
                 $result = Spyc::YAMLLoad($yaml);
             }
             break;
         default:
             $result = Spyc::YAMLLoad($yaml);
     }
     // end measuring
     Debug::markEnd($hash);
     Debug::increment('parses', 'yaml');
     return $result;
 }
开发者ID:zane-insight,项目名称:WhiteLaceInn,代码行数:35,代码来源:yaml.php

示例3: partial

 public function partial()
 {
     $start = time();
     $src = $this->fetchParam('src', null, null, false, false);
     $extensions = array(".html", ".md", ".markdown", ".textile");
     $html = null;
     // measurement
     $hash = Debug::markStart('partials', $src, $start);
     Debug::increment('partials', $src);
     if ($src) {
         foreach ($extensions as $extension) {
             $full_src = Path::assemble(BASE_PATH, $this->theme_root, 'partials', ltrim($src . $extension, '/'));
             if (File::exists($full_src)) {
                 Statamic_View::$_dataStore = $this->attributes + Statamic_View::$_dataStore;
                 if ($this->fetchParam('use_context', false, false, true, false)) {
                     // to use context, we only want to pass the attributes as
                     // the current data, as those will override into the context
                     // set of data; if we were to include all of ::$_dataStore,
                     // we run into the issue where all of the global-level variables
                     // are overriding variables in context, when the variables in
                     // context are more accurate scope-wise at this point in the parse
                     $html = Parse::contextualTemplate(file_get_contents($full_src), $this->attributes, $this->context, array('statamic_view', 'callback'), true);
                 } else {
                     $html = Parse::template(file_get_contents($full_src), Statamic_View::$_dataStore);
                 }
                 // parse contents if needed
                 if ($extension == ".md" || $extension == ".markdown") {
                     $html = Parse::markdown($html);
                 } elseif ($extension == ".textile") {
                     $html = Parse::textile($html);
                 }
             }
         }
         if (Config::get('enable_smartypants', TRUE)) {
             $html = Parse::smartypants($html);
         }
     }
     Debug::markEnd($hash);
     return $html;
 }
开发者ID:zane-insight,项目名称:WhiteLaceInn,代码行数:40,代码来源:pi.theme.php

示例4: buildContent

 /**
  * Builds a file with YAML front-matter
  *
  * @param array  $data  Front-matter data
  * @param string  $content  Content
  * @return string
  */
 public static function buildContent(array $data, $content)
 {
     Debug::increment('content', 'files_built');
     $file_content = "---\n";
     $file_content .= preg_replace('/\\A^---\\s/ism', "", YAML::dump($data));
     $file_content .= "---\n";
     $file_content .= $content;
     return $file_content;
 }
开发者ID:zane-insight,项目名称:WhiteLaceInn,代码行数:16,代码来源:file.php

示例5: wipe

 /**
  * Empty the specified directory of all files and folders.
  *
  * @param  string|array  $directory folder(s) to empty
  * @return void
  */
 public static function wipe($directory)
 {
     Debug::increment('folders', 'emptied');
     self::delete($directory, TRUE);
 }
开发者ID:andorpandor,项目名称:git-deploy.eu2.frbit.com-yr-prototype,代码行数:11,代码来源:folder.php

示例6: conditions

 /**
  * Parses a conditions string
  *
  * @param string  $conditions  Conditions to parse
  * @return array
  */
 public static function conditions($conditions)
 {
     // start measuring
     $hash = Debug::markStart('parsing', 'conditions');
     Debug::increment('parses', 'condition_statements');
     $replacement = '__TEMP_COMMA_' . substr(md5(time()), 0, 12) . '__';
     $conditions = explode(",", str_replace('\\,', $replacement, $conditions));
     $output = array();
     foreach ($conditions as $condition) {
         Debug::increment('parses', 'conditions');
         $result = Parse::condition(str_replace($replacement, ',', $condition));
         $output[$result['key']] = $result['value'];
     }
     // end measuring
     Debug::markEnd($hash);
     return $output;
 }
开发者ID:Bferreira5,项目名称:Theme-Example,代码行数:23,代码来源:parse.php

示例7: getVariable

 /**
  * Takes a scope-notated key and finds the value for it in the given
  * array or object.
  *
  * @param  string       $key     Dot-notated key to find
  * @param  array|object $data    Array or object to search
  * @param  mixed        $default Default value to use if not found
  * @return mixed
  */
 protected function getVariable($key, $data, $default = null)
 {
     // <statamic>
     // detect modifiers
     $modifiers = null;
     if (strpos($key, "|") !== false) {
         $parts = explode("|", $key);
         $key = $parts[0];
         $modifiers = array_splice($parts, 1);
     }
     // </statamic>
     if (strpos($key, $this->scopeGlue) === false) {
         $parts = explode('.', $key);
     } else {
         $parts = explode($this->scopeGlue, $key);
     }
     foreach ($parts as $key_part) {
         if (is_array($data)) {
             if (!array_key_exists($key_part, $data)) {
                 return $default;
             }
             $data = $data[$key_part];
         } elseif (is_object($data)) {
             if (!isset($data->{$key_part})) {
                 return $default;
             }
             $data = $data->{$key_part};
         } else {
             return $default;
         }
     }
     // <statamic>
     // execute modifier chain
     if ($modifiers) {
         foreach ($modifiers as $mod) {
             $now = time();
             if (strpos($mod, ":") === false) {
                 $modifier = $mod;
                 $modifier_params = array();
             } else {
                 $parts = explode(":", $mod);
                 $modifier = $parts[0];
                 $modifier_params = array_splice($parts, 1);
             }
             $hash = \Debug::markStart('modifiers', $modifier, $now);
             try {
                 // load modifier
                 $modifier_obj = \Resource::loadModifier(\Parse::modifierAlias($modifier));
                 // ensure method exists
                 if (!method_exists($modifier_obj, "index")) {
                     throw new \Exception("Improperly formatted modifier object.");
                 }
                 // call method
                 $data = $modifier_obj->index($data, $modifier_params);
                 \Debug::increment('modifiers', $modifier);
             } catch (\Exception $e) {
                 // do nothing
             }
             \Debug::markEnd($hash);
         }
     }
     // </statamic>
     return $data;
 }
开发者ID:andorpandor,项目名称:git-deploy.eu2.frbit.com-yr-prototype,代码行数:73,代码来源:Parser.php

示例8: callback

 /**
  * callback
  * Attempts to load a plugin?
  *
  * @param string $name
  * @param array $attributes
  * @param string $content
  * @param array $context
  * @return string
  * @throws Exception
  */
 public static function callback($name, $attributes, $content, $context = array())
 {
     $now = time();
     $output = false;
     $pos = strpos($name, ':');
     # single function plugins
     if ($pos === false) {
         $plugin = $name;
         $call = "index";
     } else {
         $plugin = substr($name, 0, $pos);
         $call = substr($name, $pos + 1);
     }
     // mark start of debug timing
     $hash = Debug::markStart('plugins', $plugin . ':' . $call, $now);
     // if nothing to call, abort
     if (!$call) {
         Debug::markEnd($hash);
         return null;
     }
     try {
         // will throw an exception if resource isn't available
         $plugin_obj = Resource::loadPlugin($plugin);
         if (!is_callable(array($plugin_obj, $call))) {
             throw new Exception('Method not callable.');
         }
         $plugin_obj->attributes = $attributes;
         $plugin_obj->content = $content;
         $plugin_obj->context = $context;
         Debug::increment('plugins', $plugin);
         $output = call_user_func(array($plugin_obj, $call));
         if (is_array($output)) {
             $output = Parse::template($content, $output);
         }
     } catch (\Slim\Exception\Stop $e) {
         // allow plugins to halt the app
         throw $e;
     } catch (ResourceNotFoundException $e) {
         // resource not found, do nothing
     } catch (Exception $e) {
         // everything else, do nothing if debug is off
         if (Config::get('debug')) {
             throw $e;
         }
     }
     Debug::markEnd($hash);
     return $output;
 }
开发者ID:zane-insight,项目名称:WhiteLaceInn,代码行数:59,代码来源:view.php


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