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


PHP Streams::readableUri方法代码示例

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


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

示例1: getDom

 /**
  * Returns a DOM object for this response's contents. Lazy/Cached.
  *
  * @return  php.DOMDocument
  */
 public function getDom()
 {
     if (NULL === $this->dom) {
         $this->dom = new DOMDocument();
         @$this->dom->loadHTMLFile(Streams::readableUri($this->response->getInputStream()));
     }
     return $this->dom;
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:13,代码来源:WebTestCase.class.php

示例2: usableInLoad

 public function usableInLoad()
 {
     $dom = new \DOMDocument();
     $this->assertTrue($dom->load(Streams::readableUri(new MemoryInputStream(trim('
   <?xml version="1.0" encoding="utf-8"?>
   <root>
     <child>übercoder</child>
   </root>
 ')))));
     $this->assertEquals('übercoder', $dom->getElementsByTagName('child')->item(0)->nodeValue);
 }
开发者ID:xp-framework,项目名称:core,代码行数:11,代码来源:DomApiStreamsTest.class.php

示例3: __construct

 /**
  * Constructor
  *
  * @param   var stream either an io.streams.InputStream or an io.Stream (BC)
  * @throws  lang.IllegalArgumentException when types are not met
  */
 public function __construct($stream)
 {
     $this->stream = deref($stream);
     if ($this->stream instanceof InputStream) {
         if ($this instanceof img·io·UriReader && !self::$GD_USERSTREAMS_BUG) {
             $this->reader = function ($reader, $stream) {
                 return $reader->readImageFromUri(Streams::readableUri($stream));
             };
         } else {
             $this->reader = function ($reader, $stream) {
                 $bytes = '';
                 while ($stream->available() > 0) {
                     $bytes .= $stream->read();
                 }
                 $stream->close();
                 return $reader->readImageFromString($bytes);
             };
         }
     } else {
         if ($this->stream instanceof Stream) {
             if ($this instanceof img·io·UriReader && !self::$GD_USERSTREAMS_BUG) {
                 $this->reader = function ($reader, $stream) {
                     $stream->open(STREAM_MODE_READ);
                     return $reader->readImageFromUri($stream->getURI());
                 };
             } else {
                 $this->reader = function ($reader, $stream) {
                     $stream->open(STREAM_MODE_READ);
                     $bytes = '';
                     do {
                         $bytes .= $stream->read();
                     } while (!$stream->eof());
                     $stream->close();
                     return $reader->readImageFromString($bytes);
                 };
             }
         } else {
             throw new IllegalArgumentException('Expected either an io.streams.InputStream or an io.Stream, have ' . xp::typeOf($this->stream));
         }
     }
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:47,代码来源:StreamReader.class.php

示例4: unmarshalFrom

 /**
  * Unmarshal XML to an object
  *
  * @param   xml.parser.InputSource source
  * @param   string classname
  * @param   [:var] inject
  * @return  lang.Object
  * @throws  lang.ClassNotFoundException
  * @throws  xml.XMLFormatException
  * @throws  lang.reflect.TargetInvocationException
  * @throws  lang.IllegalArgumentException
  */
 public function unmarshalFrom(InputSource $input, $classname, $inject = array())
 {
     libxml_clear_errors();
     $doc = new DOMDocument();
     if (!$doc->load(Streams::readableUri($input->getStream()))) {
         $e = libxml_get_last_error();
         throw new XMLFormatException(trim($e->message), $e->code, $input->getSource(), $e->line, $e->column);
     }
     $xpath = new XPath($doc);
     // Class factory based on tag name, reference to a static method which is called with
     // the class name and returns an XPClass instance.
     $class = XPClass::forName($classname);
     if ($class->hasAnnotation('xmlmapping', 'factory')) {
         if ($class->hasAnnotation('xmlmapping', 'pass')) {
             $factoryArgs = array();
             foreach ($class->getAnnotation('xmlmapping', 'pass') as $pass) {
                 $factoryArgs[] = self::contentOf($xpath->query($pass, $doc->documentElement));
             }
         } else {
             $factoryArgs = array($doc->documentElement->nodeName);
         }
         $class = $class->getMethod($class->getAnnotation('xmlmapping', 'factory'))->invoke(NULL, $factoryArgs);
     }
     return self::recurse($xpath, $doc->documentElement, $class, $inject);
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:37,代码来源:Unmarshaller.class.php

示例5: readImage

 /**
  * Read an image
  *
  * @return  resource
  * @throws  img.ImagingException
  */
 public function readImage()
 {
     return $this->readImage0(Streams::readableUri($this->stream));
 }
开发者ID:Gamepay,项目名称:xp-framework,代码行数:10,代码来源:GifStreamReader.class.php

示例6: is_file

 public function is_file()
 {
     $this->assertTrue(is_file(Streams::readableUri(new MemoryInputStream('Hello'))));
 }
开发者ID:xp-framework,项目名称:core,代码行数:4,代码来源:StreamWrappingTest.class.php

示例7: largefileGetContents

 public function largefileGetContents()
 {
     $data = str_repeat('x', 16384);
     $this->assertEquals($data, file_get_contents(Streams::readableUri(new MemoryInputStream($data))));
 }
开发者ID:Gamepay,项目名称:xp-framework,代码行数:5,代码来源:StreamWrappingTest.class.php


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