當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。