コード例 #1
0
 /**
  * {@inheritdoc}
  */
 public function support(InputStreamInterface $input)
 {
     if (false === $input->markSupported()) {
         throw new IOException(sprintf("Class %s does not support mark().", get_class($input)));
     }
     return true;
 }
コード例 #2
0
 /**
  * {@inheritdoc}
  */
 public function resolve(InputStreamInterface $input)
 {
     $resolvedStream = null;
     $resolvedFactory = null;
     if (false === $input->markSupported()) {
         $input = new BufferedInputStream($input);
     }
     foreach ($this->factories as $factory) {
         if (true === $factory->support($input)) {
             $resolvedFactory = $factory;
             break;
         }
     }
     if (null !== $resolvedFactory) {
         $resolvedStream = $resolvedFactory->create($input);
     }
     return $resolvedStream;
 }