コード例 #1
0
 private function writeResult()
 {
     // If the chain is configured to return data, return data from given stream(s) as a string or indexed array
     if (!property_exists($this->configuration, 'return')) {
         return null;
     }
     if (is_string($this->configuration->return)) {
         $this->result = $this->streamHolder->getData($this->configuration->return);
     } elseif (is_array($this->configuration->return)) {
         $dataArray = array();
         foreach ($this->configuration->return as $streamId) {
             $dataArray[$streamId] = $this->streamHolder->getData($streamId);
         }
         $this->result = $dataArray;
     } elseif (is_object($this->configuration->return)) {
         $dataArray = array();
         foreach ($this->configuration->return as $exportId => $streamId) {
             $dataArray[$exportId] = $this->streamHolder->getData($streamId);
         }
         $this->result = $dataArray;
     } else {
         $this->result = null;
     }
 }
コード例 #2
0
ファイル: FilterTest.php プロジェクト: actinarium/philtre
 public function testFilterOperationInStreamedContext()
 {
     $context = new StreamedFilterContext();
     $context->setData('IN1', 'testing');
     $context->setData('IN2', 'Testing');
     $stream1Before = $context->getStream('IN1');
     $stream2Before = $context->getStream('IN2');
     $filter = new FixtureFilter($context, array("suffix" => "123"));
     $filter->process();
     $this->assertEquals('testing', $context->getData('IN1'));
     $this->assertEquals('testing', $context->getStream('IN1')->getData());
     $this->assertEquals('Testing_testing', $context->getData('IN2'));
     $this->assertEquals('Testing_testing', $context->getStream('IN2')->getData());
     $this->assertEquals('testing_Testing_123', $context->getData('OUT'));
     $this->assertEquals('testing_Testing_123', $context->getStream('OUT')->getData());
     $this->assertSame($stream1Before, $context->getStream('IN1'));
     $this->assertNotSame($stream2Before, $context->getStream('IN2'));
 }
コード例 #3
0
ファイル: ContextsTest.php プロジェクト: actinarium/philtre
 /**
  * @expectedException \Actinarium\Philtre\Core\Exceptions\UnregisteredStreamException
  */
 public function testStreamedContextFailsWhenUnregisteredStreamRequestedAsStream()
 {
     $context = new StreamedFilterContext();
     $context->getStream(TEST);
 }