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