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


PHP String::create方法代码示例

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


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

示例1: testFromArrayToArrayList

 function testFromArrayToArrayList()
 {
     $input = array("one", "two");
     $output = String::fromPrimitives($input);
     $this->assertEqual(String::create("one"), $output->get(0));
     $this->assertEqual(String::create("two"), $output->get(1));
 }
开发者ID:aeberh,项目名称:php-movico,代码行数:7,代码来源:StringFromPrimitivesTest.php

示例2: testOkIndex

 function testOkIndex()
 {
     $bla = String::create("Bla");
     $this->assertEqual(String::create("B"), $bla->charAt(0));
     $this->assertEqual(String::create("l"), $bla->charAt(1));
     $this->assertEqual(String::create("a"), $bla->charAt(2));
 }
开发者ID:aeberh,项目名称:php-movico,代码行数:7,代码来源:StringCharAtTest.php

示例3: __construct

 public function __construct($url)
 {
     $this->url = $url;
     $viewParts = String::create($url)->split(self::URL_DELIMITER, 2);
     $this->view = $viewParts->get(0)->getPrimitive();
     $this->params = $viewParts->size() > 1 ? String::toPrimitives($viewParts->get(1)->split("/")) : array();
 }
开发者ID:aeberh,项目名称:php-movico,代码行数:7,代码来源:ViewForward.php

示例4: getHref

 protected function getHref()
 {
     if (!String::create($this->action)->trim()->startsWith("\$") && $this->isLinkEnabled()) {
         return "#" . $this->action;
     }
     return "#";
 }
开发者ID:aeberh,项目名称:php-movico,代码行数:7,代码来源:AbstractCommand.php

示例5: create

 public static function create($lang)
 {
     $content = String::create(file_get_contents("bean/games/boggle/data/blocks/{$lang}"));
     $layout = new ArrayList("String");
     foreach ($content->split("\n") as $die) {
         $layout->add($die->split(" ")->getRandomElement());
     }
     $layout->shuffle();
     return new BoggleGrid($layout);
 }
开发者ID:aeberh,项目名称:php-movico,代码行数:10,代码来源:BoggleGrid.php

示例6: getChildrenWithTag

 private function getChildrenWithTag($tagName)
 {
     $tagNameStr = String::create($tagName);
     $result = new ArrayList("XmlElement");
     foreach ($this->children as $child) {
         if ($child->getName()->equals($tagNameStr)) {
             $result->add($child);
         }
     }
     return $result;
 }
开发者ID:aeberh,项目名称:php-movico,代码行数:11,代码来源:XmlElement.php

示例7: __construct

 public function __construct($get, $post, $files)
 {
     $this->get = HashMap::fromArray("string", "?", $get);
     $this->post = HashMap::fromArray("string", "?", $post);
     $this->files = $files;
     $this->postVars = new ArrayList("MovicoPostVar");
     foreach ($post as $name => $value) {
         if (String::create($name)->startsWith("#")) {
             $type = isset($post[self::TYPE_PREFIX . $name]) ? $post[self::TYPE_PREFIX . $name] : self::DEFAULT_TYPE;
             $this->postVars->add(new MovicoPostVar($name, $value, $type));
         }
     }
 }
开发者ID:aeberh,项目名称:php-movico,代码行数:13,代码来源:MovicoRequest.php

示例8: getXmlElement

 private function getXmlElement(SimpleXMLElement $el)
 {
     $result = new XmlElement(String::create($el->getName()));
     $result->setText(String::create($el));
     foreach ($el->children() as $child) {
         $xmlChild = $this->getXmlElement($child);
         $xmlChild->setParent($result);
         $result->addChild($xmlChild);
     }
     foreach ($el->attributes() as $name => $val) {
         $result->addAttribute($name, (string) $val);
     }
     return $result;
 }
开发者ID:aeberh,项目名称:php-movico,代码行数:14,代码来源:SimpleXmlFactory.php

