public function getData($utf8 = true) { $property = $utf8 ? '_data_utf8' : '_data'; if ($this->{$property} === null) { $command = $this->getCommand(); $command->setOperation($utf8 ? 'dump_data_utf8' : 'dump_data'); if (!$command->execute()) { return false; } else { $this->{$property} = trim($command->getOutput()); } } return $this->{$property}; }
public function testCanGetData() { $document = $this->getDocument1(); $pdf = new Pdf($document); $data = $pdf->getData(); $this->assertInternalType('string', $data); $this->assertContains('NumberOfPages: 5', $data); }