diff --git a/.github/workflows/odfvalidator.yml b/.github/workflows/odfvalidator.yml new file mode 100644 index 000000000..a39fd9bec --- /dev/null +++ b/.github/workflows/odfvalidator.yml @@ -0,0 +1,26 @@ +name: ODFValidator +on: [push, pull_request] +jobs: + php-cs-fixer: + name: ODFValidator + runs-on: ubuntu-latest + steps: + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '7.4' + extensions: mbstring, intl, gd, xml, dom, json, fileinfo, curl, zip, iconv + - uses: actions/checkout@v2 + + - name: Composer Install + run: composer install --ansi --prefer-dist --no-interaction --no-progress + + - name: Generate samples files + run: composer run samples + + - name: Download ODFValidator + run: wget https://repo1.maven.org/maven2/org/odftoolkit/odfvalidator/1.0.0-BETA1/odfvalidator-1.0.0-BETA1-jar-with-dependencies.jar + + # https://odftoolkit.org/conformance/ODFValidator.html#what-is-checked + - name: Validate documents (ODF 1.2) + run: java -jar odfvalidator-1.0.0-BETA1-jar-with-dependencies.jar -1.2 -r samples/results/ \ No newline at end of file diff --git a/samples/Sample_03_Image.php b/samples/Sample_03_Image.php index 888c5ba97..02a0032a2 100644 --- a/samples/Sample_03_Image.php +++ b/samples/Sample_03_Image.php @@ -35,7 +35,8 @@ // Add a file drawing (GIF) to the slide $shape = new Drawing\File(); -$shape->setName('Image File') +$shape + ->setName('Image File') ->setDescription('Image File') ->setPath(__DIR__ . '/resources/phppowerpoint_logo.gif') ->setHeight(36) diff --git a/src/PhpPresentation/DocumentProperties.php b/src/PhpPresentation/DocumentProperties.php index bd0b4a8b6..1fd6fde40 100644 --- a/src/PhpPresentation/DocumentProperties.php +++ b/src/PhpPresentation/DocumentProperties.php @@ -19,9 +19,6 @@ namespace PhpOffice\PhpPresentation; -/** - * \PhpOffice\PhpPresentation\DocumentProperties. - */ class DocumentProperties { public const PROPERTY_TYPE_BOOLEAN = 'b'; @@ -36,14 +33,14 @@ class DocumentProperties * * @var string */ - private $creator; + private $creator = 'Unknown Creator'; /** * LastModifiedBy. * * @var string */ - private $lastModifiedBy; + private $lastModifiedBy = 'Unknown Creator'; /** * Created. @@ -64,56 +61,56 @@ class DocumentProperties * * @var string */ - private $title; + private $title = 'Untitled Presentation'; /** * Description. * * @var string */ - private $description; + private $description = ''; /** * Subject. * * @var string */ - private $subject; + private $subject = ''; /** * Keywords. * * @var string */ - private $keywords; + private $keywords = ''; /** * Category. * * @var string */ - private $category; + private $category = ''; /** * Company. * * @var string */ - private $company; + private $company = 'Unknown Company'; /** * Revision. * * @var string */ - private $revision; + private $revision = ''; /** * Status. * * @var string */ - private $status; + private $status = ''; /** * Custom Properties. @@ -125,21 +122,12 @@ class DocumentProperties /** * Create a new \PhpOffice\PhpPresentation\DocumentProperties. */ + private $generator = ''; + public function __construct() { - // Initialise values - $this->creator = 'Unknown Creator'; - $this->lastModifiedBy = $this->creator; $this->created = time(); $this->modified = time(); - $this->title = 'Untitled Presentation'; - $this->subject = ''; - $this->description = ''; - $this->keywords = ''; - $this->category = ''; - $this->company = 'Microsoft Corporation'; - $this->revision = ''; - $this->status = ''; } /** @@ -147,7 +135,7 @@ public function __construct() * * @return string */ - public function getCreator() + public function getCreator(): string { return $this->creator; } @@ -157,9 +145,9 @@ public function getCreator() * * @param string $pValue * - * @return DocumentProperties + * @return self */ - public function setCreator($pValue = '') + public function setCreator(string $pValue = ''): self { $this->creator = $pValue; @@ -171,7 +159,7 @@ public function setCreator($pValue = '') * * @return string */ - public function getLastModifiedBy() + public function getLastModifiedBy(): string { return $this->lastModifiedBy; } @@ -181,9 +169,9 @@ public function getLastModifiedBy() * * @param string $pValue * - * @return DocumentProperties + * @return self */ - public function setLastModifiedBy($pValue = '') + public function setLastModifiedBy(string $pValue = ''): self { $this->lastModifiedBy = $pValue; @@ -195,7 +183,7 @@ public function setLastModifiedBy($pValue = '') * * @return int */ - public function getCreated() + public function getCreated(): int { return $this->created; } @@ -205,9 +193,9 @@ public function getCreated() * * @param int $pValue * - * @return DocumentProperties + * @return self */ - public function setCreated($pValue = null) + public function setCreated(int $pValue = null): self { if (null === $pValue) { $pValue = time(); @@ -222,7 +210,7 @@ public function setCreated($pValue = null) * * @return int */ - public function getModified() + public function getModified(): int { return $this->modified; } @@ -232,9 +220,9 @@ public function getModified() * * @param int $pValue * - * @return DocumentProperties + * @return self */ - public function setModified($pValue = null) + public function setModified(int $pValue = null): self { if (null === $pValue) { $pValue = time(); @@ -249,7 +237,7 @@ public function setModified($pValue = null) * * @return string */ - public function getTitle() + public function getTitle(): string { return $this->title; } @@ -259,9 +247,9 @@ public function getTitle() * * @param string $pValue * - * @return DocumentProperties + * @return self */ - public function setTitle($pValue = '') + public function setTitle(string $pValue = ''): self { $this->title = $pValue; @@ -273,7 +261,7 @@ public function setTitle($pValue = '') * * @return string */ - public function getDescription() + public function getDescription(): string { return $this->description; } @@ -283,9 +271,9 @@ public function getDescription() * * @param string $pValue * - * @return DocumentProperties + * @return self */ - public function setDescription($pValue = '') + public function setDescription(string $pValue = ''): self { $this->description = $pValue; @@ -297,7 +285,7 @@ public function setDescription($pValue = '') * * @return string */ - public function getSubject() + public function getSubject(): string { return $this->subject; } @@ -307,9 +295,9 @@ public function getSubject() * * @param string $pValue * - * @return DocumentProperties + * @return self */ - public function setSubject($pValue = '') + public function setSubject(string $pValue = ''): self { $this->subject = $pValue; @@ -321,7 +309,7 @@ public function setSubject($pValue = '') * * @return string */ - public function getKeywords() + public function getKeywords(): string { return $this->keywords; } @@ -331,9 +319,9 @@ public function getKeywords() * * @param string $pValue * - * @return DocumentProperties + * @return self */ - public function setKeywords($pValue = '') + public function setKeywords(string $pValue = ''): self { $this->keywords = $pValue; @@ -345,7 +333,7 @@ public function setKeywords($pValue = '') * * @return string */ - public function getCategory() + public function getCategory(): string { return $this->category; } @@ -355,9 +343,9 @@ public function getCategory() * * @param string $pValue * - * @return DocumentProperties + * @return self */ - public function setCategory($pValue = '') + public function setCategory(string $pValue = ''): self { $this->category = $pValue; @@ -369,7 +357,7 @@ public function setCategory($pValue = '') * * @return string */ - public function getCompany() + public function getCompany(): string { return $this->company; } @@ -379,9 +367,9 @@ public function getCompany() * * @param string $pValue * - * @return DocumentProperties + * @return self */ - public function setCompany($pValue = '') + public function setCompany(string $pValue = ''): self { $this->company = $pValue; @@ -505,4 +493,28 @@ public function setStatus(string $pValue = ''): self return $this; } + + /** + * Get Generator. + * + * @return string + */ + public function getGenerator(): string + { + return $this->generator; + } + + /** + * Set Generator. + * + * @param string $pValue + * + * @return self + */ + public function setGenerator(string $pValue = ''): self + { + $this->generator = $pValue; + + return $this; + } } diff --git a/src/PhpPresentation/Writer/ODPresentation.php b/src/PhpPresentation/Writer/ODPresentation.php index f142fe06c..590db07a8 100644 --- a/src/PhpPresentation/Writer/ODPresentation.php +++ b/src/PhpPresentation/Writer/ODPresentation.php @@ -19,7 +19,6 @@ namespace PhpOffice\PhpPresentation\Writer; -use DirectoryIterator; use PhpOffice\Common\Adapter\Zip\ZipArchiveAdapter; use PhpOffice\PhpPresentation\Exception\DirectoryNotFoundException; use PhpOffice\PhpPresentation\Exception\FileCopyException; @@ -98,26 +97,17 @@ public function save(string $pFilename): void $oPresentation = $this->getPhpPresentation(); $arrayChart = []; - $arrayFiles = []; - $oDir = new DirectoryIterator(__DIR__ . DIRECTORY_SEPARATOR . 'ODPresentation'); - foreach ($oDir as $oFile) { - if (!$oFile->isFile()) { - continue; - } - - $class = __NAMESPACE__ . '\\ODPresentation\\' . $oFile->getBasename('.php'); - $class = new ReflectionClass($class); - - if ($class->isAbstract() || !$class->isSubclassOf('PhpOffice\PhpPresentation\Writer\ODPresentation\AbstractDecoratorWriter')) { - continue; - } - $arrayFiles[$oFile->getBasename('.php')] = $class; - } - - ksort($arrayFiles); - - foreach ($arrayFiles as $o) { - $oService = $o->newInstance(); + foreach ([ + __CLASS__ . '\Mimetype', + __CLASS__ . '\Content', + __CLASS__ . '\Meta', + __CLASS__ . '\MetaInfManifest', + __CLASS__ . '\ObjectsChart', + __CLASS__ . '\Pictures', + __CLASS__ . '\Styles', + __CLASS__ . '\ThumbnailsThumbnail', + ] as $class) { + $oService = new $class(); $oService->setZip($oZip); $oService->setPresentation($oPresentation); $oService->setDrawingHashTable($this->getDrawingHashTable()); diff --git a/src/PhpPresentation/Writer/ODPresentation/Meta.php b/src/PhpPresentation/Writer/ODPresentation/Meta.php index cc1ca03ab..40dc87b3a 100644 --- a/src/PhpPresentation/Writer/ODPresentation/Meta.php +++ b/src/PhpPresentation/Writer/ODPresentation/Meta.php @@ -65,6 +65,8 @@ public function render(): ZipInterface $objWriter->writeElement('meta:initial-creator', $this->getPresentation()->getDocumentProperties()->getCreator()); // meta:keyword $objWriter->writeElement('meta:keyword', $this->getPresentation()->getDocumentProperties()->getKeywords()); + // meta:generator + $objWriter->writeElement('meta:generator', $this->getPresentation()->getDocumentProperties()->getGenerator()); // meta:user-defined $oDocumentProperties = $this->oPresentation->getDocumentProperties(); diff --git a/tests/PhpPresentation/Tests/DocumentPropertiesTest.php b/tests/PhpPresentation/Tests/DocumentPropertiesTest.php index dd2a4d922..caa4346e2 100644 --- a/tests/PhpPresentation/Tests/DocumentPropertiesTest.php +++ b/tests/PhpPresentation/Tests/DocumentPropertiesTest.php @@ -38,8 +38,6 @@ public function testGetSet(): void $properties = [ 'creator' => '', 'lastModifiedBy' => '', - 'created' => '', - 'modified' => '', 'title' => '', 'description' => '', 'subject' => '', @@ -48,6 +46,7 @@ public function testGetSet(): void 'company' => '', 'revision' => '', 'status' => '', + 'generator' => '', ]; foreach ($properties as $key => $val) { @@ -89,43 +88,43 @@ public function testCustomProperties(): void self::assertNull($object->getCustomPropertyType('pName')); self::assertNull($object->getCustomPropertyValue('pName')); - self::assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentProperties', $object->setCustomProperty('pName', 'pValue', null)); + self::assertInstanceOf(DocumentProperties::class, $object->setCustomProperty('pName', 'pValue', null)); self::assertCount(1, $object->getCustomProperties()); self::assertTrue($object->isCustomPropertySet('pName')); self::assertEquals(DocumentProperties::PROPERTY_TYPE_STRING, $object->getCustomPropertyType('pName')); self::assertEquals('pValue', $object->getCustomPropertyValue('pName')); - self::assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentProperties', $object->setCustomProperty('pName', 2, null)); + self::assertInstanceOf(DocumentProperties::class, $object->setCustomProperty('pName', 2, null)); self::assertCount(1, $object->getCustomProperties()); self::assertTrue($object->isCustomPropertySet('pName')); self::assertEquals(DocumentProperties::PROPERTY_TYPE_INTEGER, $object->getCustomPropertyType('pName')); self::assertEquals(2, $object->getCustomPropertyValue('pName')); - self::assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentProperties', $object->setCustomProperty('pName', 2.1, null)); + self::assertInstanceOf(DocumentProperties::class, $object->setCustomProperty('pName', 2.1, null)); self::assertCount(1, $object->getCustomProperties()); self::assertTrue($object->isCustomPropertySet('pName')); self::assertEquals(DocumentProperties::PROPERTY_TYPE_FLOAT, $object->getCustomPropertyType('pName')); self::assertEquals(2.1, $object->getCustomPropertyValue('pName')); - self::assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentProperties', $object->setCustomProperty('pName', true, null)); + self::assertInstanceOf(DocumentProperties::class, $object->setCustomProperty('pName', true, null)); self::assertCount(1, $object->getCustomProperties()); self::assertTrue($object->isCustomPropertySet('pName')); self::assertEquals(DocumentProperties::PROPERTY_TYPE_BOOLEAN, $object->getCustomPropertyType('pName')); self::assertTrue($object->getCustomPropertyValue('pName')); - self::assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentProperties', $object->setCustomProperty('pName', null, null)); + self::assertInstanceOf(DocumentProperties::class, $object->setCustomProperty('pName', null, null)); self::assertCount(1, $object->getCustomProperties()); self::assertTrue($object->isCustomPropertySet('pName')); self::assertEquals(DocumentProperties::PROPERTY_TYPE_STRING, $object->getCustomPropertyType('pName')); self::assertNull($object->getCustomPropertyValue('pName')); - self::assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentProperties', $object->setCustomProperty('pName', $valueTime, DocumentProperties::PROPERTY_TYPE_DATE)); + self::assertInstanceOf(DocumentProperties::class, $object->setCustomProperty('pName', $valueTime, DocumentProperties::PROPERTY_TYPE_DATE)); self::assertCount(1, $object->getCustomProperties()); self::assertTrue($object->isCustomPropertySet('pName')); self::assertEquals(DocumentProperties::PROPERTY_TYPE_DATE, $object->getCustomPropertyType('pName')); self::assertEquals($valueTime, $object->getCustomPropertyValue('pName')); - self::assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentProperties', $object->setCustomProperty('pName', (string) $valueTime, DocumentProperties::PROPERTY_TYPE_UNKNOWN)); + self::assertInstanceOf(DocumentProperties::class, $object->setCustomProperty('pName', (string) $valueTime, DocumentProperties::PROPERTY_TYPE_UNKNOWN)); self::assertCount(1, $object->getCustomProperties()); self::assertTrue($object->isCustomPropertySet('pName')); self::assertEquals(DocumentProperties::PROPERTY_TYPE_STRING, $object->getCustomPropertyType('pName')); diff --git a/tests/PhpPresentation/Tests/Writer/ODPresentation/MetaTest.php b/tests/PhpPresentation/Tests/Writer/ODPresentation/MetaTest.php index e3dd0723b..f1a0844ca 100644 --- a/tests/PhpPresentation/Tests/Writer/ODPresentation/MetaTest.php +++ b/tests/PhpPresentation/Tests/Writer/ODPresentation/MetaTest.php @@ -1,31 +1,94 @@ assertZipXmlElementExists('meta.xml', $element); + $element = '/office:document-meta/office:meta/dc:creator'; + $this->assertZipXmlElementExists('meta.xml', $element); + $this->assertZipXmlElementEquals('meta.xml', $element, 'Unknown Creator'); + $element = '/office:document-meta/office:meta/dc:date'; + $this->assertZipXmlElementExists('meta.xml', $element); + $this->assertZipXmlElementEquals('meta.xml', $element, gmdate('Y-m-d\TH:i:s.000', $this->oPresentation->getDocumentProperties()->getModified())); + $element = '/office:document-meta/office:meta/dc:description'; + $this->assertZipXmlElementExists('meta.xml', $element); + $this->assertZipXmlElementEquals('meta.xml', $element, ''); + $element = '/office:document-meta/office:meta/dc:subject'; + $this->assertZipXmlElementExists('meta.xml', $element); + $this->assertZipXmlElementEquals('meta.xml', $element, ''); + $element = '/office:document-meta/office:meta/dc:title'; + $this->assertZipXmlElementExists('meta.xml', $element); + $this->assertZipXmlElementEquals('meta.xml', $element, 'Untitled Presentation'); + $element = '/office:document-meta/office:meta/meta:creation-date'; + $this->assertZipXmlElementExists('meta.xml', $element); + $this->assertZipXmlElementEquals('meta.xml', $element, gmdate('Y-m-d\TH:i:s.000', $this->oPresentation->getDocumentProperties()->getCreated())); + $element = '/office:document-meta/office:meta/meta:initial-creator'; + $this->assertZipXmlElementExists('meta.xml', $element); + $this->assertZipXmlElementEquals('meta.xml', $element, 'Unknown Creator'); + $element = '/office:document-meta/office:meta/meta:keyword'; + $this->assertZipXmlElementExists('meta.xml', $element); + $this->assertZipXmlElementEquals('meta.xml', $element, ''); + $element = '/office:document-meta/office:meta/meta:generator'; + $this->assertZipXmlElementExists('meta.xml', $element); + $this->assertZipXmlElementEquals('meta.xml', $element, ''); + + $this->assertIsSchemaOpenDocumentValid('1.2'); + + $this->oPresentation->getDocumentProperties() + ->setCreator('AlphaCreator') + ->setDescription('BetaDescription') + ->setSubject('GammaSubject') + ->setTitle('DeltaTitle') + ->setKeywords('EpsilonKeyword') + ->setGenerator('ZĂȘtaGenerator') + ->setLastModifiedBy('ÊtaModifier') + ; + $this->resetPresentationFile(); + + $element = '/office:document-meta/office:meta'; + $this->assertZipXmlElementExists('meta.xml', $element); + $element = '/office:document-meta/office:meta/dc:creator'; + $this->assertZipXmlElementExists('meta.xml', $element); + $this->assertZipXmlElementEquals('meta.xml', $element, $this->oPresentation->getDocumentProperties()->getLastModifiedBy()); + $element = '/office:document-meta/office:meta/dc:date'; + $this->assertZipXmlElementExists('meta.xml', $element); + $this->assertZipXmlElementEquals('meta.xml', $element, gmdate('Y-m-d\TH:i:s.000', $this->oPresentation->getDocumentProperties()->getModified())); + $element = '/office:document-meta/office:meta/dc:description'; + $this->assertZipXmlElementExists('meta.xml', $element); + $this->assertZipXmlElementEquals('meta.xml', $element, $this->oPresentation->getDocumentProperties()->getDescription()); + $element = '/office:document-meta/office:meta/dc:subject'; + $this->assertZipXmlElementExists('meta.xml', $element); + $this->assertZipXmlElementEquals('meta.xml', $element, $this->oPresentation->getDocumentProperties()->getSubject()); + $element = '/office:document-meta/office:meta/dc:title'; + $this->assertZipXmlElementExists('meta.xml', $element); + $this->assertZipXmlElementEquals('meta.xml', $element, $this->oPresentation->getDocumentProperties()->getTitle()); + $element = '/office:document-meta/office:meta/meta:creation-date'; + $this->assertZipXmlElementExists('meta.xml', $element); + $this->assertZipXmlElementEquals('meta.xml', $element, gmdate('Y-m-d\TH:i:s.000', $this->oPresentation->getDocumentProperties()->getCreated())); + $element = '/office:document-meta/office:meta/meta:initial-creator'; + $this->assertZipXmlElementExists('meta.xml', $element); + $this->assertZipXmlElementEquals('meta.xml', $element, $this->oPresentation->getDocumentProperties()->getCreator()); + $element = '/office:document-meta/office:meta/meta:keyword'; + $this->assertZipXmlElementExists('meta.xml', $element); + $this->assertZipXmlElementEquals('meta.xml', $element, $this->oPresentation->getDocumentProperties()->getKeywords()); + $element = '/office:document-meta/office:meta/meta:generator'; + $this->assertZipXmlElementExists('meta.xml', $element); + $this->assertZipXmlElementEquals('meta.xml', $element, $this->oPresentation->getDocumentProperties()->getGenerator()); + } + /** * @dataProvider dataProviderCustomProperties * diff --git a/tests/PhpPresentation/Tests/Writer/ODPresentationTest.php b/tests/PhpPresentation/Tests/Writer/ODPresentationTest.php index 52f4e47c9..9a693bbbb 100644 --- a/tests/PhpPresentation/Tests/Writer/ODPresentationTest.php +++ b/tests/PhpPresentation/Tests/Writer/ODPresentationTest.php @@ -123,4 +123,10 @@ public function testFeatureThumbnail(): void $this->assertZipFileExists('META-INF/manifest.xml'); $this->assertZipXmlElementExists('META-INF/manifest.xml', $xPathManifest); } + + public function testOrderFileInZip(): void + { + $this->assertZipFileExists('mimetype'); + $this->assertZipFilePositionEquals('mimetype', 0); + } } diff --git a/tests/PhpPresentation/Tests/_includes/PhpPresentationTestCase.php b/tests/PhpPresentation/Tests/_includes/PhpPresentationTestCase.php index 120ffe0c9..4abee1106 100644 --- a/tests/PhpPresentation/Tests/_includes/PhpPresentationTestCase.php +++ b/tests/PhpPresentation/Tests/_includes/PhpPresentationTestCase.php @@ -200,10 +200,7 @@ private function getXmlNodeList(string $file, string $xpath): DOMNodeList return $this->xmlXPath->query($xpath); } - /** - * @param string $writerName - */ - protected function writePresentationFile(PhpPresentation $oPhpPresentation, $writerName): void + protected function writePresentationFile(PhpPresentation $oPhpPresentation, string $writerName): void { if (is_file($this->filePath)) { return; @@ -239,7 +236,7 @@ protected function resetPresentationFile(): void /** * @param string $filePath */ - public function assertZipFileExists($filePath): void + public function assertZipFileExists(string $filePath): void { $this->writePresentationFile($this->oPresentation, $this->writerName); self::assertTrue(is_file($this->workDirectory . $filePath)); @@ -248,17 +245,33 @@ public function assertZipFileExists($filePath): void /** * @param string $filePath */ - public function assertZipFileNotExists($filePath): void + public function assertZipFileNotExists(string $filePath): void { $this->writePresentationFile($this->oPresentation, $this->writerName); self::assertFalse(is_file($this->workDirectory . $filePath)); } + /** + * @param string $filePath + */ + public function assertZipFilePositionEquals(string $filePath, int $position): void + { + $xmlWriter = IOFactory::createWriter($this->oPresentation, $this->writerName); + $xmlWriter->save($this->filePath); + + $zip = new \ZipArchive(); + $res = $zip->open($this->filePath); + self::assertTrue($res); + $actualPosition = $zip->locateName($filePath); + self::assertIsInt($actualPosition); + self::assertSame($actualPosition, $position); + } + /** * @param string $filePath * @param string $xPath */ - public function assertZipXmlElementExists($filePath, $xPath): void + public function assertZipXmlElementExists(string $filePath, string $xPath): void { $this->writePresentationFile($this->oPresentation, $this->writerName); $nodeList = $this->getXmlNodeList($filePath, $xPath); @@ -293,7 +306,7 @@ public function assertZipXmlElementAtIndexExists(string $filePath, string $xPath * @param string $filePath * @param string $xPath */ - public function assertZipXmlElementNotExists($filePath, $xPath): void + public function assertZipXmlElementNotExists(string $filePath, string $xPath): void { $this->writePresentationFile($this->oPresentation, $this->writerName); $nodeList = $this->getXmlNodeList($filePath, $xPath); @@ -313,7 +326,7 @@ public function assertZipXmlElementNotExists($filePath, $xPath): void * @param string $xPath * @param mixed $value */ - public function assertZipXmlElementEquals($filePath, $xPath, $value): void + public function assertZipXmlElementEquals(string $filePath, string $xPath, $value): void { $this->writePresentationFile($this->oPresentation, $this->writerName); $nodeList = $this->getXmlNodeList($filePath, $xPath); @@ -347,7 +360,7 @@ public function assertZipXmlElementAtIndexEquals(string $filePath, string $xPath * @param string $xPath * @param int $num */ - public function assertZipXmlElementCount($filePath, $xPath, $num): void + public function assertZipXmlElementCount(string $filePath, string $xPath, int $num): void { $this->writePresentationFile($this->oPresentation, $this->writerName); $nodeList = $this->getXmlNodeList($filePath, $xPath); @@ -360,7 +373,7 @@ public function assertZipXmlElementCount($filePath, $xPath, $num): void * @param string $attribute * @param mixed $value */ - public function assertZipXmlAttributeEquals($filePath, $xPath, $attribute, $value): void + public function assertZipXmlAttributeEquals(string $filePath, string $xPath, string $attribute, $value): void { $this->writePresentationFile($this->oPresentation, $this->writerName); $nodeList = $this->getXmlNodeList($filePath, $xPath); @@ -376,7 +389,7 @@ public function assertZipXmlAttributeEquals($filePath, $xPath, $attribute, $valu * @param string $attribute * @param mixed $value */ - public function assertZipXmlAttributeStartsWith($filePath, $xPath, $attribute, $value): void + public function assertZipXmlAttributeStartsWith(string $filePath, string $xPath, string $attribute, $value): void { $this->writePresentationFile($this->oPresentation, $this->writerName); $nodeList = $this->getXmlNodeList($filePath, $xPath); @@ -392,7 +405,7 @@ public function assertZipXmlAttributeStartsWith($filePath, $xPath, $attribute, $ * @param string $attribute * @param mixed $value */ - public function assertZipXmlAttributeEndsWith($filePath, $xPath, $attribute, $value): void + public function assertZipXmlAttributeEndsWith(string $filePath, string $xPath, string $attribute, $value): void { $this->writePresentationFile($this->oPresentation, $this->writerName); $nodeList = $this->getXmlNodeList($filePath, $xPath); @@ -408,7 +421,7 @@ public function assertZipXmlAttributeEndsWith($filePath, $xPath, $attribute, $va * @param string $attribute * @param mixed $value */ - public function assertZipXmlAttributeContains($filePath, $xPath, $attribute, $value): void + public function assertZipXmlAttributeContains(string $filePath, string $xPath, string $attribute, $value): void { $this->writePresentationFile($this->oPresentation, $this->writerName); $nodeList = $this->getXmlNodeList($filePath, $xPath); @@ -423,7 +436,7 @@ public function assertZipXmlAttributeContains($filePath, $xPath, $attribute, $va * @param string $xPath * @param string $attribute */ - public function assertZipXmlAttributeExists($filePath, $xPath, $attribute): void + public function assertZipXmlAttributeExists(string $filePath, string $xPath, string $attribute): void { $this->writePresentationFile($this->oPresentation, $this->writerName); $nodeList = $this->getXmlNodeList($filePath, $xPath); @@ -438,7 +451,7 @@ public function assertZipXmlAttributeExists($filePath, $xPath, $attribute): void * @param string $xPath * @param string $attribute */ - public function assertZipXmlAttributeNotExists($filePath, $xPath, $attribute): void + public function assertZipXmlAttributeNotExists(string $filePath, string $xPath, string $attribute): void { $this->writePresentationFile($this->oPresentation, $this->writerName); $nodeList = $this->getXmlNodeList($filePath, $xPath);