示例9: getXmlElement

 private function getXmlElement(DOMElement $el)
 {
     $result = new XmlElement(String::create($el->tagName));
     for ($i = 0; $i < $el->childNodes->length; $i++) {
         $child = $el->childNodes->item($i);
         if ($child instanceof DOMText) {
             $result->setText(String::create($child->textContent));
         } elseif ($child instanceof DOMElement) {
             $xmlChild = $this->getXmlElement($child);
             $xmlChild->setParent($result);
             $result->addChild($xmlChild);
         }
     }
     for ($i = 0; $i < $el->attributes->length; $i++) {
         $attr = $el->attributes->item($i);
         $result->addAttribute($attr->nodeName, $attr->nodeValue);
     }
     return $result;
 }
开发者ID:aeberh,项目名称:php-movico,代码行数:19,代码来源:DOMXmlFactory.php

示例10: verifyXmlContents

 private function verifyXmlContents(XmlFactory $xmlFactory)
 {
     $xmlString = "<root><element1 attribute1=\"value1\" attribute2=\"value2\"/><element2><child>bla</child></element2></root>";
     $file = $xmlFactory->fromString(String::create($xmlString));
     $this->assertEqual("root", $file->getRootElement()->getName());
     $root = $file->getRootElement();
     $this->assertEqual(2, $root->getNbChildren());
     $this->assertEqual(1, $root->getNbChildren("element1"));
     $children = $root->getChildren();
     $el1 = $children->getFirst();
     $this->assertEqual("element1", $el1->getName());
     $this->assertEqual(2, $el1->getNbAttributes());
     $this->assertEqual("value1", $el1->getAttribute("attribute1"));
     $this->assertEqual("value2", $el1->getAttribute("attribute2"));
     $el2 = $children->getLast();
     $this->assertEqual("element2", $el2->getName());
     $child = $el2->getChildren()->getFirst();
     $this->assertEqual("bla", $child->getText());
     $this->assertEqual("element2", $child->getParent()->getName());
     $this->assertEqual($xmlString, $root->asXml());
     $this->assertEqual(1, $root->getNbDescendants("child"));
 }
开发者ID:aeberh,项目名称:php-movico,代码行数:22,代码来源:XmlTest.php

示例11: match

 /**
  * Matches a string against this regex
  * @param string $input string to matcht he regex against
  * @return array|boolean Array of matching results. False if does not match
  */
 public function match($input)
 {
     String::create($input);
     return preg_match($this->value, $input->value, $matches) ? $matches : false;
 }
开发者ID:sntools,项目名称:types,代码行数:10,代码来源:Regex.php

示例12: getCurrentColumnClass

 protected function getCurrentColumnClass($i)
 {
     $this->classList = String::create($this->columnClasses)->split(",");
     return $this->classList->get($i % $this->classList->size())->getPrimitive();
 }
开发者ID:aeberh,项目名称:php-movico,代码行数:5,代码来源:DataSeries.php

示例13: __construct

 public function __construct($expression)
 {
     $this->expression = String::create($expression);
 }
开发者ID:aeberh,项目名称:php-movico,代码行数:4,代码来源:BindingExpression.php

示例14: str

 private static function str($description = null, $source = null)
 {
     return String::create('validation/error:notEmpty', 'Should be not empty', $description, $source);
 }
开发者ID:magomogo,项目名称:translator-utils,代码行数:4,代码来源:StringTest.php

示例15: shouldBeRendered

 public function shouldBeRendered($index)
 {
     $renderedStr = String::create($this->rendered);
     if ($renderedStr->contains("!")) {
         return !$this->getConvertedValue($renderedStr->replace("!", "")->__toString(), $index);
     } else {
         return $this->getConvertedValue($this->rendered, $index);
     }
 }
开发者ID:aeberh,项目名称:php-movico,代码行数:9,代码来源:Component.php


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