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


PHP static::parser方法代码示例

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


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

示例1: getParser

 /**
  * Create a parser for arithmitic expressions
  * 
  * @return Hoa\Compiler\Llk\Parser
  */
 protected function getParser()
 {
     if (!isset(static::$parser)) {
         static::$parser = Hoa\Compiler\Llk\Llk::load(new Hoa\File\Read('hoa://Library/Math/Arithmetic.pp'));
     }
     return static::$parser;
 }
开发者ID:legalthings,项目名称:data-enricher,代码行数:12,代码来源:Math.php

示例2: getParser

 public static function getParser()
 {
     if (static::$parser === null) {
         static::$parser = new VersionParser();
     }
     return static::$parser;
 }
开发者ID:hiqdev,项目名称:composer-asset-plugin,代码行数:7,代码来源:Constraint.php

示例3: _init

 /**
  * Load Markdown and get it setup.
  *
  * @return  void
  */
 public static function _init()
 {
     if (!class_exists('Michelf\\MarkdownExtra')) {
         throw new Exception('The Markdown composer library isn\'t installed. Make sure it\'s in your "composer.json", then run "composer update" to install it!');
     }
     static::$parser = new \Michelf\MarkdownExtra();
 }
开发者ID:schpill,项目名称:thin,代码行数:12,代码来源:Markdown.php

示例4: _init

 /**
  * Load Markdown and get it setup.
  *
  * @return void
  */
 public static function _init()
 {
     if (!class_exists('MarkdownExtra_Parser', false)) {
         include COREPATH . 'vendor' . DS . 'markdown' . DS . 'markdown.php';
     }
     static::$parser = new MarkdownExtra_Parser();
 }
开发者ID:vienbk91,项目名称:fuelphp17,代码行数:12,代码来源:markdown.php

示例5: parse

 /**
  * Parses PHP Markdown syntax.
  *
  * @param string $string Markdown syntax string.
  *
  * @return string String after having been parsed as PHP Markdown.
  *
  * @throws exception If invalid types are passed through arguments list.
  */
 public function parse($string)
 {
     $this->check_arg_types('string', func_get_args());
     if (!isset(static::$parser)) {
         static::$parser = new externals\markdown_x();
     }
     return static::$parser->transform($string);
 }
开发者ID:panvagenas,项目名称:x-related-posts,代码行数:17,代码来源:markdown.php

示例6: parser

 /**
  * Load annotation parser
  *
  * @param ParserInterface $parser
  * @return ParserInterface
  */
 public static function parser(ParserInterface $parser = null)
 {
     if ($parser) {
         static::$parser = $parser;
     } elseif (!static::$parser) {
         static::$parser = new Annotation\KeyValuePairParser();
     }
     return static::$parser;
 }
开发者ID:colorium,项目名称:runtime,代码行数:15,代码来源:Annotation.php

示例7: getInstance

 /**
  * {@inheritdoc}
  */
 public static function getInstance()
 {
     // setup an instance if needed
     if (!static::$parser) {
         if (class_exists('Michelf\\MarkdownExtra')) {
             static::$parser = new \Michelf\MarkdownExtra();
         } else {
             throw new \RuntimeException('FOU-021: Unable to create a Markdown instance. Did you install the "michelf\\php-markdown" composer package?');
         }
     }
     return static::$parser;
 }
开发者ID:fuelphp,项目名称:legacy,代码行数:15,代码来源:Markdown.php

示例8: parse

 public static function parse($text)
 {
     if (!isset(static::$parser)) {
         static::$parser = static::getParser();
     }
     if (isset(static::$beforeParse)) {
         $text = \call_user_func(static::$beforeParse, $text);
     }
     $xml = static::$parser->parse($text);
     if (isset(static::$afterParse)) {
         $xml = \call_user_func(static::$afterParse, $xml);
     }
     return $xml;
 }
开发者ID:redstarxz,项目名称:flarumone,代码行数:14,代码来源:Bundle.php

示例9: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     static::$parser = new CityMapParser();
 }
开发者ID:hamdrew,项目名称:adventofcode,代码行数:5,代码来源:CityMapParserTest.php

示例10: fromString

 /**
  * Create a new rule from a string.
  *
  * @param  string $string
  * @throws Exception\ParseException
  * @return Rule
  */
 public static function fromString($string)
 {
     if (static::$parser === null) {
         static::$parser = new Parser();
     }
     if (!preg_match('(nplurals=(?P<nplurals>\\d+))', $string, $match)) {
         throw new Exception\ParseException(sprintf('Unknown or invalid parser rule: %s', $string));
     }
     $numPlurals = (int) $match['nplurals'];
     if (!preg_match('(plural=(?P<plural>[^;\\n]+))', $string, $match)) {
         throw new Exception\ParseException(sprintf('Unknown or invalid parser rule: %s', $string));
     }
     $tree = static::$parser->parse($match['plural']);
     $ast = static::createAst($tree);
     return new static($numPlurals, $ast);
 }
开发者ID:Flesh192,项目名称:magento,代码行数:23,代码来源:Rule.php

示例11: reset

 /**
  * Reset the cached parser and renderer
  *
  * @return void
  */
 public static function reset()
 {
     static::$parser = null;
     static::$renderer = null;
 }
开发者ID:CryptArc,项目名称:TextFormatter,代码行数:10,代码来源:Bundle.php

示例12: setParserFactory

 /**
  * Set search query parser factory instance.
  *
  * @param \Sofa\Eloquence\Contracts\Searchable\ParserFactory $factory
  */
 public static function setParserFactory(ParserFactory $factory)
 {
     static::$parser = $factory;
 }
开发者ID:rafwlaz,项目名称:eloquence,代码行数:9,代码来源:Builder.php

示例13: _reset

 public static function _reset(Test $test)
 {
     self::$calls = ['getParser' => 0, 'getRenderer' => 0];
     $mock = $test->getMock('stdClass', ['parse', 'render', 'setParameters']);
     $mock->expects($test->never())->method('parse');
     $mock->expects($test->never())->method('render');
     $mock->expects($test->never())->method('setParameters');
     static::$parser = null;
     static::$_parser = $mock;
     static::$renderer = null;
     static::$_renderer = $mock;
     static::$beforeParse = null;
     static::$afterParse = null;
     static::$beforeRender = null;
     static::$afterRender = null;
     static::$beforeUnparse = null;
     static::$afterUnparse = null;
 }
开发者ID:CryptArc,项目名称:TextFormatter,代码行数:18,代码来源:BundleTest.php

示例14: getParser

 /**
  * Gets the Parser implementation.
  *
  * @return  Parser\ParserInterface
  *
  * @since   2.0.0
  */
 private static function getParser()
 {
     if (is_null(static::$parser)) {
         static::$parser = new Parser\DateTimeParser();
     }
     return static::$parser;
 }
开发者ID:kl07,项目名称:datetime,代码行数:14,代码来源:DateTime.php

示例15: setParser

 /**
  * Seriously?  You want to do your own parsing thang? Ok, set a callback here.
  *
  * @param mixed $callback any valid callback.
  * @return object
  */
 public static function setParser($callback)
 {
     static::$parser = $callback;
     return static::chain();
 }
开发者ID:craftsmancoding,项目名称:formbuilder,代码行数:11,代码来源:Form.php


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