diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 532c34a42..dd9be6be6 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -6,36 +6,215 @@ ->setUsingCache(true) ->setRiskyAllowed(true) ->setRules([ - '@Symfony' => true, + 'align_multiline_comment' => true, 'array_indentation' => true, - 'cast_spaces' => [ - 'space' => 'single', - ], + 'array_syntax' => ['syntax' => 'short'], + 'backtick_to_shell_exec' => true, + 'binary_operator_spaces' => true, + 'blank_line_after_namespace' => true, + 'blank_line_after_opening_tag' => true, + 'blank_line_before_statement' => true, + 'braces' => true, + 'cast_spaces' => true, + 'class_attributes_separation' => ['elements' => ['method' => 'one', 'property' => 'one']], // const are often grouped with other related const + 'class_definition' => false, + 'class_keyword_remove' => false, // ::class keyword gives us better support in IDE 'combine_consecutive_issets' => true, - 'concat_space' => [ - 'spacing' => 'one', - ], - 'error_suppression' => [ - 'mute_deprecation_error' => false, - 'noise_remaining_usages' => false, - 'noise_remaining_usages_exclude' => [], - ], - 'function_to_constant' => false, + 'combine_consecutive_unsets' => true, + 'combine_nested_dirname' => true, + 'comment_to_phpdoc' => false, // interferes with annotations + 'compact_nullable_typehint' => true, + 'concat_space' => ['spacing' => 'one'], + 'constant_case' => true, + 'date_time_immutable' => false, // Break our unit tests + 'declare_equal_normalize' => true, + 'declare_strict_types' => false, // Too early to adopt strict types + 'dir_constant' => true, + 'doctrine_annotation_array_assignment' => true, + 'doctrine_annotation_braces' => true, + 'doctrine_annotation_indentation' => true, + 'doctrine_annotation_spaces' => true, + 'elseif' => true, + 'encoding' => true, + 'ereg_to_preg' => true, + 'escape_implicit_backslashes' => true, + 'explicit_indirect_variable' => false, // I feel it makes the code actually harder to read + 'explicit_string_variable' => false, // I feel it makes the code actually harder to read + 'final_class' => false, // We need non-final classes + 'final_internal_class' => true, + 'final_public_method_for_abstract_class' => false, // We need non-final methods + 'fopen_flag_order' => true, + 'fopen_flags' => true, + 'full_opening_tag' => true, + 'fully_qualified_strict_types' => true, + 'function_declaration' => true, + 'function_to_constant' => true, + 'function_typehint_space' => true, + 'general_phpdoc_annotation_remove' => ['annotations' => ['access', 'category', 'copyright', 'throws']], + 'global_namespace_import' => true, + 'header_comment' => false, // We don't use common header in all our files + 'heredoc_indentation' => false, // Requires PHP >= 7.3 + 'heredoc_to_nowdoc' => false, // Not sure about this one + 'implode_call' => true, + 'include' => true, + 'increment_style' => true, + 'indentation_type' => true, + 'is_null' => true, + 'line_ending' => true, + 'linebreak_after_opening_tag' => true, + 'list_syntax' => ['syntax' => 'short'], + 'logical_operators' => true, + 'lowercase_cast' => true, + 'lowercase_keywords' => true, + 'lowercase_static_reference' => true, + 'magic_constant_casing' => true, + 'magic_method_casing' => true, + 'mb_str_functions' => false, // No, too dangerous to change that + 'method_argument_space' => true, 'method_chaining_indentation' => true, - 'no_alias_functions' => false, - 'no_superfluous_phpdoc_tags' => false, - 'non_printable_character' => [ - 'use_escape_sequences_in_strings' => true, - ], - 'phpdoc_align' => [ - 'align' => 'left', - ], - 'phpdoc_summary' => false, - 'protected_to_private' => false, - 'self_accessor' => false, + 'modernize_types_casting' => true, + 'multiline_comment_opening_closing' => true, + 'multiline_whitespace_before_semicolons' => true, + 'native_constant_invocation' => false, // Micro optimization that look messy + 'native_function_casing' => true, + 'native_function_invocation' => false, // I suppose this would be best, but I am still unconvinced about the visual aspect of it + 'native_function_type_declaration_casing' => true, + 'new_with_braces' => true, + 'no_alias_functions' => true, + 'no_alternative_syntax' => true, + 'no_binary_string' => true, + 'no_blank_lines_after_class_opening' => true, + 'no_blank_lines_after_phpdoc' => true, + 'no_blank_lines_before_namespace' => false, // we want 1 blank line before namespace + 'no_break_comment' => true, + 'no_closing_tag' => true, + 'no_empty_comment' => true, + 'no_empty_phpdoc' => true, + 'no_empty_statement' => true, + 'no_extra_blank_lines' => true, + 'no_homoglyph_names' => true, + 'no_leading_import_slash' => true, + 'no_leading_namespace_whitespace' => true, + 'no_mixed_echo_print' => true, + 'no_multiline_whitespace_around_double_arrow' => true, + 'no_null_property_initialization' => true, + 'no_php4_constructor' => true, + 'no_short_bool_cast' => true, + 'echo_tag_syntax' => ['format' => 'long'], + 'no_singleline_whitespace_before_semicolons' => true, + 'no_spaces_after_function_name' => true, + 'no_spaces_around_offset' => true, + 'no_spaces_inside_parenthesis' => true, + 'no_superfluous_elseif' => false, // Might be risky on a huge code base + 'no_superfluous_phpdoc_tags' => ['allow_mixed' => true], + 'no_trailing_comma_in_list_call' => true, + 'no_trailing_comma_in_singleline_array' => true, + 'no_trailing_whitespace' => true, + 'no_trailing_whitespace_in_comment' => true, + 'no_unneeded_control_parentheses' => true, + 'no_unneeded_curly_braces' => true, + 'no_unneeded_final_method' => true, + 'no_unreachable_default_argument_value' => true, + 'no_unset_cast' => true, + 'no_unset_on_property' => true, + 'no_unused_imports' => true, + 'no_useless_else' => true, + 'no_useless_return' => true, + 'no_whitespace_before_comma_in_array' => true, + 'no_whitespace_in_blank_line' => true, + 'non_printable_character' => true, + 'normalize_index_brace' => true, + 'not_operator_with_space' => false, // No we prefer to keep '!' without spaces + 'not_operator_with_successor_space' => false, // idem + 'nullable_type_declaration_for_default_null_value' => true, + 'object_operator_without_whitespace' => true, + 'ordered_class_elements' => false, // We prefer to keep some freedom + 'ordered_imports' => true, + 'ordered_interfaces' => true, + 'php_unit_construct' => true, + 'php_unit_dedicate_assert' => true, + 'php_unit_dedicate_assert_internal_type' => true, + 'php_unit_expectation' => true, + 'php_unit_fqcn_annotation' => true, + 'php_unit_internal_class' => false, // Because tests are excluded from package + 'php_unit_method_casing' => true, + 'php_unit_mock' => true, + 'php_unit_mock_short_will_return' => true, + 'php_unit_namespaced' => true, + 'php_unit_no_expectation_annotation' => true, + 'phpdoc_order_by_value' => ['annotations' => ['covers']], + 'php_unit_set_up_tear_down_visibility' => true, + 'php_unit_size_class' => false, // That seems extra work to maintain for little benefits + 'php_unit_strict' => false, // We sometime actually need assertEquals + 'php_unit_test_annotation' => true, + 'php_unit_test_case_static_method_calls' => ['call_type' => 'self'], + 'php_unit_test_class_requires_covers' => false, // We don't care as much as we should about coverage + 'phpdoc_add_missing_param_annotation' => false, // Don't add things that bring no value + 'phpdoc_align' => false, // Waste of time + 'phpdoc_annotation_without_dot' => true, + 'phpdoc_indent' => true, + //'phpdoc_inline_tag' => true, + 'phpdoc_line_span' => false, // Unfortunately our old comments turn even uglier with this + 'phpdoc_no_access' => true, + 'phpdoc_no_alias_tag' => true, + 'phpdoc_no_empty_return' => true, + 'phpdoc_no_package' => true, + 'phpdoc_no_useless_inheritdoc' => true, + 'phpdoc_order' => true, + 'phpdoc_return_self_reference' => true, + 'phpdoc_scalar' => true, + 'phpdoc_separation' => true, + 'phpdoc_single_line_var_spacing' => true, + 'phpdoc_summary' => true, + 'phpdoc_to_comment' => false, // interferes with annotations + 'phpdoc_to_param_type' => false, // Because experimental, but interesting for one shot use + 'phpdoc_to_return_type' => false, // idem + 'phpdoc_trim' => true, + 'phpdoc_trim_consecutive_blank_line_separation' => true, + 'phpdoc_types' => true, + 'phpdoc_types_order' => true, + 'phpdoc_var_annotation_correct_order' => true, + 'phpdoc_var_without_name' => true, + 'pow_to_exponentiation' => true, + 'protected_to_private' => true, + 'psr_autoloading' => true, + 'random_api_migration' => true, + 'return_assignment' => false, // Sometimes useful for clarity or debug + 'return_type_declaration' => true, + 'self_accessor' => true, + 'self_static_accessor' => true, + 'semicolon_after_instruction' => false, // Buggy in `samples/index.php` + 'set_type_to_cast' => true, + 'short_scalar_cast' => true, + 'simple_to_complex_string_variable' => false, // Would differ from TypeScript without obvious advantages + 'simplified_null_return' => false, // Even if technically correct we prefer to be explicit + 'single_blank_line_at_eof' => true, + 'single_blank_line_before_namespace' => true, + 'single_class_element_per_statement' => true, + 'single_import_per_statement' => true, + 'single_line_after_imports' => true, + 'single_line_comment_style' => true, + 'single_line_throw' => false, // I don't see any reason for having a special case for Exception + 'single_quote' => true, + 'single_trait_insert_per_statement' => true, + 'space_after_semicolon' => true, + 'standardize_increment' => true, + 'standardize_not_equals' => true, + 'static_lambda' => false, // Risky if we can't guarantee nobody use `bindTo()` + 'strict_comparison' => false, // No, too dangerous to change that + 'strict_param' => false, // No, too dangerous to change that + 'string_line_ending' => true, + 'switch_case_semicolon_to_colon' => true, + 'switch_case_space' => true, + 'ternary_operator_spaces' => true, + 'ternary_to_null_coalescing' => true, + 'trailing_comma_in_multiline' => true, + 'trim_array_spaces' => true, + 'unary_operator_spaces' => true, + 'visibility_required' => ['elements' => ['property', 'method']], // not const + 'void_return' => true, + 'whitespace_after_comma_in_array' => true, 'yoda_style' => false, - 'single_line_throw' => false, - 'no_alias_language_construct_call' => false, ]) ->getFinder() ->in(__DIR__) diff --git a/docs/changes/1.1.0.md b/docs/changes/1.1.0.md index 47613d194..f92efb567 100644 --- a/docs/changes/1.1.0.md +++ b/docs/changes/1.1.0.md @@ -1,11 +1,15 @@ -# 1.0.0 - WIP +# 1.1.0 - WIP ## Features -- Support for axis options - [@mindline](https://github.com/mindline-analytics) GH-676 +- Support for axis options - [@mindline](https://github.com/mindline-analytics) in [#676](https://github.com/PHPOffice/PHPPresentatio /pull/676) - Axis intersection point (axis crossing) through `setCrossesAt`/ `getCrossesAt` - Reverse axis order through `setIsReversedOrder`/ `isReversedOrder` - PowerPoint2007 Writer -- Support for Hyperlink Text Color - [@MartynasJanu](https://github.com/MartynasJanu) & [@Progi1984](https://github.com/Progi1984) GH-682 +- Support for Hyperlink Text Color - [@MartynasJanu](https://github.com/MartynasJanu) & [@Progi1984](https://github.com/Progi1984) in [#682](https://github.com/PHPOffice/PHPPresentatio /pull/682) - PowerPoint2007 Reader - PowerPoint2007 Writer + +## Bugfixes + +- Fixed CI - [@Progi1984](https://github.com/Progi1984) in [#766](https://github.com/PHPOffice/PHPPresentatio /pull/766) \ No newline at end of file diff --git a/samples/Sample_03_Image.php b/samples/Sample_03_Image.php index 8c6e0e847..00159e525 100644 --- a/samples/Sample_03_Image.php +++ b/samples/Sample_03_Image.php @@ -17,7 +17,7 @@ // Generate an image echo date('H:i:s') . ' Generate an image' . EOL; -$gdImage = @imagecreatetruecolor(140, 20) or exit('Cannot Initialize new GD image stream'); +$gdImage = @imagecreatetruecolor(140, 20) || exit('Cannot Initialize new GD image stream'); $textColor = imagecolorallocate($gdImage, 255, 255, 255); imagestring($gdImage, 1, 5, 5, 'Created with PHPPresentation', $textColor); diff --git a/samples/Sample_05_Chart.php b/samples/Sample_05_Chart.php index 9169b1f43..201d9a46a 100644 --- a/samples/Sample_05_Chart.php +++ b/samples/Sample_05_Chart.php @@ -21,7 +21,7 @@ use PhpOffice\PhpPresentation\Style\Fill; use PhpOffice\PhpPresentation\Style\Shadow; -function fnSlide_Area(PhpPresentation $objPHPPresentation) +function fnSlide_Area(PhpPresentation $objPHPPresentation): void { global $oFill; global $oShadow; @@ -71,7 +71,7 @@ function fnSlide_Area(PhpPresentation $objPHPPresentation) $shape->getLegend()->getFont()->setItalic(true); } -function fnSlide_Bar(PhpPresentation $objPHPPresentation) +function fnSlide_Bar(PhpPresentation $objPHPPresentation): void { global $oFill; global $oShadow; @@ -125,7 +125,7 @@ function fnSlide_Bar(PhpPresentation $objPHPPresentation) $shape->getLegend()->getFont()->setItalic(true); } -function fnSlide_BarHorizontal(PhpPresentation $objPHPPresentation) +function fnSlide_BarHorizontal(PhpPresentation $objPHPPresentation): void { global $oFill; global $oShadow; @@ -161,7 +161,7 @@ function fnSlide_BarHorizontal(PhpPresentation $objPHPPresentation) $shape->getLegend()->getFont()->setItalic(true); } -function fnSlide_BarStacked(PhpPresentation $objPHPPresentation) +function fnSlide_BarStacked(PhpPresentation $objPHPPresentation): void { global $oFill; global $oShadow; @@ -223,7 +223,7 @@ function fnSlide_BarStacked(PhpPresentation $objPHPPresentation) $shape->getLegend()->getFont()->setItalic(true); } -function fnSlide_BarPercentStacked(PhpPresentation $objPHPPresentation) +function fnSlide_BarPercentStacked(PhpPresentation $objPHPPresentation): void { global $oFill; global $oShadow; @@ -302,7 +302,7 @@ function fnSlide_BarPercentStacked(PhpPresentation $objPHPPresentation) $shape->getLegend()->getFont()->setItalic(true); } -function fnSlide_Bar3D(PhpPresentation $objPHPPresentation) +function fnSlide_Bar3D(PhpPresentation $objPHPPresentation): void { global $oFill; global $oShadow; @@ -356,7 +356,7 @@ function fnSlide_Bar3D(PhpPresentation $objPHPPresentation) $shape->getLegend()->getFont()->setItalic(true); } -function fnSlide_Bar3DHorizontal(PhpPresentation $objPHPPresentation) +function fnSlide_Bar3DHorizontal(PhpPresentation $objPHPPresentation): void { global $oFill; global $oShadow; @@ -395,7 +395,7 @@ function fnSlide_Bar3DHorizontal(PhpPresentation $objPHPPresentation) $shape->getLegend()->getFont()->setItalic(true); } -function fnSlide_Doughnut(PhpPresentation $objPHPPresentation) +function fnSlide_Doughnut(PhpPresentation $objPHPPresentation): void { global $oFill; global $oShadow; @@ -450,7 +450,7 @@ function fnSlide_Doughnut(PhpPresentation $objPHPPresentation) $shape->getLegend()->setPosition(Legend::POSITION_LEFT); } -function fnSlide_Pie3D(PhpPresentation $objPHPPresentation) +function fnSlide_Pie3D(PhpPresentation $objPHPPresentation): void { global $oFill; global $oShadow; @@ -499,7 +499,7 @@ function fnSlide_Pie3D(PhpPresentation $objPHPPresentation) $shape->getLegend()->getFont()->setItalic(true); } -function fnSlide_Pie(PhpPresentation $objPHPPresentation) +function fnSlide_Pie(PhpPresentation $objPHPPresentation): void { global $oFill; global $oShadow; @@ -550,7 +550,7 @@ function fnSlide_Pie(PhpPresentation $objPHPPresentation) $shape->getLegend()->getFont()->setItalic(true); } -function fnSlide_Radar(PhpPresentation $objPHPPresentation) +function fnSlide_Radar(PhpPresentation $objPHPPresentation): void { global $oFill; global $oShadow; @@ -607,7 +607,7 @@ function fnSlide_Radar(PhpPresentation $objPHPPresentation) ->setStartColor(new Color(Color::COLOR_BLUE)); // 0000FF } -function fnSlide_Scatter(PhpPresentation $objPHPPresentation) +function fnSlide_Scatter(PhpPresentation $objPHPPresentation): void { global $oFill; global $oShadow; diff --git a/samples/Sample_06_Fill.php b/samples/Sample_06_Fill.php index e917a34f9..41bc149a6 100644 --- a/samples/Sample_06_Fill.php +++ b/samples/Sample_06_Fill.php @@ -46,15 +46,19 @@ switch ($inc) { case 1: $shape->getFill()->setFillType(Fill::FILL_NONE); + break; case 2: $shape->getFill()->setFillType(Fill::FILL_GRADIENT_LINEAR)->setRotation(90)->setStartColor(new Color('FF4672A8'))->setEndColor(new Color('FF000000')); + break; case 3: $shape->getFill()->setFillType(Fill::FILL_GRADIENT_PATH)->setRotation(90)->setStartColor(new Color('FF4672A8'))->setEndColor(new Color('FF000000')); + break; case 4: $shape->getFill()->setFillType(Fill::FILL_SOLID)->setRotation(90)->setStartColor(new Color('FF4672A8'))->setEndColor(new Color('FF4672A8')); + break; } diff --git a/samples/Sample_07_Border.php b/samples/Sample_07_Border.php index 24816fedd..fff1aa1bb 100644 --- a/samples/Sample_07_Border.php +++ b/samples/Sample_07_Border.php @@ -38,15 +38,19 @@ switch ($inc) { case 1: $shape->getBorder()->setColor(new Color('FF4672A8'))->setDashStyle(Border::DASH_SOLID)->setLineStyle(Border::LINE_DOUBLE); + break; case 2: $shape->getBorder()->setColor(new Color('FF4672A8'))->setDashStyle(Border::DASH_DASH)->setLineStyle(Border::LINE_SINGLE); + break; case 3: $shape->getBorder()->setColor(new Color('FF4672A8'))->setDashStyle(Border::DASH_DOT)->setLineStyle(Border::LINE_THICKTHIN); + break; case 4: $shape->getBorder()->setColor(new Color('FF4672A8'))->setDashStyle(Border::DASH_LARGEDASHDOT)->setLineStyle(Border::LINE_THINTHICK); + break; } diff --git a/samples/Sample_11_Shape.php b/samples/Sample_11_Shape.php index 37dc5a221..af3059f2b 100644 --- a/samples/Sample_11_Shape.php +++ b/samples/Sample_11_Shape.php @@ -7,7 +7,7 @@ include_once 'Sample_Header.php'; -function fnSlideRichText(PhpPresentation $objPHPPresentation) +function fnSlideRichText(PhpPresentation $objPHPPresentation): void { // Create templated slide echo date('H:i:s') . ' Create templated slide' . EOL; @@ -35,7 +35,7 @@ function fnSlideRichText(PhpPresentation $objPHPPresentation) $textRun->getFont()->setColor(new Color('FF000000')); } -function fnSlideRichTextLineSpacing(PhpPresentation $objPHPPresentation) +function fnSlideRichTextLineSpacing(PhpPresentation $objPHPPresentation): void { // Create templated slide echo date('H:i:s') . ' Create templated slide' . EOL; @@ -81,7 +81,7 @@ function fnSlideRichTextLineSpacing(PhpPresentation $objPHPPresentation) $shape->createTextRun('Line Spacing 300'); } -function fnSlideRichTextShadow(PhpPresentation $objPHPPresentation) +function fnSlideRichTextShadow(PhpPresentation $objPHPPresentation): void { // Create templated slide echo date('H:i:s') . ' Create templated slide' . EOL; @@ -101,7 +101,7 @@ function fnSlideRichTextShadow(PhpPresentation $objPHPPresentation) $textRun->getFont()->setColor(new Color('FF000000')); } -function fnSlideRichTextList(PhpPresentation $objPHPPresentation) +function fnSlideRichTextList(PhpPresentation $objPHPPresentation): void { // Create templated slide echo date('H:i:s') . ' Create templated slide' . EOL; diff --git a/samples/Sample_15_Background.php b/samples/Sample_15_Background.php index 74135eece..9e1280fd9 100644 --- a/samples/Sample_15_Background.php +++ b/samples/Sample_15_Background.php @@ -29,9 +29,7 @@ $oSlide2->addShape(clone $oShapeRichText); // Slide > Background > Image -/* - * @link : http://publicdomainarchive.com/public-domain-images-cave-red-rocks-light-beam-cavern/ - */ +// @link : http://publicdomainarchive.com/public-domain-images-cave-red-rocks-light-beam-cavern/ $oBkgImage = new Image(); $oBkgImage->setPath(__DIR__ . '/resources/background.jpg'); $oSlide2->setBackground($oBkgImage); diff --git a/samples/Sample_Header.php b/samples/Sample_Header.php index eb16a62a3..3f9e7cc41 100644 --- a/samples/Sample_Header.php +++ b/samples/Sample_Header.php @@ -1,7 +1,7 @@ <?php /** * Header file. -*/ + */ use PhpOffice\PhpPresentation\AbstractShape; use PhpOffice\PhpPresentation\Autoloader; use PhpOffice\PhpPresentation\DocumentLayout; @@ -117,7 +117,7 @@ function write($phpPresentation, $filename, $writers) // Write documents foreach ($writers as $writer => $extension) { $result .= date('H:i:s') . " Write to {$writer} format"; - if (!is_null($extension)) { + if (null !== $extension) { $xmlWriter = IOFactory::createWriter($phpPresentation, $writer); $xmlWriter->save(__DIR__ . "/{$filename}.{$extension}"); rename(__DIR__ . "/{$filename}.{$extension}", __DIR__ . "/results/{$filename}.{$extension}"); @@ -158,7 +158,7 @@ function getEndingNotes($writers) $result .= '<p> </p>'; $result .= '<p>Results: '; foreach ($types as $type) { - if (!is_null($type)) { + if (null !== $type) { $resultFile = 'results/' . SCRIPT_FILENAME . '.' . $type; if (file_exists($resultFile)) { $result .= "<a href='{$resultFile}' class='btn btn-primary'>{$type}</a> "; @@ -200,9 +200,10 @@ function createTemplatedSlide(PhpOffice\PhpPresentation\PhpPresentation $objPHPP return $slide; } -class PhpPptTree +class Sample_Header { protected $oPhpPresentation; + protected $htmlOutput; public function __construct(PhpPresentation $oPHPPpt) @@ -230,12 +231,12 @@ public function display() return $this->htmlOutput; } - protected function append($sHTML) + protected function append($sHTML): void { $this->htmlOutput .= $sHTML; } - protected function displayPhpPresentation(PhpPresentation $oPHPPpt) + protected function displayPhpPresentation(PhpPresentation $oPHPPpt): void { $this->append('<li><span><i class="fa fa-folder-open"></i> PhpPresentation</span>'); $this->append('<ul>'); @@ -265,7 +266,7 @@ protected function displayPhpPresentation(PhpPresentation $oPHPPpt) $this->append('</li>'); } - protected function displayShape(AbstractShape $shape) + protected function displayShape(AbstractShape $shape): void { if ($shape instanceof Drawing\Gd) { $this->append('<li><span class="shape" id="div' . $shape->getHashCode() . '">Shape "Drawing\Gd"</span></li>'); @@ -282,7 +283,7 @@ protected function displayShape(AbstractShape $shape) } } - protected function displayPhpPresentationInfo(PhpPresentation $oPHPPpt) + protected function displayPhpPresentationInfo(PhpPresentation $oPHPPpt): void { $this->append('<div class="infoBlk" id="divPhpPresentationInfo">'); $this->append('<dl>'); @@ -348,7 +349,7 @@ protected function displayPhpPresentationInfo(PhpPresentation $oPHPPpt) } } - protected function displayShapeInfo(AbstractShape $oShape) + protected function displayShapeInfo(AbstractShape $oShape): void { $this->append('<div class="infoBlk" id="div' . $oShape->getHashCode() . 'Info">'); $this->append('<dl>'); @@ -360,18 +361,20 @@ protected function displayShapeInfo(AbstractShape $oShape) $this->append('<dt>Rotation</dt><dd>' . $oShape->getRotation() . '°</dd>'); $this->append('<dt>Hyperlink</dt><dd>' . ucfirst(var_export($oShape->hasHyperlink(), true)) . '</dd>'); $this->append('<dt>Fill</dt>'); - if (is_null($oShape->getFill())) { + if (null === $oShape->getFill()) { $this->append('<dd>None</dd>'); } else { switch ($oShape->getFill()->getFillType()) { case \PhpOffice\PhpPresentation\Style\Fill::FILL_NONE: $this->append('<dd>None</dd>'); + break; case \PhpOffice\PhpPresentation\Style\Fill::FILL_SOLID: $this->append('<dd>Solid ('); $this->append('Color : #' . $oShape->getFill()->getStartColor()->getRGB()); $this->append(' - Alpha : ' . $oShape->getFill()->getStartColor()->getAlpha() . '%'); $this->append(')</dd>'); + break; } } @@ -454,9 +457,9 @@ protected function displayShapeInfo(AbstractShape $oShape) $this->append('</dl></dd></dl>'); } $this->append('</dd>'); - } else { - // Add another shape } + // Add another shape + $this->append('</dl>'); $this->append('</div>'); } @@ -471,6 +474,7 @@ protected function getConstantName($class, $search, $startWith = '') if (empty($startWith) || (!empty($startWith) && 0 === strpos($key, $startWith))) { $constName = $key; } + break; } } diff --git a/samples/index.php b/samples/index.php index c45af5f7f..efda7ee8e 100644 --- a/samples/index.php +++ b/samples/index.php @@ -1,7 +1,7 @@ <?php include_once 'Sample_Header.php'; $requirements = [ - 'php' => ['PHP 5.3.0', version_compare(phpversion(), '5.3.0', '>=')], + 'php' => ['PHP 5.3.0', version_compare(PHP_VERSION, '5.3.0', '>=')], 'xml' => ['PHP extension XML', extension_loaded('xml')], 'zip' => ['PHP extension ZipArchive (optional)', extension_loaded('zip')], 'gd' => ['PHP extension GD (optional)', extension_loaded('gd')], @@ -24,7 +24,7 @@ echo '<h3>Requirement check:</h3>'; echo '<ul>'; foreach ($requirements as $key => $value) { - list($label, $result) = $value; + [$label, $result] = $value; $status = $result ? 'passed' : 'failed'; echo "<li>{$label} ... <span class='{$status}'>{$status}</span></li>"; } @@ -33,7 +33,7 @@ } else { echo 'Requirement check:' . PHP_EOL; foreach ($requirements as $key => $value) { - list($label, $result) = $value; + [$label, $result] = $value; $status = $result ? '32m passed' : '31m failed'; echo "{$label} ... \033[{$status}\033[0m" . PHP_EOL; } diff --git a/src/PhpPresentation/AbstractShape.php b/src/PhpPresentation/AbstractShape.php index c8d3df00d..a7bdcac9e 100644 --- a/src/PhpPresentation/AbstractShape.php +++ b/src/PhpPresentation/AbstractShape.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -35,7 +34,7 @@ abstract class AbstractShape implements ComparableInterface /** * Container. * - * @var ShapeContainerInterface|null + * @var null|ShapeContainerInterface */ protected $container; @@ -68,7 +67,7 @@ abstract class AbstractShape implements ComparableInterface protected $height; /** - * @var Fill|null + * @var null|Fill */ private $fill; @@ -89,17 +88,17 @@ abstract class AbstractShape implements ComparableInterface /** * Shadow. * - * @var Shadow|null + * @var null|Shadow */ protected $shadow; /** - * @var Hyperlink|null + * @var null|Hyperlink */ protected $hyperlink; /** - * @var Placeholder|null + * @var null|Placeholder */ protected $placeholder; @@ -147,16 +146,14 @@ public function getContainer(): ?ShapeContainerInterface * @param ShapeContainerInterface $pValue * @param bool $pOverrideOld If a Slide has already been assigned, overwrite it and remove image from old Slide? * - * @throws ShapeContainerAlreadyAssignedException - * * @return $this */ - public function setContainer(ShapeContainerInterface $pValue = null, $pOverrideOld = false) + public function setContainer(?ShapeContainerInterface $pValue = null, $pOverrideOld = false) { - if (is_null($this->container)) { + if (null === $this->container) { // Add drawing to ShapeContainerInterface $this->container = $pValue; - if (!is_null($this->container)) { + if (null !== $this->container) { $this->container->getShapeCollection()->append($this); } } else { @@ -168,6 +165,7 @@ public function setContainer(ShapeContainerInterface $pValue = null, $pOverrideO if ($iterator->current()->getHashCode() == $this->getHashCode()) { $this->container->getShapeCollection()->offsetUnset($iterator->key()); $this->container = null; + break; } $iterator->next(); @@ -311,7 +309,7 @@ public function getFill(): ?Fill return $this->fill; } - public function setFill(Fill $pValue = null): self + public function setFill(?Fill $pValue = null): self { $this->fill = $pValue; @@ -331,7 +329,7 @@ public function getShadow(): ?Shadow /** * @return $this */ - public function setShadow(Shadow $pValue = null) + public function setShadow(?Shadow $pValue = null) { $this->shadow = $pValue; @@ -345,15 +343,15 @@ public function setShadow(Shadow $pValue = null) */ public function hasHyperlink() { - return !is_null($this->hyperlink); + return null !== $this->hyperlink; } /** - * Get Hyperlink + * Get Hyperlink. */ public function getHyperlink(): Hyperlink { - if (is_null($this->hyperlink)) { + if (null === $this->hyperlink) { $this->hyperlink = new Hyperlink(); } @@ -361,9 +359,9 @@ public function getHyperlink(): Hyperlink } /** - * Set Hyperlink + * Set Hyperlink. */ - public function setHyperlink(Hyperlink $pHyperlink = null): self + public function setHyperlink(?Hyperlink $pHyperlink = null): self { $this->hyperlink = $pHyperlink; @@ -377,7 +375,7 @@ public function setHyperlink(Hyperlink $pHyperlink = null): self */ public function getHashCode(): string { - return md5((is_object($this->container) ? $this->container->getHashCode() : '') . $this->offsetX . $this->offsetY . $this->width . $this->height . $this->rotation . (is_null($this->getFill()) ? '' : $this->getFill()->getHashCode()) . (is_null($this->shadow) ? '' : $this->shadow->getHashCode()) . (is_null($this->hyperlink) ? '' : $this->hyperlink->getHashCode()) . __CLASS__); + return md5((is_object($this->container) ? $this->container->getHashCode() : '') . $this->offsetX . $this->offsetY . $this->width . $this->height . $this->rotation . (null === $this->getFill() ? '' : $this->getFill()->getHashCode()) . (null === $this->shadow ? '' : $this->shadow->getHashCode()) . (null === $this->hyperlink ? '' : $this->hyperlink->getHashCode()) . __CLASS__); } /** @@ -386,7 +384,7 @@ public function getHashCode(): string * Note that this index may vary during script execution! Only reliable moment is * while doing a write of a workbook and when changes are not allowed. * - * @return int|null Hash index + * @return null|int Hash index */ public function getHashIndex(): ?int { @@ -412,7 +410,7 @@ public function setHashIndex(int $value) public function isPlaceholder(): bool { - return !is_null($this->placeholder); + return null !== $this->placeholder; } public function getPlaceholder(): ?Placeholder diff --git a/src/PhpPresentation/Autoloader.php b/src/PhpPresentation/Autoloader.php index 6c7211fde..693b43aee 100644 --- a/src/PhpPresentation/Autoloader.php +++ b/src/PhpPresentation/Autoloader.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpPresentation/ComparableInterface.php b/src/PhpPresentation/ComparableInterface.php index 7fefbda1c..ed958b17e 100644 --- a/src/PhpPresentation/ComparableInterface.php +++ b/src/PhpPresentation/ComparableInterface.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -38,7 +37,7 @@ public function getHashCode(): string; * Note that this index may vary during script execution! Only reliable moment is * while doing a write of a workbook and when changes are not allowed. * - * @return int|null Hash index + * @return null|int Hash index */ public function getHashIndex(): ?int; diff --git a/src/PhpPresentation/DocumentLayout.php b/src/PhpPresentation/DocumentLayout.php index bf7910407..ec1a40c61 100644 --- a/src/PhpPresentation/DocumentLayout.php +++ b/src/PhpPresentation/DocumentLayout.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -131,12 +130,14 @@ public function setDocumentLayout($pValue = self::LAYOUT_SCREEN_4X3, $isLandscap $this->layout = $pValue; $this->dimensionX = $this->dimension[$this->layout]['cx']; $this->dimensionY = $this->dimension[$this->layout]['cy']; + break; case self::LAYOUT_CUSTOM: default: $this->layout = self::LAYOUT_CUSTOM; $this->dimensionX = $pValue['cx']; $this->dimensionY = $pValue['cy']; + break; } @@ -196,18 +197,23 @@ protected function convertUnit(float $value, string $fromUnit, string $toUnit): switch ($fromUnit) { case self::UNIT_MILLIMETER: $value *= 36000; + break; case self::UNIT_CENTIMETER: $value *= 360000; + break; case self::UNIT_INCH: $value *= 914400; + break; case self::UNIT_PIXEL: $value = Drawing::pixelsToEmu($value); + break; case self::UNIT_POINT: $value *= 12700; + break; case self::UNIT_EMU: default: @@ -218,18 +224,23 @@ protected function convertUnit(float $value, string $fromUnit, string $toUnit): switch ($toUnit) { case self::UNIT_MILLIMETER: $value /= 36000; + break; case self::UNIT_CENTIMETER: $value /= 360000; + break; case self::UNIT_INCH: $value /= 914400; + break; case self::UNIT_PIXEL: $value = Drawing::emuToPixels((int) $value); + break; case self::UNIT_POINT: $value /= 12700; + break; case self::UNIT_EMU: default: diff --git a/src/PhpPresentation/DocumentProperties.php b/src/PhpPresentation/DocumentProperties.php index ab4542043..7c48cef1d 100644 --- a/src/PhpPresentation/DocumentProperties.php +++ b/src/PhpPresentation/DocumentProperties.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -110,7 +109,7 @@ class DocumentProperties private $customProperties = []; /** - * Create a new \PhpOffice\PhpPresentation\DocumentProperties + * Create a new \PhpOffice\PhpPresentation\DocumentProperties. */ public function __construct() { @@ -194,7 +193,7 @@ public function getCreated() */ public function setCreated($pValue = null) { - if (is_null($pValue)) { + if (null === $pValue) { $pValue = time(); } $this->created = $pValue; @@ -221,7 +220,7 @@ public function getModified() */ public function setModified($pValue = null) { - if (is_null($pValue)) { + if (null === $pValue) { $pValue = time(); } $this->modified = $pValue; @@ -385,10 +384,6 @@ public function getCustomProperties(): array /** * Check if a Custom Property is defined. - * - * @param string $propertyName - * - * @return bool */ public function isCustomPropertySet(string $propertyName): bool { @@ -398,9 +393,7 @@ public function isCustomPropertySet(string $propertyName): bool /** * Get a Custom Property Value. * - * @param string $propertyName - * - * @return mixed|null + * @return null|mixed */ public function getCustomPropertyValue(string $propertyName) { @@ -413,10 +406,6 @@ public function getCustomPropertyValue(string $propertyName) /** * Get a Custom Property Type. - * - * @param string $propertyName - * - * @return string|null */ public function getCustomPropertyType(string $propertyName): ?string { @@ -430,16 +419,13 @@ public function getCustomPropertyType(string $propertyName): ?string /** * Set a Custom Property. * - * @param string $propertyName * @param mixed $propertyValue - * @param string|null $propertyType + * @param null|string $propertyType * 'i' : Integer * 'f' : Floating Point * 's' : String * 'd' : Date/Time * 'b' : Boolean - * - * @return self */ public function setCustomProperty(string $propertyName, $propertyValue = '', ?string $propertyType = null): self { diff --git a/src/PhpPresentation/Exception/DirectoryNotFoundException.php b/src/PhpPresentation/Exception/DirectoryNotFoundException.php index bfd444c44..e1c64e38b 100644 --- a/src/PhpPresentation/Exception/DirectoryNotFoundException.php +++ b/src/PhpPresentation/Exception/DirectoryNotFoundException.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpPresentation/Exception/FeatureNotImplementedException.php b/src/PhpPresentation/Exception/FeatureNotImplementedException.php index 56160e6bb..2ba4a04ed 100644 --- a/src/PhpPresentation/Exception/FeatureNotImplementedException.php +++ b/src/PhpPresentation/Exception/FeatureNotImplementedException.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpPresentation/Exception/FileCopyException.php b/src/PhpPresentation/Exception/FileCopyException.php index a6574bce5..84dd93088 100644 --- a/src/PhpPresentation/Exception/FileCopyException.php +++ b/src/PhpPresentation/Exception/FileCopyException.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpPresentation/Exception/FileNotFoundException.php b/src/PhpPresentation/Exception/FileNotFoundException.php index 368a32b97..bf825a446 100644 --- a/src/PhpPresentation/Exception/FileNotFoundException.php +++ b/src/PhpPresentation/Exception/FileNotFoundException.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpPresentation/Exception/FileRemoveException.php b/src/PhpPresentation/Exception/FileRemoveException.php index e9b4e306a..04bd141ac 100644 --- a/src/PhpPresentation/Exception/FileRemoveException.php +++ b/src/PhpPresentation/Exception/FileRemoveException.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpPresentation/Exception/InvalidClassException.php b/src/PhpPresentation/Exception/InvalidClassException.php index 06642d5ff..e8813fbb4 100644 --- a/src/PhpPresentation/Exception/InvalidClassException.php +++ b/src/PhpPresentation/Exception/InvalidClassException.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpPresentation/Exception/InvalidFileFormatException.php b/src/PhpPresentation/Exception/InvalidFileFormatException.php index 4dcbff7b8..1894d4e1e 100644 --- a/src/PhpPresentation/Exception/InvalidFileFormatException.php +++ b/src/PhpPresentation/Exception/InvalidFileFormatException.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpPresentation/Exception/InvalidParameterException.php b/src/PhpPresentation/Exception/InvalidParameterException.php index a6a97cf97..961809623 100644 --- a/src/PhpPresentation/Exception/InvalidParameterException.php +++ b/src/PhpPresentation/Exception/InvalidParameterException.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpPresentation/Exception/OutOfBoundsException.php b/src/PhpPresentation/Exception/OutOfBoundsException.php index 7946c6075..38789d720 100644 --- a/src/PhpPresentation/Exception/OutOfBoundsException.php +++ b/src/PhpPresentation/Exception/OutOfBoundsException.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpPresentation/Exception/PhpPresentationException.php b/src/PhpPresentation/Exception/PhpPresentationException.php index 52392894a..629b70a0a 100644 --- a/src/PhpPresentation/Exception/PhpPresentationException.php +++ b/src/PhpPresentation/Exception/PhpPresentationException.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpPresentation/Exception/ShapeContainerAlreadyAssignedException.php b/src/PhpPresentation/Exception/ShapeContainerAlreadyAssignedException.php index cd39cb047..c21083011 100644 --- a/src/PhpPresentation/Exception/ShapeContainerAlreadyAssignedException.php +++ b/src/PhpPresentation/Exception/ShapeContainerAlreadyAssignedException.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpPresentation/Exception/UnauthorizedMimetypeException.php b/src/PhpPresentation/Exception/UnauthorizedMimetypeException.php index 01a8b5b66..67f03fc19 100644 --- a/src/PhpPresentation/Exception/UnauthorizedMimetypeException.php +++ b/src/PhpPresentation/Exception/UnauthorizedMimetypeException.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -23,7 +22,6 @@ class UnauthorizedMimetypeException extends PhpPresentationException { /** - * @param string $expectedMimetype * @param array<string> $authorizedMimetypes */ public function __construct(string $expectedMimetype, array $authorizedMimetypes) diff --git a/src/PhpPresentation/Exception/UndefinedChartTypeException.php b/src/PhpPresentation/Exception/UndefinedChartTypeException.php index 5e77181a0..6b53f26f7 100644 --- a/src/PhpPresentation/Exception/UndefinedChartTypeException.php +++ b/src/PhpPresentation/Exception/UndefinedChartTypeException.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpPresentation/GeometryCalculator.php b/src/PhpPresentation/GeometryCalculator.php index 7eccbf895..2c050929e 100644 --- a/src/PhpPresentation/GeometryCalculator.php +++ b/src/PhpPresentation/GeometryCalculator.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpPresentation/HashTable.php b/src/PhpPresentation/HashTable.php index df5e5a29a..6a72f5c30 100644 --- a/src/PhpPresentation/HashTable.php +++ b/src/PhpPresentation/HashTable.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpPresentation/IOFactory.php b/src/PhpPresentation/IOFactory.php index 0d7f90b29..88f7d4bc1 100644 --- a/src/PhpPresentation/IOFactory.php +++ b/src/PhpPresentation/IOFactory.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -40,9 +39,6 @@ class IOFactory /** * Create writer. - * - * @param PhpPresentation $phpPresentation - * @param string $name */ public static function createWriter(PhpPresentation $phpPresentation, string $name = 'PowerPoint2007'): WriterInterface { @@ -51,8 +47,6 @@ public static function createWriter(PhpPresentation $phpPresentation, string $na /** * Create reader. - * - * @param string $name */ public static function createReader(string $name): ReaderInterface { @@ -61,8 +55,6 @@ public static function createReader(string $name): ReaderInterface /** * Loads PhpPresentation from file using automatic ReaderInterface resolution. - * - * @throws InvalidFileFormatException */ public static function load(string $pFilename): PhpPresentation { @@ -76,23 +68,17 @@ public static function load(string $pFilename): PhpPresentation throw new InvalidFileFormatException( $pFilename, - IOFactory::class, + self::class, 'Could not automatically determine the good ' . ReaderInterface::class ); } /** - * Load class - * - * @param string $class - * @param string $type - * @param PhpPresentation|null $phpPresentation + * Load class. * * @return object - * - * @throws InvalidClassException */ - private static function loadClass(string $class, string $type, PhpPresentation $phpPresentation = null) + private static function loadClass(string $class, string $type, ?PhpPresentation $phpPresentation = null) { if (!class_exists($class)) { throw new InvalidClassException($class, $type . ': The class doesn\'t exist'); @@ -100,7 +86,7 @@ private static function loadClass(string $class, string $type, PhpPresentation $ if (!self::isConcreteClass($class)) { throw new InvalidClassException($class, $type . ': The class is an abstract class or an interface'); } - if (is_null($phpPresentation)) { + if (null === $phpPresentation) { return new $class(); } diff --git a/src/PhpPresentation/PhpPresentation.php b/src/PhpPresentation/PhpPresentation.php index e2db811f5..c55008348 100644 --- a/src/PhpPresentation/PhpPresentation.php +++ b/src/PhpPresentation/PhpPresentation.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -179,8 +178,6 @@ public function addSlide(Slide $slide): Slide * Remove slide by index. * * @param int $index Slide index - * - * @throws OutOfBoundsException */ public function removeSlideByIndex(int $index = 0): self { @@ -196,8 +193,6 @@ public function removeSlideByIndex(int $index = 0): self * Get slide by index. * * @param int $index Slide index - * - * @throws OutOfBoundsException */ public function getSlide(int $index = 0): Slide { @@ -257,8 +252,6 @@ public function getActiveSlideIndex(): int * Set active slide index. * * @param int $index Active slide index - * - * @throws OutOfBoundsException */ public function setActiveSlideIndex(int $index = 0): Slide { @@ -316,7 +309,7 @@ public function addMasterSlide(SlideMaster $slide): SlideMaster /** * Copy presentation (!= clone!). */ - public function copy(): PhpPresentation + public function copy(): self { $copied = clone $this; diff --git a/src/PhpPresentation/PresentationProperties.php b/src/PhpPresentation/PresentationProperties.php index a8ee8eff3..c10c915f8 100644 --- a/src/PhpPresentation/PresentationProperties.php +++ b/src/PhpPresentation/PresentationProperties.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -71,7 +70,7 @@ class PresentationProperties protected $markAsFinal = false; /** - * @var string|null + * @var null|string */ protected $thumbnail; @@ -111,8 +110,6 @@ public function setLoopContinuouslyUntilEsc(bool $value = false): self /** * Return the thumbnail file path. - * - * @return string|null */ public function getThumbnailPath(): ?string { @@ -121,10 +118,6 @@ public function getThumbnailPath(): ?string /** * Define the path for the thumbnail file / preview picture. - * - * @param string $path - * - * @return self */ public function setThumbnailPath(string $path = ''): self { @@ -147,8 +140,6 @@ public function markAsFinal(bool $state = true): self /** * Return if this document is marked as final. - * - * @return bool */ public function isMarkedAsFinal(): bool { @@ -173,11 +164,6 @@ public function getZoom(): float return $this->zoom; } - /** - * @param string $value - * - * @return self - */ public function setLastView(string $value = self::VIEW_SLIDE): self { if (in_array($value, $this->arrayView)) { @@ -187,9 +173,6 @@ public function setLastView(string $value = self::VIEW_SLIDE): self return $this; } - /** - * @return string - */ public function getLastView(): string { return $this->lastView; @@ -207,19 +190,11 @@ public function isCommentVisible(): bool return $this->isCommentVisible; } - /** - * @return string - */ public function getSlideshowType(): string { return $this->slideshowType; } - /** - * @param string $value - * - * @return self - */ public function setSlideshowType(string $value = self::SLIDESHOW_TYPE_PRESENT): self { if (in_array($value, $this->arraySlideshowTypes)) { diff --git a/src/PhpPresentation/Reader/ODPresentation.php b/src/PhpPresentation/Reader/ODPresentation.php index d4fd67c05..b9746e6c4 100644 --- a/src/PhpPresentation/Reader/ODPresentation.php +++ b/src/PhpPresentation/Reader/ODPresentation.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -53,24 +52,29 @@ class ODPresentation implements ReaderInterface * @var PhpPresentation */ protected $oPhpPresentation; + /** * Output Object. * - * @var \ZipArchive + * @var ZipArchive */ protected $oZip; + /** * @var array<string, array{alignment: Alignment|null, background: null, shadow: Shadow|null, fill: Fill|null, spacingAfter: int|null, spacingBefore: int|null, lineSpacingMode: null, lineSpacing: null, font: null, listStyle: null}> */ protected $arrayStyles = []; + /** - * @var array<string, array<string, string|null>> + * @var array<string, array<string, null|string>> */ protected $arrayCommonStyles = []; + /** * @var \PhpOffice\Common\XMLReader */ protected $oXMLReader; + /** * @var int */ @@ -86,8 +90,6 @@ public function canRead(string $pFilename): bool /** * Does a file support UnserializePhpPresentation ? - * - * @throws FileNotFoundException */ public function fileSupportsUnserializePhpPresentation(string $pFilename = ''): bool { @@ -111,14 +113,12 @@ public function fileSupportsUnserializePhpPresentation(string $pFilename = ''): /** * Loads PhpPresentation Serialized file. - * - * @throws InvalidFileFormatException */ public function load(string $pFilename): PhpPresentation { // Unserialize... First make sure the file supports it! if (!$this->fileSupportsUnserializePhpPresentation($pFilename)) { - throw new InvalidFileFormatException($pFilename, ODPresentation::class); + throw new InvalidFileFormatException($pFilename, self::class); } return $this->loadFile($pFilename); @@ -157,7 +157,7 @@ protected function loadFile($pFilename) } /** - * Read Document Properties + * Read Document Properties. */ protected function loadDocumentProperties(): void { @@ -198,18 +198,22 @@ protected function loadDocumentProperties(): void switch ($propertyType) { case 'boolean': $propertyType = DocumentProperties::PROPERTY_TYPE_BOOLEAN; + break; case 'float': $propertyType = filter_var($propertyValue, FILTER_VALIDATE_INT) === false ? DocumentProperties::PROPERTY_TYPE_FLOAT : DocumentProperties::PROPERTY_TYPE_INTEGER; + break; case 'date': $propertyType = DocumentProperties::PROPERTY_TYPE_DATE; + break; case 'string': default: $propertyType = DocumentProperties::PROPERTY_TYPE_STRING; + break; } $properties->setCustomProperty($propertyName, $propertyValue, $propertyType); @@ -217,7 +221,7 @@ protected function loadDocumentProperties(): void } /** - * Extract all slides + * Extract all slides. */ protected function loadSlides(): void { @@ -244,7 +248,7 @@ protected function loadPresentationProperties(): void } /** - * Extract style + * Extract style. */ protected function loadStyle(DOMElement $nodeStyle): bool { @@ -306,6 +310,7 @@ protected function loadStyle(DOMElement $nodeStyle): bool case 'none': $oFill = new Fill(); $oFill->setFillType(Fill::FILL_NONE); + break; case 'solid': $oFill = new Fill(); @@ -315,6 +320,7 @@ protected function loadStyle(DOMElement $nodeStyle): bool $oColor->setRGB(substr($nodeGraphicProps->getAttribute('draw:fill-color'), 1)); $oFill->setStartColor($oColor); } + break; } } @@ -378,12 +384,15 @@ protected function loadStyle(DOMElement $nodeStyle): bool switch ($nodeTextProperties->getAttribute('style:script-type')) { case 'latin': $oFont->setFormat(Font::FORMAT_LATIN); + break; case 'asian': $oFont->setFormat(Font::FORMAT_EAST_ASIAN); + break; case 'complex': $oFont->setFormat(Font::FORMAT_COMPLEX_SCRIPT); + break; } } @@ -414,11 +423,13 @@ protected function loadStyle(DOMElement $nodeStyle): bool case 'tb-lr': case 'lr': $oAlignment->setIsRTL(false); + break; case 'rl-tb': case 'tb-rl': case 'rl': $oAlignment->setIsRTL(false); + break; case 'tb': case 'page': @@ -487,7 +498,7 @@ protected function loadStyle(DOMElement $nodeStyle): bool } /** - * Read Slide + * Read Slide. */ protected function loadSlide(DOMElement $nodeSlide): bool { @@ -507,10 +518,12 @@ protected function loadSlide(DOMElement $nodeSlide): bool if ($oNodeFrame instanceof DOMElement) { if ($this->oXMLReader->getElement('draw:image', $oNodeFrame)) { $this->loadShapeDrawing($oNodeFrame); + continue; } if ($this->oXMLReader->getElement('draw:text-box', $oNodeFrame)) { $this->loadShapeRichText($oNodeFrame); + continue; } } @@ -520,7 +533,7 @@ protected function loadSlide(DOMElement $nodeSlide): bool } /** - * Read Shape Drawing + * Read Shape Drawing. */ protected function loadShapeDrawing(DOMElement $oNodeFrame): void { @@ -577,7 +590,7 @@ protected function loadShapeDrawing(DOMElement $oNodeFrame): void } /** - * Read Shape RichText + * Read Shape RichText. */ protected function loadShapeRichText(DOMElement $oNodeFrame): void { @@ -608,7 +621,7 @@ protected function loadShapeRichText(DOMElement $oNodeFrame): void } /** - * Read Paragraph + * Read Paragraph. */ protected function readParagraph(RichText $oShape, DOMElement $oNodeParent): void { @@ -646,7 +659,7 @@ protected function readParagraph(RichText $oShape, DOMElement $oNodeParent): voi } /** - * Read Paragraph Item + * Read Paragraph Item. */ protected function readParagraphItem(Paragraph $oParagraph, DOMElement $oNodeParent): void { @@ -673,7 +686,7 @@ protected function readParagraphItem(Paragraph $oParagraph, DOMElement $oNodePar } /** - * Read List + * Read List. */ protected function readList(RichText $oShape, DOMElement $oNodeParent): void { @@ -692,7 +705,7 @@ protected function readList(RichText $oShape, DOMElement $oNodeParent): void } /** - * Read List Item + * Read List Item. */ protected function readListItem(RichText $oShape, DOMElement $oNodeParent, DOMElement $oNodeParagraph): void { @@ -726,11 +739,6 @@ protected function loadStylesFile(): void } } - /** - * @param string $expr - * - * @return string - */ private function getExpressionUnit(string $expr): string { if (substr($expr, -1) == '%') { @@ -740,11 +748,6 @@ private function getExpressionUnit(string $expr): string return substr($expr, -2); } - /** - * @param string $expr - * - * @return string - */ private function getExpressionValue(string $expr): string { if (substr($expr, -1) == '%') { diff --git a/src/PhpPresentation/Reader/PowerPoint2007.php b/src/PhpPresentation/Reader/PowerPoint2007.php index ef065587c..5ae4d03c4 100644 --- a/src/PhpPresentation/Reader/PowerPoint2007.php +++ b/src/PhpPresentation/Reader/PowerPoint2007.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -66,24 +65,29 @@ class PowerPoint2007 implements ReaderInterface * @var PhpPresentation */ protected $oPhpPresentation; + /** * Output Object. * - * @var \ZipArchive + * @var ZipArchive */ protected $oZip; + /** * @var array<string, array<string, array<string, string>>> */ protected $arrayRels = []; + /** * @var SlideLayout[] */ protected $arraySlideLayouts = []; + /** * @var string */ protected $filename; + /** * @var string */ @@ -99,8 +103,6 @@ public function canRead(string $pFilename): bool /** * Does a file support UnserializePhpPresentation ? - * - * @throws FileNotFoundException */ public function fileSupportsUnserializePhpPresentation(string $pFilename = ''): bool { @@ -124,14 +126,12 @@ public function fileSupportsUnserializePhpPresentation(string $pFilename = ''): /** * Loads PhpPresentation Serialized file. - * - * @throws InvalidFileFormatException */ public function load(string $pFilename): PhpPresentation { // Unserialize... First make sure the file supports it! if (!$this->fileSupportsUnserializePhpPresentation($pFilename)) { - throw new InvalidFileFormatException($pFilename, PowerPoint2007::class); + throw new InvalidFileFormatException($pFilename, self::class); } return $this->loadFile($pFilename); @@ -184,7 +184,7 @@ protected function loadFile(string $pFilename): PhpPresentation protected function loadDocumentLayout(string $sPart): void { $xmlReader = new XMLReader(); - /* @phpstan-ignore-next-line */ + // @phpstan-ignore-next-line if ($xmlReader->getDomFromString($sPart)) { foreach ($xmlReader->getElements('/p:presentation/p:sldSz') as $oElement) { if (!($oElement instanceof DOMElement)) { @@ -211,7 +211,7 @@ protected function loadDocumentLayout(string $sPart): void protected function loadDocumentProperties(string $sPart): void { $xmlReader = new XMLReader(); - /* @phpstan-ignore-next-line */ + // @phpstan-ignore-next-line if ($xmlReader->getDomFromString($sPart)) { $arrayProperties = [ '/cp:coreProperties/dc:creator' => 'setCreator', @@ -246,7 +246,7 @@ protected function loadCustomProperties(string $sPart): void { $xmlReader = new XMLReader(); $sPart = str_replace(' xmlns="http://schemas.openxmlformats.org/officeDocument/2006/custom-properties"', '', $sPart); - /* @phpstan-ignore-next-line */ + // @phpstan-ignore-next-line if ($xmlReader->getDomFromString($sPart)) { foreach ($xmlReader->getElements('/Properties/property[@fmtid="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}"]') as $element) { if (!$element->hasAttribute('name')) { @@ -289,12 +289,12 @@ protected function loadCustomProperties(string $sPart): void } /** - * Read Presentation Properties + * Read Presentation Properties. */ protected function loadPresentationProperties(string $sPart): void { $xmlReader = new XMLReader(); - /* @phpstan-ignore-next-line */ + // @phpstan-ignore-next-line if ($xmlReader->getDomFromString($sPart)) { $element = $xmlReader->getElement('/p:presentationPr/p:showPr'); if ($element instanceof DOMElement) { @@ -328,25 +328,25 @@ protected function loadPresentationProperties(string $sPart): void protected function loadViewProperties(string $sPart): void { $xmlReader = new XMLReader(); - /* @phpstan-ignore-next-line */ + // @phpstan-ignore-next-line if ($xmlReader->getDomFromString($sPart)) { $pathZoom = '/p:viewPr/p:slideViewPr/p:cSldViewPr/p:cViewPr/p:scale/a:sx'; $oElement = $xmlReader->getElement($pathZoom); if ($oElement instanceof DOMElement) { if ($oElement->hasAttribute('d') && $oElement->hasAttribute('n')) { - $this->oPhpPresentation->getPresentationProperties()->setZoom($oElement->getAttribute('n') / $oElement->getAttribute('d')); + $this->oPhpPresentation->getPresentationProperties()->setZoom((int) $oElement->getAttribute('n') / (int) $oElement->getAttribute('d')); } } } } /** - * Extract all slides + * Extract all slides. */ protected function loadSlides(string $sPart): void { $xmlReader = new XMLReader(); - /* @phpstan-ignore-next-line */ + // @phpstan-ignore-next-line if ($xmlReader->getDomFromString($sPart)) { $fileRels = 'ppt/_rels/presentation.xml.rels'; $this->loadRels($fileRels); @@ -377,7 +377,7 @@ protected function loadSlides(string $sPart): void } /** - * Extract all MasterSlides + * Extract all MasterSlides. */ protected function loadMasterSlides(XMLReader $xmlReader, string $fileRels): void { @@ -401,12 +401,12 @@ protected function loadMasterSlides(XMLReader $xmlReader, string $fileRels): voi } /** - * Extract data from slide + * Extract data from slide. */ protected function loadSlide(string $sPart, string $baseFile): void { $xmlReader = new XMLReader(); - /* @phpstan-ignore-next-line */ + // @phpstan-ignore-next-line if ($xmlReader->getDomFromString($sPart)) { // Core $oSlide = $this->oPhpPresentation->createSlide(); @@ -449,8 +449,8 @@ protected function loadSlide(string $sPart, string $baseFile): void $pathImage = explode('/', $pathImage); foreach ($pathImage as $key => $partPath) { if ('..' == $partPath) { - unset($pathImage[$key - 1]); - unset($pathImage[$key]); + unset($pathImage[$key - 1], $pathImage[$key]); + } } $pathImage = implode('/', $pathImage); @@ -480,6 +480,7 @@ protected function loadSlide(string $sPart, string $baseFile): void if (array_key_exists($layoutBasename, $this->arraySlideLayouts)) { $oSlide->setSlideLayout($this->arraySlideLayouts[$layoutBasename]); } + break; } } @@ -489,7 +490,7 @@ protected function loadSlide(string $sPart, string $baseFile): void protected function loadMasterSlide(string $sPart, string $baseFile): void { $xmlReader = new XMLReader(); - /* @phpstan-ignore-next-line */ + // @phpstan-ignore-next-line if ($xmlReader->getDomFromString($sPart)) { // Core $oSlideMaster = $this->oPhpPresentation->createMasterSlide(); @@ -533,7 +534,7 @@ protected function loadMasterSlide(string $sPart, string $baseFile): void } else { $level = str_replace('a:lvl', '', $oElementLvl->nodeName); $level = str_replace('pPr', '', $level); - $level = intval($level); + $level = (int) $level; } if ($oElementLvl->hasAttribute('algn')) { @@ -557,7 +558,7 @@ protected function loadMasterSlide(string $sPart, string $baseFile): void $oElementLvlDefRPR = $xmlReader->getElement('a:defRPr', $oElementLvl); if ($oElementLvlDefRPR instanceof DOMElement) { if ($oElementLvlDefRPR->hasAttribute('sz')) { - $oRTParagraph->getFont()->setSize((int) ($oElementLvlDefRPR->getAttribute('sz') / 100)); + $oRTParagraph->getFont()->setSize((int) ((int) $oElementLvlDefRPR->getAttribute('sz') / 100)); } if ($oElementLvlDefRPR->hasAttribute('b') && 1 == $oElementLvlDefRPR->getAttribute('b')) { $oRTParagraph->getFont()->setBold(true); @@ -578,12 +579,15 @@ protected function loadMasterSlide(string $sPart, string $baseFile): void switch ($oElementTxStyle->nodeName) { case 'p:bodyStyle': $oSlideMaster->getTextStyles()->setBodyStyleAtLvl($oRTParagraph, $level); + break; case 'p:otherStyle': $oSlideMaster->getTextStyles()->setOtherStyleAtLvl($oRTParagraph, $level); + break; case 'p:titleStyle': $oSlideMaster->getTextStyles()->setTitleStyleAtLvl($oRTParagraph, $level); + break; } } @@ -596,6 +600,7 @@ protected function loadMasterSlide(string $sPart, string $baseFile): void if (false !== $pptTheme) { $this->loadTheme($pptTheme, $oSlideMaster); } + break; } } @@ -625,7 +630,7 @@ protected function loadMasterSlide(string $sPart, string $baseFile): void protected function loadLayoutSlide(string $sPart, string $baseFile, SlideMaster $oSlideMaster): ?SlideLayout { $xmlReader = new XMLReader(); - /* @phpstan-ignore-next-line */ + // @phpstan-ignore-next-line if ($xmlReader->getDomFromString($sPart)) { // Core $oSlideLayout = new SlideLayout($oSlideMaster); @@ -660,14 +665,14 @@ protected function loadLayoutSlide(string $sPart, string $baseFile, SlideMaster return $oSlideLayout; } - /* @phpstan-ignore-next-line */ + // @phpstan-ignore-next-line return null; } protected function loadTheme(string $sPart, SlideMaster $oSlideMaster): void { $xmlReader = new XMLReader(); - /* @phpstan-ignore-next-line */ + // @phpstan-ignore-next-line if ($xmlReader->getDomFromString($sPart)) { $oElements = $xmlReader->getElements('/a:theme/a:themeElements/a:clrScheme/*'); foreach ($oElements as $oElement) { @@ -726,8 +731,8 @@ protected function loadSlideBackground(XMLReader $xmlReader, DOMElement $oElemen $pathImage = explode('/', $pathImage); foreach ($pathImage as $key => $partPath) { if ('..' == $partPath) { - unset($pathImage[$key - 1]); - unset($pathImage[$key]); + unset($pathImage[$key - 1], $pathImage[$key]); + } } $pathImage = implode('/', $pathImage); @@ -748,7 +753,7 @@ protected function loadSlideNote(string $baseFile, Slide $oSlide): void { $sPart = $this->oZip->getFromName('ppt/notesSlides/' . $baseFile); $xmlReader = new XMLReader(); - /* @phpstan-ignore-next-line */ + // @phpstan-ignore-next-line if ($xmlReader->getDomFromString($sPart)) { $oNote = $oSlide->getNote(); @@ -791,8 +796,8 @@ protected function loadShapeDrawing(XMLReader $document, DOMElement $node, Abstr $pathImage = explode('/', $pathImage); foreach ($pathImage as $key => $partPath) { if ('..' == $partPath) { - unset($pathImage[$key - 1]); - unset($pathImage[$key]); + unset($pathImage[$key - 1], $pathImage[$key]); + } } $pathImage = implode('/', $pathImage); @@ -1115,20 +1120,20 @@ protected function loadParagraph(XMLReader $document, DOMElement $oElement, $oSh $oElementLineSpacingPoints = $document->getElement('a:lnSpc/a:spcPts', $oSubElement); if ($oElementLineSpacingPoints instanceof DOMElement) { $oParagraph->setLineSpacingMode(Paragraph::LINE_SPACING_MODE_POINT); - $oParagraph->setLineSpacing($oElementLineSpacingPoints->getAttribute('val') / 100); + $oParagraph->setLineSpacing((int) $oElementLineSpacingPoints->getAttribute('val') / 100); } $oElementLineSpacingPercent = $document->getElement('a:lnSpc/a:spcPct', $oSubElement); if ($oElementLineSpacingPercent instanceof DOMElement) { $oParagraph->setLineSpacingMode(Paragraph::LINE_SPACING_MODE_PERCENT); - $oParagraph->setLineSpacing($oElementLineSpacingPercent->getAttribute('val') / 1000); + $oParagraph->setLineSpacing((int) $oElementLineSpacingPercent->getAttribute('val') / 1000); } $oElementSpacingBefore = $document->getElement('a:spcBef/a:spcPts', $oSubElement); if ($oElementSpacingBefore instanceof DOMElement) { - $oParagraph->setSpacingBefore($oElementSpacingBefore->getAttribute('val') / 100); + $oParagraph->setSpacingBefore((int) $oElementSpacingBefore->getAttribute('val') / 100); } $oElementSpacingAfter = $document->getElement('a:spcAft/a:spcPts', $oSubElement); if ($oElementSpacingAfter instanceof DOMElement) { - $oParagraph->setSpacingAfter($oElementSpacingAfter->getAttribute('val') / 100); + $oParagraph->setSpacingAfter((int) $oElementSpacingAfter->getAttribute('val') / 100); } $oParagraph->getBulletStyle()->setBulletType(Bullet::TYPE_NONE); @@ -1194,7 +1199,7 @@ protected function loadParagraph(XMLReader $document, DOMElement $oElement, $oSh $oText->getFont()->setStrikethrough('noStrike' == $oElementrPr->getAttribute('strike') ? false : true); } if ($oElementrPr->hasAttribute('sz')) { - $oText->getFont()->setSize((int) ($oElementrPr->getAttribute('sz') / 100)); + $oText->getFont()->setSize((int) ((int) $oElementrPr->getAttribute('sz') / 100)); } if ($oElementrPr->hasAttribute('u')) { $oText->getFont()->setUnderline($oElementrPr->getAttribute('u')); @@ -1264,7 +1269,7 @@ protected function loadHyperlink(XMLReader $xmlReader, DOMElement $element, Hype protected function loadStyleBorder(XMLReader $xmlReader, DOMElement $oElement, Border $oBorder): void { if ($oElement->hasAttribute('w')) { - $oBorder->setLineWidth((int) ($oElement->getAttribute('w') / 12700)); + $oBorder->setLineWidth((int) ((int) $oElement->getAttribute('w') / 12700)); } if ($oElement->hasAttribute('cmpd')) { $oBorder->setLineStyle($oElement->getAttribute('cmpd')); @@ -1292,7 +1297,7 @@ protected function loadStyleColor(XMLReader $xmlReader, DOMElement $oElement): C $oColor->setRGB($oElement->getAttribute('val')); $oElementAlpha = $xmlReader->getElement('a:alpha', $oElement); if ($oElementAlpha instanceof DOMElement && $oElementAlpha->hasAttribute('val')) { - $alpha = strtoupper(dechex((($oElementAlpha->getAttribute('val') / 1000) / 100) * 255)); + $alpha = strtoupper(dechex((((int) $oElementAlpha->getAttribute('val') / 1000) / 100) * 255)); $oColor->setRGB($oElement->getAttribute('val'), $alpha); } @@ -1347,7 +1352,7 @@ protected function loadRels(string $fileRels): void $sPart = $this->oZip->getFromName($fileRels); if (false !== $sPart) { $xmlReader = new XMLReader(); - /* @phpstan-ignore-next-line */ + // @phpstan-ignore-next-line if ($xmlReader->getDomFromString($sPart)) { foreach ($xmlReader->getElements('*') as $oNode) { if (!($oNode instanceof DOMElement)) { @@ -1366,8 +1371,6 @@ protected function loadRels(string $fileRels): void * @param AbstractSlide|Note $oSlide * @param DOMNodeList<DOMNode> $oElements * - * @throws FeatureNotImplementedException - * * @internal param $baseFile */ protected function loadSlideShapes($oSlide, DOMNodeList $oElements, XMLReader $xmlReader): void @@ -1379,12 +1382,15 @@ protected function loadSlideShapes($oSlide, DOMNodeList $oElements, XMLReader $x switch ($oNode->tagName) { case 'p:graphicFrame': $this->loadShapeTable($xmlReader, $oNode, $oSlide); + break; case 'p:pic': $this->loadShapeDrawing($xmlReader, $oNode, $oSlide); + break; case 'p:sp': $this->loadShapeRichText($xmlReader, $oNode, $oSlide); + break; default: //throw new FeatureNotImplementedException(); diff --git a/src/PhpPresentation/Reader/PowerPoint97.php b/src/PhpPresentation/Reader/PowerPoint97.php index b28b9fa4f..94a60416d 100644 --- a/src/PhpPresentation/Reader/PowerPoint97.php +++ b/src/PhpPresentation/Reader/PowerPoint97.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -299,85 +298,99 @@ class PowerPoint97 implements ReaderInterface * @var array<int, string> */ private $arrayFonts = []; + /** * Array with Hyperlinks. * * @var array<int, array<string, string>> */ private $arrayHyperlinks = []; + /** * Array with Notes. * * @var array<int, int> */ private $arrayNotes = []; + /** * Array with Pictures. * * @var array<int, string> */ private $arrayPictures = []; + /** * Offset (in bytes) from the beginning of the PowerPoint Document Stream to the UserEditAtom record for the most recent user edit. * * @var int */ private $offsetToCurrentEdit; + /** * A structure that specifies a compressed table of sequential persist object identifiers and stream offsets to associated persist objects. * * @var array<int, int> */ private $rgPersistDirEntry; + /** * Offset (in bytes) from the beginning of the PowerPoint Document Stream to the PersistDirectoryAtom record for this user edit. * * @var int */ private $offsetPersistDirectory; + /** * Output Object. * * @var PhpPresentation */ private $oPhpPresentation; + /** - * @var Group|null + * @var null|Group */ private $oCurrentGroup; + /** * @var bool */ private $bFirstShapeGroup = false; + /** * Stream "Powerpoint Document". * * @var string */ private $streamPowerpointDocument; + /** * Stream "Current User". * * @var string */ private $streamCurrentUser; + /** * Stream "Pictures". * * @var string */ private $streamPictures; + /** * @var int */ private $inMainType; + /** - * @var int|null + * @var null|int */ private $currentNote; /** - * @var string|null + * @var null|string */ private $filename; @@ -391,8 +404,6 @@ public function canRead(string $pFilename): bool /** * Does a file support UnserializePhpPresentation ? - * - * @throws FileNotFoundException */ public function fileSupportsUnserializePhpPresentation(string $pFilename = ''): bool { @@ -415,14 +426,12 @@ public function fileSupportsUnserializePhpPresentation(string $pFilename = ''): /** * Loads PhpPresentation Serialized file. - * - * @throws InvalidFileFormatException */ public function load(string $pFilename): PhpPresentation { // Unserialize... First make sure the file supports it! if (!$this->fileSupportsUnserializePhpPresentation($pFilename)) { - throw new InvalidFileFormatException($pFilename, PowerPoint97::class); + throw new InvalidFileFormatException($pFilename, self::class); } $this->filename = $pFilename; @@ -431,7 +440,7 @@ public function load(string $pFilename): PhpPresentation } /** - * Load PhpPresentation Serialized file + * Load PhpPresentation Serialized file. */ private function loadFile(): PhpPresentation { @@ -451,7 +460,7 @@ private function loadFile(): PhpPresentation } /** - * Read OLE Part + * Read OLE Part. */ private function loadOLE(): void { @@ -472,8 +481,6 @@ private function loadOLE(): void /** * Stream Pictures. * - * @throws FeatureNotImplementedException - * * @see http://msdn.microsoft.com/en-us/library/dd920746(v=office.12).aspx */ private function loadPicturesStream(): void @@ -491,12 +498,11 @@ private function loadPicturesStream(): void // OfficeArtFBSE throw new FeatureNotImplementedException(); } - if ($arrayRH['recType'] >= 0xF018 && $arrayRH['recType'] <= 0xF117) { - $arrayRecord = $this->readRecordOfficeArtBlip($stream, $pos - 8); - if ($arrayRecord['length'] > 0) { - $pos += $arrayRecord['length']; - $this->arrayPictures[] = $arrayRecord['picture']; - } + // $arrayRH['recType'] >= 0xF018 && $arrayRH['recType'] <= 0xF117 + $arrayRecord = $this->readRecordOfficeArtBlip($stream, $pos - 8); + if ($arrayRecord['length'] > 0) { + $pos += $arrayRecord['length']; + $this->arrayPictures[] = $arrayRecord['picture']; } $readSuccess = true; } @@ -506,9 +512,6 @@ private function loadPicturesStream(): void /** * Stream Current User. * - * @throws FeatureNotImplementedException - * @throws InvalidFileFormatException - * * @see http://msdn.microsoft.com/en-us/library/dd908567(v=office.12).aspx */ private function loadCurrentUserStream(): void @@ -522,20 +525,20 @@ private function loadCurrentUserStream(): void $rHeader = $this->loadRecordHeader($this->streamCurrentUser, $pos); $pos += 8; if (0x0 != $rHeader['recVer'] || 0x000 != $rHeader['recInstance'] || self::RT_CURRENTUSERATOM != $rHeader['recType']) { - throw new InvalidFileFormatException($this->filename, PowerPoint97::class, 'Location : CurrentUserAtom > RecordHeader'); + throw new InvalidFileFormatException($this->filename, self::class, 'Location : CurrentUserAtom > RecordHeader'); } // Size $size = self::getInt4d($this->streamCurrentUser, $pos); $pos += 4; if (0x00000014 != $size) { - throw new InvalidFileFormatException($this->filename, PowerPoint97::class, 'Location : CurrentUserAtom > Size'); + throw new InvalidFileFormatException($this->filename, self::class, 'Location : CurrentUserAtom > Size'); } // headerToken $headerToken = self::getInt4d($this->streamCurrentUser, $pos); $pos += 4; - if (0xF3D1C4DF == $headerToken && 0xE391C05F != $headerToken) { + if (0xF3D1C4DF == $headerToken) { // Encrypted file throw new FeatureNotImplementedException(); } @@ -548,28 +551,28 @@ private function loadCurrentUserStream(): void $lenUserName = self::getInt2d($this->streamCurrentUser, $pos); $pos += 2; if ($lenUserName > 255) { - throw new InvalidFileFormatException($this->filename, PowerPoint97::class, 'Location : CurrentUserAtom > lenUserName'); + throw new InvalidFileFormatException($this->filename, self::class, 'Location : CurrentUserAtom > lenUserName'); } // docFileVersion $docFileVersion = self::getInt2d($this->streamCurrentUser, $pos); $pos += 2; if (0x03F4 != $docFileVersion) { - throw new InvalidFileFormatException($this->filename, PowerPoint97::class, 'Location : CurrentUserAtom > docFileVersion'); + throw new InvalidFileFormatException($this->filename, self::class, 'Location : CurrentUserAtom > docFileVersion'); } // majorVersion $majorVersion = self::getInt1d($this->streamCurrentUser, $pos); ++$pos; if (0x03 != $majorVersion) { - throw new InvalidFileFormatException($this->filename, PowerPoint97::class, 'Location : CurrentUserAtom > majorVersion'); + throw new InvalidFileFormatException($this->filename, self::class, 'Location : CurrentUserAtom > majorVersion'); } // minorVersion $minorVersion = self::getInt1d($this->streamCurrentUser, $pos); ++$pos; if (0x00 != $minorVersion) { - throw new InvalidFileFormatException($this->filename, PowerPoint97::class, 'Location : CurrentUserAtom > minorVersion'); + throw new InvalidFileFormatException($this->filename, self::class, 'Location : CurrentUserAtom > minorVersion'); } // unused @@ -591,7 +594,7 @@ private function loadCurrentUserStream(): void $relVersion = self::getInt4d($this->streamCurrentUser, $pos); $pos += 4; if (0x00000008 != $relVersion && 0x00000009 != $relVersion) { - throw new InvalidFileFormatException($this->filename, PowerPoint97::class, 'Location : CurrentUserAtom > relVersion'); + throw new InvalidFileFormatException($this->filename, self::class, 'Location : CurrentUserAtom > relVersion'); } // unicodeUserName @@ -627,12 +630,15 @@ private function loadPowerpointDocumentStream(): void switch ($rHeader['recType']) { case self::RT_DOCUMENT: $this->readRecordDocumentContainer($this->streamPowerpointDocument, $pos); + break; case self::RT_NOTES: $this->readRecordNotesContainer($this->streamPowerpointDocument, $pos); + break; case self::RT_SLIDE: $this->readRecordSlideContainer($this->streamPowerpointDocument, $pos); + break; default: break; @@ -699,8 +705,6 @@ public static function getInt4d(string $data, int $pos): int * * @return array<string, int> * - * @throws FeatureNotImplementedException - * * @see https://msdn.microsoft.com/en-us/library/dd772900(v=office.12).aspx */ private function readRecordAnimationInfoContainer(string $stream, int $pos): array @@ -724,9 +728,6 @@ private function readRecordAnimationInfoContainer(string $stream, int $pos): arr /** * A container record that specifies information about the document. * - * @throws FeatureNotImplementedException - * @throws InvalidFileFormatException - * * @see http://msdn.microsoft.com/en-us/library/dd947357(v=office.12).aspx */ private function readRecordDocumentContainer(string $stream, int $pos): void @@ -734,7 +735,7 @@ private function readRecordDocumentContainer(string $stream, int $pos): void $documentAtom = $this->loadRecordHeader($stream, $pos); $pos += 8; if (0x1 != $documentAtom['recVer'] || 0x000 != $documentAtom['recInstance'] || self::RT_DOCUMENTATOM != $documentAtom['recType']) { - throw new InvalidFileFormatException($this->filename, PowerPoint97::class, 'Location : RTDocument > DocumentAtom'); + throw new InvalidFileFormatException($this->filename, self::class, 'Location : RTDocument > DocumentAtom'); } $pos += $documentAtom['recLen']; @@ -744,7 +745,7 @@ private function readRecordDocumentContainer(string $stream, int $pos): void // exObjListAtom > rh $exObjListAtom = $this->loadRecordHeader($stream, $pos); if (0x0 != $exObjListAtom['recVer'] || 0x000 != $exObjListAtom['recInstance'] || self::RT_EXTERNALOBJECTLISTATOM != $exObjListAtom['recType'] || 0x00000004 != $exObjListAtom['recLen']) { - throw new InvalidFileFormatException($this->filename, PowerPoint97::class, 'Location : RTDocument > DocumentAtom > exObjList > exObjListAtom'); + throw new InvalidFileFormatException($this->filename, self::class, 'Location : RTDocument > DocumentAtom > exObjList > exObjListAtom'); } $pos += 8; // exObjListAtom > exObjIdSeed @@ -760,8 +761,8 @@ private function readRecordDocumentContainer(string $stream, int $pos): void //@link : http://msdn.microsoft.com/en-us/library/dd944995(v=office.12).aspx // exHyperlinkAtom > rh $exHyperlinkAtom = $this->loadRecordHeader($stream, $pos); - if (0x0 != $exHyperlinkAtom['recVer'] || 0x000 != $exHyperlinkAtom['recInstance'] || self::RT_EXTERNALHYPERLINKATOM != $exHyperlinkAtom['recType'] || 0x00000004 != $exObjListAtom['recLen']) { - throw new InvalidFileFormatException($this->filename, PowerPoint97::class, 'Location : RTDocument > DocumentAtom > exObjList > rgChildRec > RT_ExternalHyperlink'); + if (0x0 != $exHyperlinkAtom['recVer'] || 0x000 != $exHyperlinkAtom['recInstance'] || self::RT_EXTERNALHYPERLINKATOM != $exHyperlinkAtom['recType'] || 0x00000004 != $exHyperlinkAtom['recLen']) { + throw new InvalidFileFormatException($this->filename, self::class, 'Location : RTDocument > DocumentAtom > exObjList > rgChildRec > RT_ExternalHyperlink'); } $pos += 8; $exObjList['recLen'] -= 8; @@ -810,6 +811,7 @@ private function readRecordDocumentContainer(string $stream, int $pos): void $string .= chr($char); } } + break; default: // var_dump(dechex((int) $childRec['recType'])); @@ -838,7 +840,7 @@ private function readRecordDocumentContainer(string $stream, int $pos): void $pos += 8; $fontCollection['recLen'] -= 8; if (0x0 != $fontEntityAtom['recVer'] || $fontEntityAtom['recInstance'] > 128 || self::RT_FONTENTITYATOM != $fontEntityAtom['recType']) { - throw new InvalidFileFormatException($this->filename, PowerPoint97::class, 'Location : RTDocument > RT_Environment > RT_FontCollection > RT_FontEntityAtom'); + throw new InvalidFileFormatException($this->filename, self::class, 'Location : RTDocument > RT_Environment > RT_FontCollection > RT_FontEntityAtom'); } $string = ''; for ($inc = 0; $inc < 32; ++$inc) { @@ -1180,8 +1182,6 @@ private function readRecordMouseClickInteractiveInfoContainer(string $stream, in * * @return array<string, int> * - * @throws FeatureNotImplementedException - * * @see https://msdn.microsoft.com/en-us/library/dd925811(v=office.12).aspx */ private function readRecordMouseOverInteractiveInfoContainer(string $stream, int $pos): array @@ -1207,8 +1207,6 @@ private function readRecordMouseOverInteractiveInfoContainer(string $stream, int * * @return array{'length': int, 'picture': null|string} * - * @throws FeatureNotImplementedException - * * @see https://msdn.microsoft.com/en-us/library/dd910081(v=office.12).aspx */ private function readRecordOfficeArtBlip(string $stream, int $pos): array @@ -1240,6 +1238,7 @@ private function readRecordOfficeArtBlip(string $stream, int $pos): array // BLIPFileData $arrayReturn['picture'] = substr($this->streamPictures, $pos + $arrayReturn['length'], $data['recLen']); $arrayReturn['length'] += $data['recLen']; + break; default: // var_dump(dechex((int) $data['recType'])) @@ -1286,8 +1285,6 @@ private function readRecordOfficeArtChildAnchor(string $stream, int $pos) * * @return array<string, int> * - * @throws FeatureNotImplementedException - * * @see https://msdn.microsoft.com/en-us/library/dd922797(v=office.12).aspx */ private function readRecordOfficeArtClientAnchor(string $stream, int $pos) @@ -1312,6 +1309,7 @@ private function readRecordOfficeArtClientAnchor(string $stream, int $pos) $arrayReturn['height'] = (int) (self::getInt2d($stream, $pos + $arrayReturn['length']) / 6) - $arrayReturn['left']; $arrayReturn['length'] += 2; $pos += 8; + break; case 0x00000010: // record OfficeArtClientAnchor (0x00000010) @@ -1327,8 +1325,6 @@ private function readRecordOfficeArtClientAnchor(string $stream, int $pos) * * @return array{'length': int, 'alignH': string|null, 'text': string, 'numParts': int, 'numTexts': int, 'hyperlink': array<int, array<string, int>>, 'part': array{'length': int, 'strLenRT': int, 'partLength': int|float, 'bold': bool, 'italic': bool, 'underline': bool, 'fontName': string, 'fontSize': int, 'color': Color}} * - * @throws FeatureNotImplementedException - * * @see https://msdn.microsoft.com/en-us/library/dd910958(v=office.12).aspx */ private function readRecordOfficeArtClientTextbox(string $stream, int $pos) @@ -1352,9 +1348,7 @@ private function readRecordOfficeArtClientTextbox(string $stream, int $pos) $strLen = 0; do { $rhChild = $this->loadRecordHeader($stream, $pos + $arrayReturn['length']); - /* - * @link : https://msdn.microsoft.com/en-us/library/dd947039(v=office.12).aspx - */ + // @link : https://msdn.microsoft.com/en-us/library/dd947039(v=office.12).aspx // echo dechex($rhChild['recType']).'-'.$rhChild['recType'].EOL; switch ($rhChild['recType']) { case self::RT_INTERACTIVEINFO: @@ -1368,6 +1362,7 @@ private function readRecordOfficeArtClientTextbox(string $stream, int $pos) $mouseOverInfo = $this->readRecordMouseOverInteractiveInfoContainer($stream, $pos + $arrayReturn['length']); $arrayReturn['length'] += $mouseOverInfo['length']; } + break; case self::RT_STYLETEXTPROPATOM: $arrayReturn['length'] += 8; @@ -1393,6 +1388,7 @@ private function readRecordOfficeArtClientTextbox(string $stream, int $pos) $strLenRT = $strucTextCFRun['strLenRT']; $arrayReturn['length'] += $strucTextCFRun['length']; } while ($strLenRT > 0); + break; case self::RT_TEXTBYTESATOM: $arrayReturn['length'] += 8; @@ -1406,6 +1402,7 @@ private function readRecordOfficeArtClientTextbox(string $stream, int $pos) $arrayReturn['text'] .= Text::chr($char); ++$arrayReturn['length']; } + break; case self::RT_TEXTCHARSATOM: $arrayReturn['length'] += 8; @@ -1419,12 +1416,14 @@ private function readRecordOfficeArtClientTextbox(string $stream, int $pos) $arrayReturn['text'] .= Text::chr($char); $arrayReturn['length'] += 2; } + break; case self::RT_TEXTHEADERATOM: $arrayReturn['length'] += 8; // @link : http://msdn.microsoft.com/en-us/library/dd905272(v=office.12).aspx // textType $arrayReturn['length'] += 4; + break; case self::RT_TEXTINTERACTIVEINFOATOM: $arrayReturn['length'] += 8; @@ -1440,6 +1439,7 @@ private function readRecordOfficeArtClientTextbox(string $stream, int $pos) if (0x0001 == $rhChild['recInstance']) { throw new FeatureNotImplementedException(); } + break; case self::RT_TEXTSPECIALINFOATOM: $arrayReturn['length'] += 8; @@ -1450,16 +1450,19 @@ private function readRecordOfficeArtClientTextbox(string $stream, int $pos) $strLenRT = $structTextSIRun['strLenRT']; $arrayReturn['length'] += $structTextSIRun['length']; } while ($strLenRT > 0); + break; case self::RT_TEXTRULERATOM: $arrayReturn['length'] += 8; // @link : http://msdn.microsoft.com/en-us/library/dd953212(v=office.12).aspx $structRuler = $this->readStructureTextRuler($stream, $pos + $arrayReturn['length']); $arrayReturn['length'] += $structRuler['length']; + break; case self::RT_SLIDENUMBERMETACHARATOM: $datasRecord = $this->readRecordSlideNumberMCAtom($stream, $pos + $arrayReturn['length']); $arrayReturn['length'] += $datasRecord['length']; + break; default: $arrayReturn['length'] += 8; @@ -1476,8 +1479,6 @@ private function readRecordOfficeArtClientTextbox(string $stream, int $pos) * * @return array{'length': int, 'shape': null|AbstractShape} * - * @throws InvalidFileFormatException - * * @see https://msdn.microsoft.com/en-us/library/dd943794(v=office.12).aspx */ private function readRecordOfficeArtSpContainer(string $stream, int $pos) @@ -1498,7 +1499,7 @@ private function readRecordOfficeArtSpContainer(string $stream, int $pos) // shapeProp $shapeProp = $this->readRecordOfficeArtFSP($stream, $pos + $arrayReturn['length']); if (0 == $shapeProp['length']) { - throw new InvalidFileFormatException($this->filename, PowerPoint97::class); + throw new InvalidFileFormatException($this->filename, self::class); } $arrayReturn['length'] += $shapeProp['length']; @@ -1594,7 +1595,7 @@ private function readRecordOfficeArtSpContainer(string $stream, int $pos) $start = 0; $lastLevel = -1; $lastMarginLeft = 0; - /* @phpstan-ignore-next-line */ + // @phpstan-ignore-next-line for ($inc = 1; $inc <= $clientTextbox['numParts']; ++$inc) { if ($clientTextbox['numParts'] == $clientTextbox['numTexts'] && isset($clientTextbox['text' . $inc])) { if (isset($clientTextbox['text' . $inc]['bulletChar'])) { @@ -1621,7 +1622,7 @@ private function readRecordOfficeArtSpContainer(string $stream, int $pos) } } // Texte - $sText = substr(isset($clientTextbox['text']) ? $clientTextbox['text'] : '', $start, $clientTextbox['part' . $inc]['partLength']); + $sText = substr($clientTextbox['text'] ?? '', $start, $clientTextbox['part' . $inc]['partLength']); $sHyperlinkURL = ''; if (empty($sText)) { // Is there a hyperlink ? @@ -1630,6 +1631,7 @@ private function readRecordOfficeArtSpContainer(string $stream, int $pos) if ($itmHyperlink['start'] == $start && ($itmHyperlink['end'] - $itmHyperlink['start']) == (float) $clientTextbox['part' . $inc]['partLength']) { $sText = $this->arrayHyperlinks[$itmHyperlink['id']]['text']; $sHyperlinkURL = $this->arrayHyperlinks[$itmHyperlink['id']]['url']; + break; } } @@ -1746,8 +1748,6 @@ private function readRecordOfficeArtSpContainer(string $stream, int $pos) * * @return array<string, int> * - * @throws InvalidFileFormatException - * * @see : https://msdn.microsoft.com/en-us/library/dd910416(v=office.12).aspx */ private function readRecordOfficeArtSpgrContainer($stream, $pos, $bInGroup = false) @@ -1763,7 +1763,7 @@ private function readRecordOfficeArtSpgrContainer($stream, $pos, $bInGroup = fal do { $rhFileBlock = $this->loadRecordHeader($stream, $pos + $arrayReturn['length']); if (!(0xF == $rhFileBlock['recVer'] && 0x0000 == $rhFileBlock['recInstance'] && (0xF003 == $rhFileBlock['recType'] || 0xF004 == $rhFileBlock['recType']))) { - throw new InvalidFileFormatException($this->filename, PowerPoint97::class); + throw new InvalidFileFormatException($this->filename, self::class); } switch ($rhFileBlock['recType']) { @@ -1775,6 +1775,7 @@ private function readRecordOfficeArtSpgrContainer($stream, $pos, $bInGroup = fal $fileBlock = $this->readRecordOfficeArtSpgrContainer($stream, $pos + $arrayReturn['length'], true); $arrayReturn['length'] += $fileBlock['length']; $data['recLen'] -= $fileBlock['length']; + break; case 0xF004: // Core @@ -1787,7 +1788,7 @@ private function readRecordOfficeArtSpgrContainer($stream, $pos, $bInGroup = fal $data['recLen'] -= $fileBlock['length']; // Core //@todo - if (!is_null($fileBlock['shape'])) { + if (null !== $fileBlock['shape']) { switch ($this->inMainType) { case self::RT_NOTES: $arrayIdxSlide = array_flip($this->arrayNotes); @@ -1797,6 +1798,7 @@ private function readRecordOfficeArtSpgrContainer($stream, $pos, $bInGroup = fal $oSlide->getNote()->addShape($fileBlock['shape']); } } + break; case self::RT_SLIDE: if ($bInGroup) { @@ -1804,6 +1806,7 @@ private function readRecordOfficeArtSpgrContainer($stream, $pos, $bInGroup = fal } else { $this->oPhpPresentation->getActiveSlide()->addShape($fileBlock['shape']); } + break; } } @@ -1821,8 +1824,6 @@ private function readRecordOfficeArtSpgrContainer($stream, $pos, $bInGroup = fal * * @return array<string, int> * - * @throws FeatureNotImplementedException - * * @see https://msdn.microsoft.com/en-us/library/dd950206(v=office.12).aspx */ private function readRecordOfficeArtTertiaryFOPT(string $stream, int $pos) @@ -1862,6 +1863,7 @@ private function readRecordOfficeArtTertiaryFOPT(string $stream, int $pos) if (0x1 == $opt['fComplex']) { $arrayReturn['length'] += $opt['op']; } + break; case 0x03A9: // GroupShape : metroBlob @@ -1869,6 +1871,7 @@ private function readRecordOfficeArtTertiaryFOPT(string $stream, int $pos) if (0x1 == $opt['fComplex']) { $arrayReturn['length'] += $opt['op']; } + break; case 0x01FF: // Line Style Boolean @@ -1950,7 +1953,7 @@ private function readRecordOfficeArtFDG(string $stream, int $pos): array /** * The OfficeArtFOPT record specifies a table of OfficeArtRGFOPTE records. * - * @return array<string, int|string|bool> + * @return array<string, bool|int|string> * * @see https://msdn.microsoft.com/en-us/library/dd943404(v=office.12).aspx */ @@ -1989,6 +1992,7 @@ private function readRecordOfficeArtFOPT(string $stream, int $pos): array // Transform : rotation //@link : https://msdn.microsoft.com/en-us/library/dd949750(v=office.12).aspx $arrayReturn['rotation'] = $opt['op']; + break; case 0x007F: // Transform : Protection Boolean Properties @@ -2002,21 +2006,25 @@ private function readRecordOfficeArtFOPT(string $stream, int $pos): array // Text : dxTextLeft //@link : http://msdn.microsoft.com/en-us/library/dd953234(v=office.12).aspx $arrayReturn['insetLeft'] = \PhpOffice\Common\Drawing::emuToPixels((int) $opt['op']); + break; case 0x0082: // Text : dyTextTop //@link : http://msdn.microsoft.com/en-us/library/dd925068(v=office.12).aspx $arrayReturn['insetTop'] = \PhpOffice\Common\Drawing::emuToPixels((int) $opt['op']); + break; case 0x0083: // Text : dxTextRight //@link : http://msdn.microsoft.com/en-us/library/dd906782(v=office.12).aspx $arrayReturn['insetRight'] = \PhpOffice\Common\Drawing::emuToPixels((int) $opt['op']); + break; case 0x0084: // Text : dyTextBottom //@link : http://msdn.microsoft.com/en-us/library/dd772858(v=office.12).aspx $arrayReturn['insetBottom'] = \PhpOffice\Common\Drawing::emuToPixels((int) $opt['op']); + break; case 0x0085: // Text : WrapText @@ -2036,9 +2044,9 @@ private function readRecordOfficeArtFOPT(string $stream, int $pos): array if (0 == $opt['fComplex']) { $arrayReturn['pib'] = $opt['op']; $data['recLen'] -= $opt['op']; - } else { - // pib Complex } + // pib Complex + break; case 0x13F: // Blip Boolean Properties @@ -2068,6 +2076,7 @@ private function readRecordOfficeArtFOPT(string $stream, int $pos): array // Geometry : shapePath //@link : http://msdn.microsoft.com/en-us/library/dd945249(v=office.12).aspx $arrayReturn['line'] = true; + break; case 0x145: // Geometry : pVertices @@ -2076,6 +2085,7 @@ private function readRecordOfficeArtFOPT(string $stream, int $pos): array $arrayReturn['length'] += $opt['op']; $data['recLen'] -= $opt['op']; } + break; case 0x146: // Geometry : pSegmentInfo @@ -2084,6 +2094,7 @@ private function readRecordOfficeArtFOPT(string $stream, int $pos): array $arrayReturn['length'] += $opt['op']; $data['recLen'] -= $opt['op']; } + break; case 0x155: // Geometry : pAdjustHandles @@ -2092,6 +2103,7 @@ private function readRecordOfficeArtFOPT(string $stream, int $pos): array $arrayReturn['length'] += $opt['op']; $data['recLen'] -= $opt['op']; } + break; case 0x156: // Geometry : pGuides @@ -2100,6 +2112,7 @@ private function readRecordOfficeArtFOPT(string $stream, int $pos): array $arrayReturn['length'] += $opt['op']; $data['recLen'] -= $opt['op']; } + break; case 0x157: // Geometry : pInscribe @@ -2108,6 +2121,7 @@ private function readRecordOfficeArtFOPT(string $stream, int $pos): array $arrayReturn['length'] += $opt['op']; $data['recLen'] -= $opt['op']; } + break; case 0x17F: // Geometry Boolean Properties @@ -2154,6 +2168,7 @@ private function readRecordOfficeArtFOPT(string $stream, int $pos): array $strColor .= str_pad(dechex(($opt['op'] >> 8) & bindec('11111111')), 2, '0', STR_PAD_LEFT); $strColor .= str_pad(dechex(($opt['op'] >> 16) & bindec('11111111')), 2, '0', STR_PAD_LEFT); $arrayReturn['lineColor'] = $strColor; + break; case 0x01C1: // Line Style : lineOpacity @@ -2168,6 +2183,7 @@ private function readRecordOfficeArtFOPT(string $stream, int $pos): array // Line Style : lineWidth //@link : http://msdn.microsoft.com/en-us/library/dd926964(v=office.12).aspx $arrayReturn['lineWidth'] = \PhpOffice\Common\Drawing::emuToPixels((int) $opt['op']); + break; case 0x01D6: // Line Style : lineJoinStyle @@ -2193,11 +2209,13 @@ private function readRecordOfficeArtFOPT(string $stream, int $pos): array // Shadow Style : shadowOffsetX //@link : http://msdn.microsoft.com/en-us/library/dd945280(v=office.12).aspx $arrayReturn['shadowOffsetX'] = \PhpOffice\Common\Drawing::emuToPixels((int) $opt['op']); + break; case 0x0206: // Shadow Style : shadowOffsetY //@link : http://msdn.microsoft.com/en-us/library/dd907855(v=office.12).aspx $arrayReturn['shadowOffsetY'] = \PhpOffice\Common\Drawing::emuToPixels((int) $opt['op']); + break; case 0x023F: // Shadow Style : Shadow Style Boolean Properties @@ -2218,6 +2236,7 @@ private function readRecordOfficeArtFOPT(string $stream, int $pos): array $arrayReturn['length'] += $opt['op']; $data['recLen'] -= $opt['op']; } + break; case 0x03BF: // Group Shape Property Set : Group Shape Boolean Properties @@ -2344,8 +2363,6 @@ private function readRecordOfficeArtSecondaryFOPT(string $stream, int $pos): arr * * @return array<string, int> * - * @throws FeatureNotImplementedException - * * @see : https://msdn.microsoft.com/en-us/library/dd950927(v=office.12).aspx */ private function readRecordOfficeArtClientData(string $stream, int $pos): array @@ -2404,14 +2421,17 @@ private function readRecordOfficeArtClientData(string $stream, int $pos): array case self::RT_PROGTAGS: $dataRG = $this->readRecordShapeProgTagsContainer($stream, $pos + $arrayReturn['length']); $arrayReturn['length'] += $dataRG['length']; + break; case self::RT_ROUNDTRIPHFPLACEHOLDER12ATOM: $dataRG = $this->readRecordRoundTripHFPlaceholder12Atom($stream, $pos + $arrayReturn['length']); $arrayReturn['length'] += $dataRG['length']; + break; case self::RT_ROUNDTRIPSHAPEID12ATOM: $dataRG = $this->readRecordRoundTripShapeId12Atom($stream, $pos + $arrayReturn['length']); $arrayReturn['length'] += $dataRG['length']; + break; default: // var_dump('0x' . dechex($dataHeaderRG['recType'])); @@ -2428,15 +2448,13 @@ private function readRecordOfficeArtClientData(string $stream, int $pos): array * An atom record that specifies a persist object directory. Each persist object identifier specified MUST be unique in that persist object directory. * * @see http://msdn.microsoft.com/en-us/library/dd952680(v=office.12).aspx - * - * @throws InvalidFileFormatException */ private function readRecordPersistDirectoryAtom(string $stream, int $pos): void { $rHeader = $this->loadRecordHeader($stream, $pos); $pos += 8; if (0x0 != $rHeader['recVer'] || 0x000 != $rHeader['recInstance'] || self::RT_PERSISTDIRECTORYATOM != $rHeader['recType']) { - throw new InvalidFileFormatException($this->filename, PowerPoint97::class, 'Location : PersistDirectoryAtom > RecordHeader'); + throw new InvalidFileFormatException($this->filename, self::class, 'Location : PersistDirectoryAtom > RecordHeader'); } // rgPersistDirEntry // @link : http://msdn.microsoft.com/en-us/library/dd947347(v=office.12).aspx @@ -2678,8 +2696,6 @@ private function readRecordShapeProgBinaryTagContainer(string $stream, int $pos) * * @return array<string, int> * - * @throws FeatureNotImplementedException - * * @see https://msdn.microsoft.com/en-us/library/dd911266(v=office.12).aspx */ private function readRecordShapeProgTagsContainer(string $stream, int $pos): array @@ -2700,6 +2716,7 @@ private function readRecordShapeProgTagsContainer(string $stream, int $pos): arr case self::RT_PROGBINARYTAG: $dataRG = $this->readRecordShapeProgBinaryTagContainer($stream, $pos + $arrayReturn['length'] + $length); $length += $dataRG['length']; + break; //case self::RT_PROGSTRINGTAG: default: @@ -2756,8 +2773,6 @@ private function readRecordSlideAtom(string $stream, int $pos): array /** * A container record that specifies a presentation slide or title master slide. * - * @throws InvalidFileFormatException - * * @see http://msdn.microsoft.com/en-us/library/dd946323(v=office.12).aspx */ private function readRecordSlideContainer(string $stream, int $pos): void @@ -2769,7 +2784,7 @@ private function readRecordSlideContainer(string $stream, int $pos): void // *** slideAtom (32 bytes) $slideAtom = $this->readRecordSlideAtom($stream, $pos); if (0 == $slideAtom['length']) { - throw new InvalidFileFormatException($this->filename, PowerPoint97::class); + throw new InvalidFileFormatException($this->filename, self::class); } $pos += $slideAtom['length']; @@ -2793,7 +2808,7 @@ private function readRecordSlideContainer(string $stream, int $pos): void $slideSchemeColorAtom = $this->readRecordSlideSchemeColorSchemeAtom($stream, $pos); if (0 == $slideSchemeColorAtom['length']) { // Record SlideSchemeColorSchemeAtom - throw new InvalidFileFormatException($this->filename, PowerPoint97::class); + throw new InvalidFileFormatException($this->filename, self::class); } $pos += $slideSchemeColorAtom['length']; @@ -2946,15 +2961,13 @@ private function readRecordSlideShowSlideInfoAtom(string $stream, int $pos): arr * UserEditAtom. * * @see http://msdn.microsoft.com/en-us/library/dd945746(v=office.12).aspx - * - * @throws InvalidFileFormatException */ private function readRecordUserEditAtom(string $stream, int $pos): void { $rHeader = $this->loadRecordHeader($stream, $pos); $pos += 8; if (0x0 != $rHeader['recVer'] || 0x000 != $rHeader['recInstance'] || self::RT_USEREDITATOM != $rHeader['recType'] || (0x0000001C != $rHeader['recLen'] && 0x00000020 != $rHeader['recLen'])) { - throw new InvalidFileFormatException($this->filename, PowerPoint97::class, 'Location : UserEditAtom > RecordHeader'); + throw new InvalidFileFormatException($this->filename, self::class, 'Location : UserEditAtom > RecordHeader'); } // lastSlideIdRef @@ -2966,14 +2979,14 @@ private function readRecordUserEditAtom(string $stream, int $pos): void $minorVersion = self::getInt1d($stream, $pos); ++$pos; if (0x00 != $minorVersion) { - throw new InvalidFileFormatException($this->filename, PowerPoint97::class, 'Location : UserEditAtom > minorVersion'); + throw new InvalidFileFormatException($this->filename, self::class, 'Location : UserEditAtom > minorVersion'); } // majorVersion $majorVersion = self::getInt1d($stream, $pos); ++$pos; if (0x03 != $majorVersion) { - throw new InvalidFileFormatException($this->filename, PowerPoint97::class, 'Location : UserEditAtom > majorVersion'); + throw new InvalidFileFormatException($this->filename, self::class, 'Location : UserEditAtom > majorVersion'); } // offsetLastEdit @@ -2986,7 +2999,7 @@ private function readRecordUserEditAtom(string $stream, int $pos): void $docPersistIdRef = self::getInt4d($stream, $pos); $pos += 4; if (0x00000001 != $docPersistIdRef) { - throw new InvalidFileFormatException($this->filename, PowerPoint97::class, 'Location : UserEditAtom > docPersistIdRef'); + throw new InvalidFileFormatException($this->filename, self::class, 'Location : UserEditAtom > docPersistIdRef'); } // persistIdSeed @@ -3002,8 +3015,6 @@ private function readRecordUserEditAtom(string $stream, int $pos): void * * @return array{'length': int, 'strLenRT': int, 'partLength': int, 'bold': bool, 'italic': bool, 'underline': bool, 'fontName': string, 'fontSize': int, 'color': Color} * - * @throws FeatureNotImplementedException - * * @see https://msdn.microsoft.com/en-us/library/dd945870(v=office.12).aspx */ private function readStructureTextCFRun(string $stream, int $pos, int $strLenRT): array @@ -3071,7 +3082,7 @@ private function readStructureTextCFRun(string $stream, int $pos, int $strLenRT) if (1 == $masksData['typeface']) { $data = self::getInt2d($stream, $pos + $arrayReturn['length']); $arrayReturn['length'] += 2; - $arrayReturn['fontName'] = isset($this->arrayFonts[$data]) ? $this->arrayFonts[$data] : ''; + $arrayReturn['fontName'] = $this->arrayFonts[$data] ?? ''; } if (1 == $masksData['oldEATypeface']) { // $data = self::getInt2d($stream, $pos + $arrayReturn['length']); @@ -3119,8 +3130,6 @@ private function readStructureTextCFRun(string $stream, int $pos, int $strLenRT) * * @return array{'length': int, 'strLenRT': int, 'alignH': string|null, 'bulletChar': string, 'leftMargin': int, 'indent': int} * - * @throws FeatureNotImplementedException - * * @see https://msdn.microsoft.com/en-us/library/dd923535(v=office.12).aspx */ private function readStructureTextPFRun(string $stream, int $pos, int $strLenRT): array @@ -3214,24 +3223,31 @@ private function readStructureTextPFRun(string $stream, int $pos, int $strLenRT) switch ($data) { case 0x0000: $arrayReturn['alignH'] = Alignment::HORIZONTAL_LEFT; + break; case 0x0001: $arrayReturn['alignH'] = Alignment::HORIZONTAL_CENTER; + break; case 0x0002: $arrayReturn['alignH'] = Alignment::HORIZONTAL_RIGHT; + break; case 0x0003: $arrayReturn['alignH'] = Alignment::HORIZONTAL_JUSTIFY; + break; case 0x0004: $arrayReturn['alignH'] = Alignment::HORIZONTAL_DISTRIBUTED; + break; case 0x0005: $arrayReturn['alignH'] = Alignment::HORIZONTAL_DISTRIBUTED; + break; case 0x0006: $arrayReturn['alignH'] = Alignment::HORIZONTAL_JUSTIFY; + break; default: break; @@ -3286,8 +3302,6 @@ private function readStructureTextPFRun(string $stream, int $pos, int $strLenRT) * * @return array<string, int> * - * @throws FeatureNotImplementedException - * * @see https://msdn.microsoft.com/en-us/library/dd909603(v=office.12).aspx */ private function readStructureTextSIRun(string $stream, int $pos, int $strLenRT): array @@ -3348,8 +3362,6 @@ private function readStructureTextSIRun(string $stream, int $pos, int $strLenRT) * * @return array<string, int> * - * @throws FeatureNotImplementedException - * * @see https://msdn.microsoft.com/en-us/library/dd922749(v=office.12).aspx */ private function readStructureTextRuler(string $stream, int $pos): array @@ -3459,8 +3471,6 @@ private function readRecordNotesContainer(string $stream, int $pos): void /** * @return array<string, int> - * - * @throws InvalidFileFormatException */ private function readRecordNotesAtom(string $stream, int $pos): array { @@ -3470,7 +3480,7 @@ private function readRecordNotesAtom(string $stream, int $pos): array $data = $this->loadRecordHeader($stream, $pos); if (0x1 != $data['recVer'] || 0x000 != $data['recInstance'] || self::RT_NOTESATOM != $data['recType'] || 0x00000008 != $data['recLen']) { - throw new InvalidFileFormatException($this->filename, PowerPoint97::class, 'Location : NotesAtom > RecordHeader)'); + throw new InvalidFileFormatException($this->filename, self::class, 'Location : NotesAtom > RecordHeader)'); } // Record Header $arrayReturn['length'] += 8; diff --git a/src/PhpPresentation/Reader/ReaderInterface.php b/src/PhpPresentation/Reader/ReaderInterface.php index d3e06d393..e6a4c3ad5 100644 --- a/src/PhpPresentation/Reader/ReaderInterface.php +++ b/src/PhpPresentation/Reader/ReaderInterface.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpPresentation/Reader/Serialized.php b/src/PhpPresentation/Reader/Serialized.php index 33de31b41..208c28325 100644 --- a/src/PhpPresentation/Reader/Serialized.php +++ b/src/PhpPresentation/Reader/Serialized.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -43,8 +42,6 @@ public function canRead(string $pFilename): bool /** * Does a file support UnserializePhpPresentation ? - * - * @throws FileNotFoundException */ public function fileSupportsUnserializePhpPresentation(string $pFilename): bool { @@ -59,9 +56,6 @@ public function fileSupportsUnserializePhpPresentation(string $pFilename): bool /** * Loads PhpPresentation Serialized file. - * - * @throws FileNotFoundException - * @throws InvalidFileFormatException */ public function load(string $pFilename): PhpPresentation { @@ -72,7 +66,7 @@ public function load(string $pFilename): PhpPresentation // Unserialize... First make sure the file supports it! if (!$this->fileSupportsUnserializePhpPresentation($pFilename)) { - throw new InvalidFileFormatException($pFilename, Serialized::class); + throw new InvalidFileFormatException($pFilename, self::class); } return $this->loadSerialized($pFilename); @@ -80,19 +74,17 @@ public function load(string $pFilename): PhpPresentation /** * Load PhpPresentation Serialized file. - * - * @throws InvalidFileFormatException */ private function loadSerialized(string $pFilename): PhpPresentation { $oArchive = new ZipArchive(); if (true !== $oArchive->open($pFilename)) { - throw new InvalidFileFormatException($pFilename, Serialized::class); + throw new InvalidFileFormatException($pFilename, self::class); } $xmlContent = $oArchive->getFromName('PhpPresentation.xml'); if (empty($xmlContent)) { - throw new InvalidFileFormatException($pFilename, Serialized::class, 'The file PhpPresentation.xml is malformed'); + throw new InvalidFileFormatException($pFilename, self::class, 'The file PhpPresentation.xml is malformed'); } $xmlData = simplexml_load_string($xmlContent); diff --git a/src/PhpPresentation/Shape/AbstractGraphic.php b/src/PhpPresentation/Shape/AbstractGraphic.php index e7a4e731d..f8b464f51 100644 --- a/src/PhpPresentation/Shape/AbstractGraphic.php +++ b/src/PhpPresentation/Shape/AbstractGraphic.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -68,7 +67,7 @@ abstract class AbstractGraphic extends AbstractShape implements ComparableInterf * * @var string */ - public $relationId = null; + public $relationId; /** * Create a new \PhpOffice\PhpPresentation\Slide\AbstractDrawing. diff --git a/src/PhpPresentation/Shape/AutoShape.php b/src/PhpPresentation/Shape/AutoShape.php index 3d2c21ca5..fc52bad91 100644 --- a/src/PhpPresentation/Shape/AutoShape.php +++ b/src/PhpPresentation/Shape/AutoShape.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -25,7 +24,7 @@ use PhpOffice\PhpPresentation\Style\Outline; /** - * AutoShape shape + * AutoShape shape. * * @see : https://github.com/scanny/python-pptx/blob/eaa1e0fd3db28b03a353e116a5c7d2084dd87c26/pptx/enum/shapes.py */ @@ -238,19 +237,11 @@ public function __construct() $this->outline = new Outline(); } - /** - * @return string - */ public function getText(): string { return $this->text; } - /** - * @param string $text - * - * @return self - */ public function setText(string $text): self { $this->text = $text; @@ -258,19 +249,11 @@ public function setText(string $text): self return $this; } - /** - * @return string - */ public function getType(): string { return $this->type; } - /** - * @param string $type - * - * @return self - */ public function setType(string $type): self { $this->type = $type; @@ -278,19 +261,11 @@ public function setType(string $type): self return $this; } - /** - * @return Outline - */ public function getOutline(): Outline { return $this->outline; } - /** - * @param Outline $outline - * - * @return self - */ public function setOutline(Outline $outline): self { $this->outline = $outline; diff --git a/src/PhpPresentation/Shape/Chart.php b/src/PhpPresentation/Shape/Chart.php index 3d56b7378..35aa3d17a 100644 --- a/src/PhpPresentation/Shape/Chart.php +++ b/src/PhpPresentation/Shape/Chart.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -103,9 +102,7 @@ public function __clone() } /** - * How missing/blank values are displayed on chart (dispBlanksAs property) - * - * @return string + * How missing/blank values are displayed on chart (dispBlanksAs property). */ public function getDisplayBlankAs(): string { @@ -114,8 +111,6 @@ public function getDisplayBlankAs(): string /** * Get Title. - * - * @return Title */ public function getTitle(): Title { @@ -124,8 +119,6 @@ public function getTitle(): Title /** * Get Legend. - * - * @return Legend */ public function getLegend(): Legend { @@ -134,8 +127,6 @@ public function getLegend(): Legend /** * Get PlotArea. - * - * @return PlotArea */ public function getPlotArea(): PlotArea { @@ -144,8 +135,6 @@ public function getPlotArea(): PlotArea /** * Get View3D. - * - * @return View3D */ public function getView3D(): View3D { @@ -154,8 +143,6 @@ public function getView3D(): View3D /** * Is the spreadsheet included for editing data ? - * - * @return bool */ public function hasIncludedSpreadsheet(): bool { @@ -163,11 +150,7 @@ public function hasIncludedSpreadsheet(): bool } /** - * Define a way to display missing/blank values (dispBlanksAs property) - * - * @param string $value - * - * @return self + * Define a way to display missing/blank values (dispBlanksAs property). */ public function setDisplayBlankAs(string $value): self { @@ -180,10 +163,6 @@ public function setDisplayBlankAs(string $value): self /** * Is the spreadsheet included for editing data ? - * - * @param bool $value - * - * @return self */ public function setIncludeSpreadsheet(bool $value = false): self { @@ -194,8 +173,6 @@ public function setIncludeSpreadsheet(bool $value = false): self /** * Get indexed filename (using image index). - * - * @return string */ public function getIndexedFilename(): string { diff --git a/src/PhpPresentation/Shape/Chart/Axis.php b/src/PhpPresentation/Shape/Chart/Axis.php index 86e187870..f8588e903 100644 --- a/src/PhpPresentation/Shape/Chart/Axis.php +++ b/src/PhpPresentation/Shape/Chart/Axis.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -55,7 +54,7 @@ class Axis implements ComparableInterface private $titleRotation = 0; /** - * Format code + * Format code. * * @var string */ @@ -69,12 +68,12 @@ class Axis implements ComparableInterface private $font; /** - * @var Gridlines|null + * @var null|Gridlines */ protected $majorGridlines; /** - * @var Gridlines|null + * @var null|Gridlines */ protected $minorGridlines; @@ -147,8 +146,6 @@ public function __construct(string $title = 'Axis Title') /** * Get Title. - * - * @return string */ public function getTitle(): string { @@ -157,10 +154,6 @@ public function getTitle(): string /** * Set Title. - * - * @param string $value - * - * @return self */ public function setTitle(string $value = 'Axis Title'): self { @@ -171,8 +164,6 @@ public function setTitle(string $value = 'Axis Title'): self /** * Get font. - * - * @return Font|null */ public function getFont(): ?Font { @@ -181,12 +172,8 @@ public function getFont(): ?Font /** * Set font. - * - * @param Font|null $font - * - * @return self */ - public function setFont(Font $font = null): self + public function setFont(?Font $font = null): self { $this->font = $font; @@ -195,8 +182,6 @@ public function setFont(Font $font = null): self /** * Get Format Code. - * - * @return string */ public function getFormatCode(): string { @@ -205,10 +190,6 @@ public function getFormatCode(): string /** * Set Format Code. - * - * @param string $value - * - * @return self */ public function setFormatCode(string $value = ''): self { @@ -217,59 +198,35 @@ public function setFormatCode(string $value = ''): self return $this; } - /** - * @return int|null - */ public function getMinBounds(): ?int { return $this->minBounds; } - /** - * @param int|null $minBounds - * - * @return self - */ - public function setMinBounds(int $minBounds = null): self + public function setMinBounds(?int $minBounds = null): self { - $this->minBounds = is_null($minBounds) ? null : $minBounds; + $this->minBounds = null === $minBounds ? null : $minBounds; return $this; } - /** - * @return int|null - */ public function getMaxBounds(): ?int { return $this->maxBounds; } - /** - * @param int|null $maxBounds - * - * @return self - */ - public function setMaxBounds(int $maxBounds = null): self + public function setMaxBounds(?int $maxBounds = null): self { - $this->maxBounds = is_null($maxBounds) ? null : $maxBounds; + $this->maxBounds = null === $maxBounds ? null : $maxBounds; return $this; } - /** - * @return string - */ public function getCrossesAt(): string { return $this->crossesAt; } - /** - * @param string $value - * - * @return self - */ public function setCrossesAt(string $value = self::CROSSES_AUTO): self { $this->crossesAt = $value; @@ -277,19 +234,11 @@ public function setCrossesAt(string $value = self::CROSSES_AUTO): self return $this; } - /** - * @return bool - */ public function isReversedOrder(): bool { return $this->isReversedOrder; } - /** - * @param bool $value - * - * @return self - */ public function setIsReversedOrder(bool $value = false): self { $this->isReversedOrder = $value; @@ -321,19 +270,11 @@ public function setMinorGridlines(Gridlines $minorGridlines): self return $this; } - /** - * @return string - */ public function getMinorTickMark(): string { return $this->minorTickMark; } - /** - * @param string $tickMark - * - * @return self - */ public function setMinorTickMark(string $tickMark = self::TICK_MARK_NONE): self { $this->minorTickMark = $tickMark; @@ -341,19 +282,11 @@ public function setMinorTickMark(string $tickMark = self::TICK_MARK_NONE): self return $this; } - /** - * @return string - */ public function getMajorTickMark(): string { return $this->majorTickMark; } - /** - * @param string $tickMark - * - * @return self - */ public function setMajorTickMark(string $tickMark = self::TICK_MARK_NONE): self { $this->majorTickMark = $tickMark; @@ -361,18 +294,13 @@ public function setMajorTickMark(string $tickMark = self::TICK_MARK_NONE): self return $this; } - /** - * @return float|null - */ public function getMinorUnit(): ?float { return $this->minorUnit; } /** - * @param float|null $unit - * - * @return self + * @param null|float $unit */ public function setMinorUnit($unit = null): self { @@ -381,39 +309,23 @@ public function setMinorUnit($unit = null): self return $this; } - /** - * @return float|null - */ public function getMajorUnit(): ?float { return $this->majorUnit; } - /** - * @param float|null $unit - * - * @return self - */ - public function setMajorUnit(float $unit = null): self + public function setMajorUnit(?float $unit = null): self { $this->majorUnit = $unit; return $this; } - /** - * @return Outline - */ public function getOutline(): Outline { return $this->outline; } - /** - * @param Outline $outline - * - * @return self - */ public function setOutline(Outline $outline): self { $this->outline = $outline; @@ -421,19 +333,11 @@ public function setOutline(Outline $outline): self return $this; } - /** - * @return int - */ public function getTitleRotation(): int { return $this->titleRotation; } - /** - * @param int $titleRotation - * - * @return self - */ public function setTitleRotation(int $titleRotation): self { if ($titleRotation < 0) { @@ -448,7 +352,7 @@ public function setTitleRotation(int $titleRotation): self } /** - * Get hash code + * Get hash code. * * @return string Hash code */ @@ -470,7 +374,7 @@ public function getHashCode(): string * Note that this index may vary during script execution! Only reliable moment is * while doing a write of a workbook and when changes are not allowed. * - * @return int|null Hash index + * @return null|int Hash index */ public function getHashIndex(): ?int { @@ -496,8 +400,6 @@ public function setHashIndex(int $value) /** * Axis is hidden ? - * - * @return bool */ public function isVisible(): bool { @@ -508,8 +410,6 @@ public function isVisible(): bool * Hide an axis. * * @param bool $value delete - * - * @return self */ public function setIsVisible(bool $value): self { @@ -518,19 +418,11 @@ public function setIsVisible(bool $value): self return $this; } - /** - * @return string - */ public function getTickLabelPosition(): string { return $this->tickLabelPosition; } - /** - * @param string $value - * - * @return self - */ public function setTickLabelPosition(string $value = self::TICK_LABEL_POSITION_NEXT_TO): self { if (in_array($value, [ diff --git a/src/PhpPresentation/Shape/Chart/Gridlines.php b/src/PhpPresentation/Shape/Chart/Gridlines.php index 83f124886..e1b78e692 100644 --- a/src/PhpPresentation/Shape/Chart/Gridlines.php +++ b/src/PhpPresentation/Shape/Chart/Gridlines.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpPresentation/Shape/Chart/Legend.php b/src/PhpPresentation/Shape/Chart/Legend.php index 6878f62a8..8798ea555 100644 --- a/src/PhpPresentation/Shape/Chart/Legend.php +++ b/src/PhpPresentation/Shape/Chart/Legend.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -83,7 +82,7 @@ class Legend implements ComparableInterface /** * Font. * - * @var Font|null + * @var null|Font */ private $font; @@ -250,9 +249,9 @@ public function getFont(): ?Font /** * Set font. * - * @param Font|null $pFont Font + * @param null|Font $pFont Font */ - public function setFont(Font $pFont = null): self + public function setFont(?Font $pFont = null): self { $this->font = $pFont; @@ -348,7 +347,7 @@ public function getHashCode(): string * Note that this index may vary during script execution! Only reliable moment is * while doing a write of a workbook and when changes are not allowed. * - * @return int|null Hash index + * @return null|int Hash index */ public function getHashIndex(): ?int { diff --git a/src/PhpPresentation/Shape/Chart/Marker.php b/src/PhpPresentation/Shape/Chart/Marker.php index 008f787b3..74d41d655 100644 --- a/src/PhpPresentation/Shape/Chart/Marker.php +++ b/src/PhpPresentation/Shape/Chart/Marker.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -102,19 +101,11 @@ public function setSize(int $size = 5): self return $this; } - /** - * @return Fill - */ public function getFill(): Fill { return $this->fill; } - /** - * @param Fill $fill - * - * @return self - */ public function setFill(Fill $fill): self { $this->fill = $fill; @@ -122,19 +113,11 @@ public function setFill(Fill $fill): self return $this; } - /** - * @return Border - */ public function getBorder(): Border { return $this->border; } - /** - * @param Border $border - * - * @return self - */ public function setBorder(Border $border): self { $this->border = $border; diff --git a/src/PhpPresentation/Shape/Chart/PlotArea.php b/src/PhpPresentation/Shape/Chart/PlotArea.php index 2eb97174f..ed5482493 100644 --- a/src/PhpPresentation/Shape/Chart/PlotArea.php +++ b/src/PhpPresentation/Shape/Chart/PlotArea.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -32,7 +31,7 @@ class PlotArea implements ComparableInterface /** * Type. * - * @var AbstractType|null + * @var null|AbstractType */ private $type; @@ -90,12 +89,9 @@ public function __clone() $this->axisY = clone $this->axisY; } - /** - * @throws UndefinedChartTypeException - */ public function getType(): AbstractType { - if (is_null($this->type)) { + if (null === $this->type) { throw new UndefinedChartTypeException(); } @@ -208,7 +204,7 @@ public function setHeight(float $value = 0): self */ public function getHashCode(): string { - return md5((is_null($this->type) ? 'null' : $this->type->getHashCode()) . $this->axisX->getHashCode() . $this->axisY->getHashCode() . $this->offsetX . $this->offsetY . $this->width . $this->height . __CLASS__); + return md5((null === $this->type ? 'null' : $this->type->getHashCode()) . $this->axisX->getHashCode() . $this->axisY->getHashCode() . $this->offsetX . $this->offsetY . $this->width . $this->height . __CLASS__); } /** @@ -224,7 +220,7 @@ public function getHashCode(): string * Note that this index may vary during script execution! Only reliable moment is * while doing a write of a workbook and when changes are not allowed. * - * @return int|null Hash index + * @return null|int Hash index */ public function getHashIndex(): ?int { diff --git a/src/PhpPresentation/Shape/Chart/Series.php b/src/PhpPresentation/Shape/Chart/Series.php index ea1bf4996..226521dab 100644 --- a/src/PhpPresentation/Shape/Chart/Series.php +++ b/src/PhpPresentation/Shape/Chart/Series.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -27,7 +26,7 @@ class Series implements ComparableInterface { - /* Label positions */ + // Label positions public const LABEL_BESTFIT = 'bestFit'; public const LABEL_BOTTOM = 'b'; public const LABEL_CENTER = 'ctr'; @@ -50,20 +49,20 @@ class Series implements ComparableInterface * * @var string */ - protected $DlblNumFormat = ''; + protected $dlblNumFormat = ''; /** - * @var string|null + * @var null|string */ protected $separator; /** - * @var Fill|null + * @var null|Fill */ protected $fill; /** - * @var Font|null + * @var null|Font */ protected $font; @@ -78,7 +77,7 @@ class Series implements ComparableInterface protected $marker; /** - * @var Outline|null + * @var null|Outline */ protected $outline; @@ -134,7 +133,7 @@ class Series implements ComparableInterface /** * Values (key/value). * - * @var array<string, string|null> + * @var array<string, null|string> */ private $values = []; @@ -146,8 +145,7 @@ class Series implements ComparableInterface private $hashIndex; /** - * @param string $title - * @param array<string, string|null> $values + * @param array<string, null|string> $values */ public function __construct(string $title = 'Series Title', array $values = []) { @@ -184,7 +182,7 @@ public function setTitle(string $value = 'Series Title'): self */ public function getDlblNumFormat(): string { - return $this->DlblNumFormat; + return $this->dlblNumFormat; } /** @@ -192,7 +190,7 @@ public function getDlblNumFormat(): string */ public function hasDlblNumFormat(): bool { - return !empty($this->DlblNumFormat); + return !empty($this->dlblNumFormat); } /** @@ -200,7 +198,7 @@ public function hasDlblNumFormat(): bool */ public function setDlblNumFormat(string $value = ''): self { - $this->DlblNumFormat = $value; + $this->dlblNumFormat = $value; return $this; } @@ -213,7 +211,7 @@ public function getFill(): ?Fill return $this->fill; } - public function setFill(Fill $fill = null): self + public function setFill(?Fill $fill = null): self { $this->fill = $fill; @@ -243,7 +241,7 @@ public function getDataPointFills(): array /** * Get Values. * - * @return array<string, string|null> + * @return array<string, null|string> */ public function getValues(): array { @@ -253,7 +251,7 @@ public function getValues(): array /** * Set Values. * - * @param array<string, string|null> $values + * @param array<string, null|string> $values */ public function setValues(array $values = []): self { @@ -264,11 +262,6 @@ public function setValues(array $values = []): self /** * Add Value. - * - * @param string $key - * @param string|null $value - * - * @return self */ public function addValue(string $key, ?string $value): self { @@ -369,7 +362,7 @@ public function setShowPercentage(bool $value): self public function hasShowSeparator(): bool { - return !is_null($this->separator); + return null !== $this->separator; } public function setSeparator(?string $pValue): self @@ -419,9 +412,9 @@ public function getFont(): ?Font /** * Set font. * - * @param Font|null $pFont Font + * @param null|Font $pFont Font */ - public function setFont(Font $pFont = null): self + public function setFont(?Font $pFont = null): self { $this->font = $pFont; @@ -477,7 +470,7 @@ public function setOutline(?Outline $outline): self */ public function getHashCode(): string { - return md5((is_null($this->fill) ? 'null' : $this->fill->getHashCode()) . (is_null($this->font) ? 'null' : $this->font->getHashCode()) . var_export($this->values, true) . var_export($this, true) . __CLASS__); + return md5((null === $this->fill ? 'null' : $this->fill->getHashCode()) . (null === $this->font ? 'null' : $this->font->getHashCode()) . var_export($this->values, true) . var_export($this, true) . __CLASS__); } /** @@ -486,7 +479,7 @@ public function getHashCode(): string * Note that this index may vary during script execution! Only reliable moment is * while doing a write of a workbook and when changes are not allowed. * - * @return int|null Hash index + * @return null|int Hash index */ public function getHashIndex(): ?int { diff --git a/src/PhpPresentation/Shape/Chart/Title.php b/src/PhpPresentation/Shape/Chart/Title.php index a03165724..69494b785 100644 --- a/src/PhpPresentation/Shape/Chart/Title.php +++ b/src/PhpPresentation/Shape/Chart/Title.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -234,9 +233,9 @@ public function getFont(): ?Font /** * Set font. * - * @param Font|null $pFont Font + * @param null|Font $pFont Font */ - public function setFont(Font $pFont = null): self + public function setFont(?Font $pFont = null): self { $this->font = $pFont; @@ -281,7 +280,7 @@ public function getHashCode(): string * Note that this index may vary during script execution! Only reliable moment is * while doing a write of a workbook and when changes are not allowed. * - * @return int|null Hash index + * @return null|int Hash index */ public function getHashIndex(): ?int { diff --git a/src/PhpPresentation/Shape/Chart/Type/AbstractType.php b/src/PhpPresentation/Shape/Chart/Type/AbstractType.php index 112123115..b9bb21281 100644 --- a/src/PhpPresentation/Shape/Chart/Type/AbstractType.php +++ b/src/PhpPresentation/Shape/Chart/Type/AbstractType.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -76,7 +75,7 @@ public function hasAxisY(): bool * Note that this index may vary during script execution! Only reliable moment is * while doing a write of a workbook and when changes are not allowed. * - * @return int|null Hash index + * @return null|int Hash index */ public function getHashIndex(): ?int { diff --git a/src/PhpPresentation/Shape/Chart/Type/AbstractTypeBar.php b/src/PhpPresentation/Shape/Chart/Type/AbstractTypeBar.php index 234717698..612119598 100644 --- a/src/PhpPresentation/Shape/Chart/Type/AbstractTypeBar.php +++ b/src/PhpPresentation/Shape/Chart/Type/AbstractTypeBar.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -142,9 +141,6 @@ public function setGapWidthPercent($gapWidthPercent) return $this; } - /** - * @return int - */ public function getOverlapWidthPercent(): int { return $this->overlapWidthPercent; @@ -152,8 +148,6 @@ public function getOverlapWidthPercent(): int /** * @param int $value overlap width percentage - * - * @return self */ public function setOverlapWidthPercent(int $value): self { diff --git a/src/PhpPresentation/Shape/Chart/Type/AbstractTypeLine.php b/src/PhpPresentation/Shape/Chart/Type/AbstractTypeLine.php index 3040f0bc3..81b08bd05 100644 --- a/src/PhpPresentation/Shape/Chart/Type/AbstractTypeLine.php +++ b/src/PhpPresentation/Shape/Chart/Type/AbstractTypeLine.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -31,8 +30,6 @@ class AbstractTypeLine extends AbstractType /** * Is Line Smooth? - * - * @return bool */ public function isSmooth(): bool { @@ -40,13 +37,9 @@ public function isSmooth(): bool } /** - * Set Line Smoothness - * - * @param bool $value - * - * @return AbstractTypeLine + * Set Line Smoothness. */ - public function setIsSmooth(bool $value = true): AbstractTypeLine + public function setIsSmooth(bool $value = true): self { $this->isSmooth = $value; diff --git a/src/PhpPresentation/Shape/Chart/Type/AbstractTypePie.php b/src/PhpPresentation/Shape/Chart/Type/AbstractTypePie.php index b538d9a16..402d818ec 100644 --- a/src/PhpPresentation/Shape/Chart/Type/AbstractTypePie.php +++ b/src/PhpPresentation/Shape/Chart/Type/AbstractTypePie.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpPresentation/Shape/Chart/Type/Area.php b/src/PhpPresentation/Shape/Chart/Type/Area.php index 49fc9bd6b..bcdab0202 100644 --- a/src/PhpPresentation/Shape/Chart/Type/Area.php +++ b/src/PhpPresentation/Shape/Chart/Type/Area.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpPresentation/Shape/Chart/Type/Bar.php b/src/PhpPresentation/Shape/Chart/Type/Bar.php index 9ea5b3dc7..e16787d90 100644 --- a/src/PhpPresentation/Shape/Chart/Type/Bar.php +++ b/src/PhpPresentation/Shape/Chart/Type/Bar.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpPresentation/Shape/Chart/Type/Bar3D.php b/src/PhpPresentation/Shape/Chart/Type/Bar3D.php index 1011ad071..1e4fa0b86 100644 --- a/src/PhpPresentation/Shape/Chart/Type/Bar3D.php +++ b/src/PhpPresentation/Shape/Chart/Type/Bar3D.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpPresentation/Shape/Chart/Type/Doughnut.php b/src/PhpPresentation/Shape/Chart/Type/Doughnut.php index 292c82326..11cf58653 100644 --- a/src/PhpPresentation/Shape/Chart/Type/Doughnut.php +++ b/src/PhpPresentation/Shape/Chart/Type/Doughnut.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpPresentation/Shape/Chart/Type/Line.php b/src/PhpPresentation/Shape/Chart/Type/Line.php index cefca9ddd..b8d635e36 100644 --- a/src/PhpPresentation/Shape/Chart/Type/Line.php +++ b/src/PhpPresentation/Shape/Chart/Type/Line.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpPresentation/Shape/Chart/Type/Pie.php b/src/PhpPresentation/Shape/Chart/Type/Pie.php index 53cb6b1fe..3cf6959c1 100644 --- a/src/PhpPresentation/Shape/Chart/Type/Pie.php +++ b/src/PhpPresentation/Shape/Chart/Type/Pie.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpPresentation/Shape/Chart/Type/Pie3D.php b/src/PhpPresentation/Shape/Chart/Type/Pie3D.php index 05689c61a..b8c63bec1 100644 --- a/src/PhpPresentation/Shape/Chart/Type/Pie3D.php +++ b/src/PhpPresentation/Shape/Chart/Type/Pie3D.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpPresentation/Shape/Chart/Type/Radar.php b/src/PhpPresentation/Shape/Chart/Type/Radar.php index 9f45b5d5e..322d30b4d 100644 --- a/src/PhpPresentation/Shape/Chart/Type/Radar.php +++ b/src/PhpPresentation/Shape/Chart/Type/Radar.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -25,7 +24,7 @@ class Radar extends AbstractType implements ComparableInterface { /** - * Get hash code + * Get hash code. * * @return string Hash code */ diff --git a/src/PhpPresentation/Shape/Chart/Type/Scatter.php b/src/PhpPresentation/Shape/Chart/Type/Scatter.php index 58f2576e7..16668b34a 100644 --- a/src/PhpPresentation/Shape/Chart/Type/Scatter.php +++ b/src/PhpPresentation/Shape/Chart/Type/Scatter.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpPresentation/Shape/Chart/View3D.php b/src/PhpPresentation/Shape/Chart/View3D.php index 21bbaeefe..b6c0a4996 100644 --- a/src/PhpPresentation/Shape/Chart/View3D.php +++ b/src/PhpPresentation/Shape/Chart/View3D.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -58,7 +57,7 @@ class View3D implements ComparableInterface /** * Height Percent. * - * @var int|null + * @var null|int */ private $heightPercent = 100; @@ -237,7 +236,7 @@ public function getHashCode(): string * Note that this index may vary during script execution! Only reliable moment is * while doing a write of a workbook and when changes are not allowed. * - * @return int|null Hash index + * @return null|int Hash index */ public function getHashIndex(): ?int { diff --git a/src/PhpPresentation/Shape/Comment.php b/src/PhpPresentation/Shape/Comment.php index d909e0548..945faa879 100644 --- a/src/PhpPresentation/Shape/Comment.php +++ b/src/PhpPresentation/Shape/Comment.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -30,7 +29,7 @@ class Comment extends AbstractShape implements ComparableInterface { /** - * @var Author|null + * @var null|Author */ protected $author; @@ -105,7 +104,7 @@ public function setText($text = '') /** * Comment has not height. * - * @return int|null + * @return null|int */ public function getHeight() { @@ -125,7 +124,7 @@ public function setHeight(int $pValue = 0) /** * Comment has not width. * - * @return int|null + * @return null|int */ public function getWidth() { diff --git a/src/PhpPresentation/Shape/Comment/Author.php b/src/PhpPresentation/Shape/Comment/Author.php index 59784f3e9..be9e3a896 100644 --- a/src/PhpPresentation/Shape/Comment/Author.php +++ b/src/PhpPresentation/Shape/Comment/Author.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpPresentation/Shape/Drawing/AbstractDrawingAdapter.php b/src/PhpPresentation/Shape/Drawing/AbstractDrawingAdapter.php index f361ba7d4..f06988cfe 100644 --- a/src/PhpPresentation/Shape/Drawing/AbstractDrawingAdapter.php +++ b/src/PhpPresentation/Shape/Drawing/AbstractDrawingAdapter.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpPresentation/Shape/Drawing/Base64.php b/src/PhpPresentation/Shape/Drawing/Base64.php index 9d4dfbc90..5574c78e0 100644 --- a/src/PhpPresentation/Shape/Drawing/Base64.php +++ b/src/PhpPresentation/Shape/Drawing/Base64.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -57,7 +56,7 @@ class Base64 extends AbstractDrawingAdapter public function __construct() { parent::__construct(); - $this->uniqueName = md5(rand(0, 9999) . time() . rand(0, 9999)); + $this->uniqueName = md5(mt_rand(0, 9999) . time() . mt_rand(0, 9999)); $this->data = ''; } @@ -75,19 +74,16 @@ public function setData(string $data): self public function getContents(): string { - list(, $imageContents) = explode(';', $this->getData()); - list(, $imageContents) = explode(',', $imageContents); + [, $imageContents] = explode(';', $this->getData()); + [, $imageContents] = explode(',', $imageContents); return base64_decode($imageContents); } - /** - * @throws UnauthorizedMimetypeException - */ public function getExtension(): string { - list($data) = explode(';', $this->getData()); - list(, $mime) = explode(':', $data); + [$data] = explode(';', $this->getData()); + [, $mime] = explode(':', $data); if (!array_key_exists($mime, $this->arrayMimeExtension)) { throw new UnauthorizedMimetypeException($mime, $this->arrayMimeExtension); @@ -103,8 +99,8 @@ public function getIndexedFilename(): string public function getMimeType(): string { - list($data) = explode(';', $this->getData()); - list(, $mime) = explode(':', $data); + [$data] = explode(';', $this->getData()); + [, $mime] = explode(':', $data); if (!empty($mime)) { return $mime; diff --git a/src/PhpPresentation/Shape/Drawing/File.php b/src/PhpPresentation/Shape/Drawing/File.php index 754985a44..9078c98a0 100644 --- a/src/PhpPresentation/Shape/Drawing/File.php +++ b/src/PhpPresentation/Shape/Drawing/File.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -43,10 +42,6 @@ public function getPath(): string * * @param string $pValue File path * @param bool $pVerifyFile Verify file - * - * @throws FileNotFoundException - * - * @return self */ public function setPath(string $pValue = '', bool $pVerifyFile = true): self { @@ -59,7 +54,7 @@ public function setPath(string $pValue = '', bool $pVerifyFile = true): self if ($pVerifyFile) { if (0 == $this->width && 0 == $this->height) { - list($this->width, $this->height) = getimagesize($this->getPath()); + [$this->width, $this->height] = getimagesize($this->getPath()); } } @@ -76,9 +71,6 @@ public function getExtension(): string return pathinfo($this->getPath(), PATHINFO_EXTENSION); } - /** - * @throws FileNotFoundException - */ public function getMimeType(): string { if (!CommonFile::fileExists($this->getPath())) { diff --git a/src/PhpPresentation/Shape/Drawing/Gd.php b/src/PhpPresentation/Shape/Drawing/Gd.php index 59bcf8d3d..16fa6fe16 100644 --- a/src/PhpPresentation/Shape/Drawing/Gd.php +++ b/src/PhpPresentation/Shape/Drawing/Gd.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -22,13 +21,13 @@ class Gd extends AbstractDrawingAdapter { - /* Rendering functions */ + // Rendering functions public const RENDERING_DEFAULT = 'imagepng'; public const RENDERING_PNG = 'imagepng'; public const RENDERING_GIF = 'imagegif'; public const RENDERING_JPEG = 'imagejpeg'; - /* MIME types */ + // MIME types public const MIMETYPE_DEFAULT = 'image/png'; public const MIMETYPE_PNG = 'image/png'; public const MIMETYPE_GIF = 'image/gif'; @@ -68,7 +67,7 @@ class Gd extends AbstractDrawingAdapter public function __construct() { parent::__construct(); - $this->uniqueName = md5(rand(0, 9999) . time() . rand(0, 9999)); + $this->uniqueName = md5(mt_rand(0, 9999) . time() . mt_rand(0, 9999)); } /** @@ -92,7 +91,7 @@ public function setImageResource($value = null) { $this->imageResource = $value; - if (!is_null($this->imageResource)) { + if (null !== $this->imageResource) { // Get width/height $this->width = imagesx($this->imageResource); $this->height = imagesy($this->imageResource); diff --git a/src/PhpPresentation/Shape/Drawing/ZipFile.php b/src/PhpPresentation/Shape/Drawing/ZipFile.php index 2a921e9d2..54c03a166 100644 --- a/src/PhpPresentation/Shape/Drawing/ZipFile.php +++ b/src/PhpPresentation/Shape/Drawing/ZipFile.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -22,6 +21,7 @@ use PhpOffice\Common\File as CommonFile; use PhpOffice\PhpPresentation\Exception\FileNotFoundException; +use ZipArchive; class ZipFile extends AbstractDrawingAdapter { @@ -52,16 +52,13 @@ public function setPath(string $pValue = ''): self return $this; } - /** - * @throws FileNotFoundException - */ public function getContents(): string { if (!CommonFile::fileExists($this->getZipFileOut())) { throw new FileNotFoundException($this->getZipFileOut()); } - $imageZip = new \ZipArchive(); + $imageZip = new ZipArchive(); $imageZip->open($this->getZipFileOut()); $imageContents = $imageZip->getFromName($this->getZipFileIn()); $imageZip->close(); @@ -75,15 +72,12 @@ public function getExtension(): string return pathinfo($this->getZipFileIn(), PATHINFO_EXTENSION); } - /** - * @throws FileNotFoundException - */ public function getMimeType(): string { if (!CommonFile::fileExists($this->getZipFileOut())) { throw new FileNotFoundException($this->getZipFileOut()); } - $oArchive = new \ZipArchive(); + $oArchive = new ZipArchive(); $oArchive->open($this->getZipFileOut()); if (!function_exists('getimagesizefromstring')) { $uri = 'data://application/octet-stream;base64,' . base64_encode($oArchive->getFromName($this->getZipFileIn())); diff --git a/src/PhpPresentation/Shape/Group.php b/src/PhpPresentation/Shape/Group.php index dcb29ac4e..4945f1561 100644 --- a/src/PhpPresentation/Shape/Group.php +++ b/src/PhpPresentation/Shape/Group.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -68,8 +67,6 @@ public function getShapeCollection() /** * Add shape to slide. - * - * @return AbstractShape */ public function addShape(AbstractShape $shape): AbstractShape { @@ -176,8 +173,6 @@ public function setHeight(int $pValue = 0) /** * Create rich text shape. - * - * @return RichText */ public function createRichTextShape(): RichText { @@ -194,8 +189,6 @@ public function createRichTextShape(): RichText * @param int $fromY Starting point y offset * @param int $toX Ending point x offset * @param int $toY Ending point y offset - * - * @return Line */ public function createLineShape(int $fromX, int $fromY, int $toX, int $toY): Line { @@ -207,8 +200,6 @@ public function createLineShape(int $fromX, int $fromY, int $toX, int $toY): Lin /** * Create chart shape. - * - * @return Chart */ public function createChartShape(): Chart { @@ -220,8 +211,6 @@ public function createChartShape(): Chart /** * Create drawing shape. - * - * @return Drawing\File */ public function createDrawingShape(): Drawing\File { @@ -235,8 +224,6 @@ public function createDrawingShape(): Drawing\File * Create table shape. * * @param int $columns Number of columns - * - * @return Table */ public function createTableShape(int $columns = 1): Table { diff --git a/src/PhpPresentation/Shape/Hyperlink.php b/src/PhpPresentation/Shape/Hyperlink.php index 06e0be9ad..97c0d2aec 100644 --- a/src/PhpPresentation/Shape/Hyperlink.php +++ b/src/PhpPresentation/Shape/Hyperlink.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -44,14 +43,14 @@ class Hyperlink * * @var int */ - private $slideNumber = null; + private $slideNumber; /** * Slide relation ID (should not be used by user code!). * * @var string */ - public $relationId = null; + public $relationId; /** * Hash index. @@ -61,7 +60,7 @@ class Hyperlink private $hashIndex; /** - * If true, uses the text color, instead of theme color + * If true, uses the text color, instead of theme color. * * @var bool */ @@ -81,8 +80,6 @@ public function __construct(string $pUrl = '', string $pTooltip = '') /** * Get URL. - * - * @return string */ public function getUrl(): string { @@ -91,10 +88,6 @@ public function getUrl(): string /** * Set URL. - * - * @param string $value - * - * @return self */ public function setUrl(string $value = ''): self { @@ -105,8 +98,6 @@ public function setUrl(string $value = ''): self /** * Get tooltip. - * - * @return string */ public function getTooltip(): string { @@ -115,10 +106,6 @@ public function getTooltip(): string /** * Set tooltip. - * - * @param string $value - * - * @return self */ public function setTooltip(string $value = ''): self { @@ -129,8 +116,6 @@ public function setTooltip(string $value = ''): self /** * Get slide number. - * - * @return int */ public function getSlideNumber(): int { @@ -139,10 +124,6 @@ public function getSlideNumber(): int /** * Set slide number. - * - * @param int $value - * - * @return self */ public function setSlideNumber(int $value = 1): self { @@ -154,8 +135,6 @@ public function setSlideNumber(int $value = 1): self /** * Is this hyperlink internal? (to another slide). - * - * @return bool */ public function isInternal(): bool { @@ -178,7 +157,7 @@ public function getHashCode(): string * Note that this index may vary during script execution! Only reliable moment is * while doing a write of a workbook and when changes are not allowed. * - * @return int|null Hash index + * @return null|int Hash index */ public function getHashIndex(): ?int { @@ -218,10 +197,6 @@ public function isTextColorUsed(): bool * Set whether or not to use text color for a hyperlink, instead of theme color. * * @see https://docs.microsoft.com/en-us/openspecs/office_standards/ms-odrawxml/014fbc20-3705-4812-b8cd-93f5af05b504 - * - * @param bool $isTextColorUsed - * - * @return self */ public function setIsTextColorUsed(bool $isTextColorUsed): self { diff --git a/src/PhpPresentation/Shape/Line.php b/src/PhpPresentation/Shape/Line.php index be7574d55..5e1c85aa5 100644 --- a/src/PhpPresentation/Shape/Line.php +++ b/src/PhpPresentation/Shape/Line.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpPresentation/Shape/Media.php b/src/PhpPresentation/Shape/Media.php index 1207195d5..b53cb86be 100644 --- a/src/PhpPresentation/Shape/Media.php +++ b/src/PhpPresentation/Shape/Media.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -33,12 +32,15 @@ public function getMimeType(): string switch (strtolower($this->getExtension())) { case 'mp4': $mimetype = 'video/mp4'; + break; case 'ogv': $mimetype = 'video/ogg'; + break; case 'wmv': $mimetype = 'video/x-ms-wmv'; + break; default: $mimetype = 'application/octet-stream'; diff --git a/src/PhpPresentation/Shape/Placeholder.php b/src/PhpPresentation/Shape/Placeholder.php index 45f6ac820..1117736dc 100644 --- a/src/PhpPresentation/Shape/Placeholder.php +++ b/src/PhpPresentation/Shape/Placeholder.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -42,7 +41,7 @@ class Placeholder * Specifies the index of the placeholder. This is used when applying templates or changing layouts to * match a placeholder on one template or master to another. * - * @var int|null + * @var null|int */ protected $idx; diff --git a/src/PhpPresentation/Shape/RichText.php b/src/PhpPresentation/Shape/RichText.php index b9082773a..0e3403d52 100644 --- a/src/PhpPresentation/Shape/RichText.php +++ b/src/PhpPresentation/Shape/RichText.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -109,7 +108,7 @@ class RichText extends AbstractShape implements ComparableInterface private $columns = 1; /** - * The spacing between columns + * The spacing between columns. * * @var int */ @@ -146,28 +145,28 @@ class RichText extends AbstractShape implements ComparableInterface /** * Horizontal Auto Shrink. * - * @var bool|null + * @var null|bool */ private $autoShrinkHorizontal; /** * Vertical Auto Shrink. * - * @var bool|null + * @var null|bool */ private $autoShrinkVertical; /** * The percentage of the original font size to which the text is scaled. * - * @var float|null + * @var null|float */ private $fontScale; /** * The percentage of the reduction of the line spacing. * - * @var float|null + * @var null|float */ private $lnSpcReduction; @@ -187,8 +186,6 @@ public function __construct() /** * Get active paragraph index. - * - * @return int */ public function getActiveParagraphIndex(): int { @@ -202,8 +199,6 @@ public function getActiveParagraph(): Paragraph /** * Set active paragraph. - * - * @throws OutOfBoundsException */ public function setActiveParagraph(int $index = 0): Paragraph { @@ -218,8 +213,6 @@ public function setActiveParagraph(int $index = 0): Paragraph /** * Get paragraph. - * - * @throws OutOfBoundsException */ public function getParagraph(int $index = 0): Paragraph { @@ -261,11 +254,9 @@ public function createParagraph(): Paragraph /** * Add text. * - * @param TextElementInterface|null $pText Rich text element - * - * @return self + * @param null|TextElementInterface $pText Rich text element */ - public function addText(TextElementInterface $pText = null): self + public function addText(?TextElementInterface $pText = null): self { $this->richTextParagraphs[$this->activeParagraph]->addText($pText); @@ -276,8 +267,6 @@ public function addText(TextElementInterface $pText = null): self * Create text (can not be formatted !). * * @param string $pText Text - * - * @return RichText\TextElement */ public function createText(string $pText = ''): RichText\TextElement { @@ -286,8 +275,6 @@ public function createText(string $pText = ''): RichText\TextElement /** * Create break. - * - * @return RichText\BreakElement */ public function createBreak(): RichText\BreakElement { @@ -298,8 +285,6 @@ public function createBreak(): RichText\BreakElement * Create text run (can be formatted). * * @param string $pText Text - * - * @return RichText\Run */ public function createTextRun(string $pText = ''): RichText\Run { @@ -308,8 +293,6 @@ public function createTextRun(string $pText = ''): RichText\Run /** * Get plain text. - * - * @return string */ public function getPlainText(): string { @@ -358,8 +341,6 @@ public function setParagraphs(array $paragraphs = []): self /** * Get text wrapping. - * - * @return string */ public function getWrap(): string { @@ -368,10 +349,6 @@ public function getWrap(): string /** * Set text wrapping. - * - * @param string $value - * - * @return self */ public function setWrap(string $value = self::WRAP_SQUARE): self { @@ -382,8 +359,6 @@ public function setWrap(string $value = self::WRAP_SQUARE): self /** * Get autofit. - * - * @return string */ public function getAutoFit(): string { @@ -408,22 +383,16 @@ public function getLineSpaceReduction(): ?float /** * Set autofit. - * - * @param string $value - * @param float|null $fontScale - * @param float|null $lnSpcReduction - * - * @return self */ - public function setAutoFit(string $value = self::AUTOFIT_DEFAULT, float $fontScale = null, float $lnSpcReduction = null): self + public function setAutoFit(string $value = self::AUTOFIT_DEFAULT, ?float $fontScale = null, ?float $lnSpcReduction = null): self { $this->autoFit = $value; - if (!is_null($fontScale)) { + if (null !== $fontScale) { $this->fontScale = $fontScale; } - if (!is_null($lnSpcReduction)) { + if (null !== $lnSpcReduction) { $this->lnSpcReduction = $lnSpcReduction; } @@ -432,8 +401,6 @@ public function setAutoFit(string $value = self::AUTOFIT_DEFAULT, float $fontSca /** * Get horizontal overflow. - * - * @return string */ public function getHorizontalOverflow(): string { @@ -442,10 +409,6 @@ public function getHorizontalOverflow(): string /** * Set horizontal overflow. - * - * @param string $value - * - * @return self */ public function setHorizontalOverflow(string $value = self::OVERFLOW_OVERFLOW): self { @@ -456,8 +419,6 @@ public function setHorizontalOverflow(string $value = self::OVERFLOW_OVERFLOW): /** * Get vertical overflow. - * - * @return string */ public function getVerticalOverflow(): string { @@ -466,10 +427,6 @@ public function getVerticalOverflow(): string /** * Set vertical overflow. - * - * @param string $value - * - * @return self */ public function setVerticalOverflow(string $value = self::OVERFLOW_OVERFLOW): self { @@ -480,8 +437,6 @@ public function setVerticalOverflow(string $value = self::OVERFLOW_OVERFLOW): se /** * Get upright. - * - * @return bool */ public function isUpright(): bool { @@ -490,10 +445,6 @@ public function isUpright(): bool /** * Set vertical. - * - * @param bool $value - * - * @return self */ public function setUpright(bool $value = false): self { @@ -504,8 +455,6 @@ public function setUpright(bool $value = false): self /** * Get vertical. - * - * @return bool */ public function isVertical(): bool { @@ -514,10 +463,6 @@ public function isVertical(): bool /** * Set vertical. - * - * @param bool $value - * - * @return self */ public function setVertical(bool $value = false): self { @@ -528,8 +473,6 @@ public function setVertical(bool $value = false): self /** * Get columns. - * - * @return int */ public function getColumns(): int { @@ -538,12 +481,6 @@ public function getColumns(): int /** * Set columns. - * - * @param int $value - * - * @return self - * - * @throws OutOfBoundsException */ public function setColumns(int $value = 1): self { @@ -558,8 +495,6 @@ public function setColumns(int $value = 1): self /** * Get bottom inset. - * - * @return float */ public function getInsetBottom(): float { @@ -568,10 +503,6 @@ public function getInsetBottom(): float /** * Set bottom inset. - * - * @param float $value - * - * @return self */ public function setInsetBottom(float $value = 4.8): self { @@ -582,8 +513,6 @@ public function setInsetBottom(float $value = 4.8): self /** * Get left inset. - * - * @return float */ public function getInsetLeft(): float { @@ -592,10 +521,6 @@ public function getInsetLeft(): float /** * Set left inset. - * - * @param float $value - * - * @return self */ public function setInsetLeft(float $value = 9.6): self { @@ -606,8 +531,6 @@ public function setInsetLeft(float $value = 9.6): self /** * Get right inset. - * - * @return float */ public function getInsetRight(): float { @@ -616,10 +539,6 @@ public function getInsetRight(): float /** * Set left inset. - * - * @param float $value - * - * @return self */ public function setInsetRight(float $value = 9.6): self { @@ -630,8 +549,6 @@ public function setInsetRight(float $value = 9.6): self /** * Get top inset. - * - * @return float */ public function getInsetTop(): float { @@ -640,10 +557,6 @@ public function getInsetTop(): float /** * Set top inset. - * - * @param float $value - * - * @return self */ public function setInsetTop(float $value = 4.8): self { @@ -652,7 +565,7 @@ public function setInsetTop(float $value = 4.8): self return $this; } - public function setAutoShrinkHorizontal(bool $value = null): self + public function setAutoShrinkHorizontal(?bool $value = null): self { $this->autoShrinkHorizontal = $value; @@ -669,7 +582,7 @@ public function hasAutoShrinkHorizontal(): ?bool * * @return RichText */ - public function setAutoShrinkVertical(bool $value = null): self + public function setAutoShrinkVertical(?bool $value = null): self { $this->autoShrinkVertical = $value; @@ -685,9 +598,7 @@ public function hasAutoShrinkVertical(): ?bool } /** - * Get spacing between columns - * - * @return int + * Get spacing between columns. */ public function getColumnSpacing(): int { @@ -695,11 +606,7 @@ public function getColumnSpacing(): int } /** - * Set spacing between columns - * - * @param int $value - * - * @return self + * Set spacing between columns. */ public function setColumnSpacing(int $value = 0): self { diff --git a/src/PhpPresentation/Shape/RichText/BreakElement.php b/src/PhpPresentation/Shape/RichText/BreakElement.php index 5df5f0648..093d4bb6d 100644 --- a/src/PhpPresentation/Shape/RichText/BreakElement.php +++ b/src/PhpPresentation/Shape/RichText/BreakElement.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpPresentation/Shape/RichText/Paragraph.php b/src/PhpPresentation/Shape/RichText/Paragraph.php index 5fa26925c..b1d80f8d2 100644 --- a/src/PhpPresentation/Shape/RichText/Paragraph.php +++ b/src/PhpPresentation/Shape/RichText/Paragraph.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -50,7 +49,7 @@ class Paragraph implements ComparableInterface /** * Font. * - * @var Font|null + * @var null|Font */ private $font; @@ -127,9 +126,9 @@ public function getFont(): ?Font /** * Set font. * - * @param Font|null $pFont Font + * @param null|Font $pFont Font */ - public function setFont(Font $pFont = null): self + public function setFont(?Font $pFont = null): self { $this->font = $pFont; @@ -145,9 +144,9 @@ public function getBulletStyle(): ?Bullet } /** - * Set bullet style + * Set bullet style. */ - public function setBulletStyle(Bullet $style = null): self + public function setBulletStyle(?Bullet $style = null): self { $this->bulletStyle = $style; @@ -170,9 +169,9 @@ public function createText(string $pText = ''): TextElement /** * Add text. * - * @param TextElementInterface|null $pText Rich text element + * @param null|TextElementInterface $pText Rich text element */ - public function addText(TextElementInterface $pText = null): self + public function addText(?TextElementInterface $pText = null): self { $this->richTextElements[] = $pText; @@ -276,7 +275,7 @@ public function getHashCode(): string * Note that this index may vary during script execution! Only reliable moment is * while doing a write of a workbook and when changes are not allowed. * - * @return int|null Hash index + * @return null|int Hash index */ public function getHashIndex(): ?int { @@ -300,20 +299,15 @@ public function setHashIndex(int $value) return $this; } - /** - * @return int - */ public function getLineSpacing(): int { return $this->lineSpacing; } /** - * Value in points + * Value in points. * * @param int $lineSpacing - * - * @return self */ public function setLineSpacing($lineSpacing): self { @@ -322,19 +316,11 @@ public function setLineSpacing($lineSpacing): self return $this; } - /** - * @return string - */ public function getLineSpacingMode(): string { return $this->lineSpacingMode; } - /** - * @param string $lineSpacingMode - * - * @return self - */ public function setLineSpacingMode(string $lineSpacingMode): self { if (in_array($lineSpacingMode, [ @@ -348,9 +334,7 @@ public function setLineSpacingMode(string $lineSpacingMode): self } /** - * Value in points - * - * @return int + * Value in points. */ public function getSpacingBefore(): int { @@ -358,11 +342,7 @@ public function getSpacingBefore(): int } /** - * Value in points - * - * @param int $spacingBefore - * - * @return self + * Value in points. */ public function setSpacingBefore(int $spacingBefore): self { @@ -372,9 +352,7 @@ public function setSpacingBefore(int $spacingBefore): self } /** - * Value in points - * - * @return int + * Value in points. */ public function getSpacingAfter(): int { @@ -382,11 +360,7 @@ public function getSpacingAfter(): int } /** - * Value in points - * - * @param int $spacingAfter - * - * @return self + * Value in points. */ public function setSpacingAfter(int $spacingAfter): self { diff --git a/src/PhpPresentation/Shape/RichText/Run.php b/src/PhpPresentation/Shape/RichText/Run.php index ba4f53250..ba8fc12a5 100644 --- a/src/PhpPresentation/Shape/RichText/Run.php +++ b/src/PhpPresentation/Shape/RichText/Run.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -57,11 +56,11 @@ public function getFont(): Font /** * Set font. * - * @param Font|null $pFont Font + * @param null|Font $pFont Font * * @return \PhpOffice\PhpPresentation\Shape\RichText\TextElementInterface */ - public function setFont(Font $pFont = null) + public function setFont(?Font $pFont = null) { $this->font = $pFont; diff --git a/src/PhpPresentation/Shape/RichText/TextElement.php b/src/PhpPresentation/Shape/RichText/TextElement.php index 3c74d02fd..709860ffb 100644 --- a/src/PhpPresentation/Shape/RichText/TextElement.php +++ b/src/PhpPresentation/Shape/RichText/TextElement.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -43,7 +42,7 @@ class TextElement implements TextElementInterface /** * Hyperlink. * - * @var Hyperlink|null + * @var null|Hyperlink */ protected $hyperlink; @@ -92,12 +91,12 @@ public function getFont(): ?Font public function hasHyperlink(): bool { - return !is_null($this->hyperlink); + return null !== $this->hyperlink; } public function getHyperlink(): Hyperlink { - if (is_null($this->hyperlink)) { + if (null === $this->hyperlink) { $this->hyperlink = new Hyperlink(); } @@ -109,7 +108,7 @@ public function getHyperlink(): Hyperlink * * @return \PhpOffice\PhpPresentation\Shape\RichText\TextElement */ - public function setHyperlink(Hyperlink $pHyperlink = null) + public function setHyperlink(?Hyperlink $pHyperlink = null) { $this->hyperlink = $pHyperlink; @@ -147,6 +146,6 @@ public function setLanguage($language) */ public function getHashCode(): string { - return md5($this->text . (is_null($this->hyperlink) ? '' : $this->hyperlink->getHashCode()) . __CLASS__); + return md5($this->text . (null === $this->hyperlink ? '' : $this->hyperlink->getHashCode()) . __CLASS__); } } diff --git a/src/PhpPresentation/Shape/RichText/TextElementInterface.php b/src/PhpPresentation/Shape/RichText/TextElementInterface.php index 4c704436c..af2485bb0 100644 --- a/src/PhpPresentation/Shape/RichText/TextElementInterface.php +++ b/src/PhpPresentation/Shape/RichText/TextElementInterface.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpPresentation/Shape/Table.php b/src/PhpPresentation/Shape/Table.php index d6313be11..496077877 100644 --- a/src/PhpPresentation/Shape/Table.php +++ b/src/PhpPresentation/Shape/Table.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -63,8 +62,6 @@ public function __construct($columns = 1) * Get row. * * @param int $row Row number - * - * @throws OutOfBoundsException */ public function getRow(int $row = 0): Row { @@ -79,11 +76,6 @@ public function getRow(int $row = 0): Row return $this->rows[$row]; } - /** - * @param int $row - * - * @return bool - */ public function hasRow(int $row): bool { return isset($this->rows[$row]); @@ -101,8 +93,6 @@ public function getRows(): array /** * Create row. - * - * @return Row */ public function createRow(): Row { @@ -112,19 +102,11 @@ public function createRow(): Row return $row; } - /** - * @return int - */ public function getNumColumns(): int { return $this->columnCount; } - /** - * @param int $numColumn - * - * @return self - */ public function setNumColumns(int $numColumn): self { $this->columnCount = $numColumn; diff --git a/src/PhpPresentation/Shape/Table/Cell.php b/src/PhpPresentation/Shape/Table/Cell.php index c8e8a942c..d750aa8ac 100644 --- a/src/PhpPresentation/Shape/Table/Cell.php +++ b/src/PhpPresentation/Shape/Table/Cell.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -128,8 +127,6 @@ public function getActiveParagraph(): Paragraph * Set active paragraph. * * @param int $index - * - * @throws OutOfBoundsException */ public function setActiveParagraph($index = 0): Paragraph { @@ -144,10 +141,6 @@ public function setActiveParagraph($index = 0): Paragraph /** * Get paragraph. - * - * @param int $index - * - * @throws OutOfBoundsException */ public function getParagraph(int $index = 0): Paragraph { @@ -187,7 +180,7 @@ public function createParagraph(): Paragraph * * @return \PhpOffice\PhpPresentation\Shape\Table\Cell */ - public function addText(TextElementInterface $pText = null) + public function addText(?TextElementInterface $pText = null) { $this->richTextParagraphs[$this->activeParagraph]->addText($pText); @@ -393,7 +386,7 @@ public function getHashCode(): string * Note that this index may vary during script execution! Only reliable moment is * while doing a write of a workbook and when changes are not allowed. * - * @return int|null Hash index + * @return null|int Hash index */ public function getHashIndex(): ?int { diff --git a/src/PhpPresentation/Shape/Table/Row.php b/src/PhpPresentation/Shape/Table/Row.php index 039bbf16d..59e9207e2 100644 --- a/src/PhpPresentation/Shape/Table/Row.php +++ b/src/PhpPresentation/Shape/Table/Row.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -81,8 +80,6 @@ public function __construct(int $columns = 1) * Get cell. * * @param int $cell Cell number - * - * @throws OutOfBoundsException */ public function getCell(int $cell = 0): Cell { @@ -101,8 +98,6 @@ public function getCell(int $cell = 0): Cell * Get cell. * * @param int $cell Cell number - * - * @return bool */ public function hasCell(int $cell): bool { @@ -121,10 +116,6 @@ public function getCells(): array /** * Next cell (moves one cell to the right). - * - * @return Cell - * - * @throws OutOfBoundsException */ public function nextCell(): Cell { @@ -144,8 +135,6 @@ public function nextCell(): Cell /** * Get fill. - * - * @return Fill */ public function getFill(): Fill { @@ -154,8 +143,6 @@ public function getFill(): Fill /** * Set fill. - * - * @return self */ public function setFill(Fill $fill): self { @@ -166,8 +153,6 @@ public function setFill(Fill $fill): self /** * Get height. - * - * @return int */ public function getHeight(): int { @@ -176,10 +161,6 @@ public function getHeight(): int /** * Set height. - * - * @param int $value - * - * @return self */ public function setHeight(int $value = 0): self { @@ -209,7 +190,7 @@ public function getHashCode(): string * Note that this index may vary during script execution! Only reliable moment is * while doing a write of a workbook and when changes are not allowed. * - * @return int|null Hash index + * @return null|int Hash index */ public function getHashIndex(): ?int { diff --git a/src/PhpPresentation/ShapeContainerInterface.php b/src/PhpPresentation/ShapeContainerInterface.php index 48e24f167..a347c358e 100644 --- a/src/PhpPresentation/ShapeContainerInterface.php +++ b/src/PhpPresentation/ShapeContainerInterface.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpPresentation/Slide.php b/src/PhpPresentation/Slide.php index 61c0d5775..7fbbea08b 100644 --- a/src/PhpPresentation/Slide.php +++ b/src/PhpPresentation/Slide.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -20,6 +19,7 @@ namespace PhpOffice\PhpPresentation; +use ArrayObject; use PhpOffice\PhpPresentation\Slide\AbstractSlide; use PhpOffice\PhpPresentation\Slide\Note; use PhpOffice\PhpPresentation\Slide\SlideLayout; @@ -39,7 +39,7 @@ class Slide extends AbstractSlide implements ComparableInterface, ShapeContainer /** * Slide layout. * - * @var SlideLayout|null + * @var null|SlideLayout */ private $slideLayout; @@ -63,7 +63,7 @@ class Slide extends AbstractSlide implements ComparableInterface, ShapeContainer /** * Name of the title. * - * @var string|null + * @var null|string */ protected $name; @@ -72,14 +72,14 @@ class Slide extends AbstractSlide implements ComparableInterface, ShapeContainer * * @param PhpPresentation $pParent */ - public function __construct(PhpPresentation $pParent = null) + public function __construct(?PhpPresentation $pParent = null) { // Set parent $this->parent = $pParent; // Shape collection - $this->shapeCollection = new \ArrayObject(); + $this->shapeCollection = new ArrayObject(); // Set identifier - $this->identifier = md5(rand(0, 9999) . time()); + $this->identifier = md5(mt_rand(0, 9999) . time()); // Set Slide Layout if ($this->parent instanceof PhpPresentation) { $arrayMasterSlides = $this->parent->getAllMasterSlides(); @@ -151,9 +151,9 @@ public function getNote(): Note return $this->slideNote; } - public function setNote(Note $note = null): self + public function setNote(?Note $note = null): self { - $this->slideNote = (is_null($note) ? new Note() : $note); + $this->slideNote = (null === $note ? new Note() : $note); $this->slideNote->setParent($this); return $this; diff --git a/src/PhpPresentation/Slide/AbstractBackground.php b/src/PhpPresentation/Slide/AbstractBackground.php index 42aa4d585..94b9063b0 100644 --- a/src/PhpPresentation/Slide/AbstractBackground.php +++ b/src/PhpPresentation/Slide/AbstractBackground.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpPresentation/Slide/AbstractSlide.php b/src/PhpPresentation/Slide/AbstractSlide.php index ad5acd19c..b3d6fedfd 100644 --- a/src/PhpPresentation/Slide/AbstractSlide.php +++ b/src/PhpPresentation/Slide/AbstractSlide.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -39,8 +38,9 @@ abstract class AbstractSlide implements ComparableInterface, ShapeContainerInter * @var string */ protected $relsIndex; + /** - * @var Transition|null + * @var null|Transition */ protected $slideTransition; @@ -50,48 +50,56 @@ abstract class AbstractSlide implements ComparableInterface, ShapeContainerInter * @var array<int, AbstractShape>|ArrayObject<int, AbstractShape> */ protected $shapeCollection = []; + /** * Extent Y. * * @var int */ protected $extentY; + /** * Extent X. * * @var int */ protected $extentX; + /** * Offset X. * * @var int */ protected $offsetX; + /** * Offset Y. * * @var int */ protected $offsetY; + /** * Slide identifier. * * @var string */ protected $identifier; + /** * Hash index. * * @var int */ protected $hashIndex; + /** * Parent presentation. * - * @var PhpPresentation|null + * @var null|PhpPresentation */ protected $parent; + /** * Background of the slide. * @@ -125,8 +133,6 @@ public function setShapeCollection($shapeCollection = []) /** * Add shape to slide. - * - * @return AbstractShape */ public function addShape(AbstractShape $shape): AbstractShape { @@ -207,7 +213,7 @@ public function getHashCode(): string * Note that this index may vary during script execution! Only reliable moment is * while doing a write of a workbook and when changes are not allowed. * - * @return int|null Hash index + * @return null|int Hash index */ public function getHashIndex(): ?int { @@ -315,7 +321,7 @@ public function getParent(): ?PhpPresentation /** * Re-bind parent. */ - public function rebindParent(PhpPresentation $parent): AbstractSlide + public function rebindParent(PhpPresentation $parent): self { $this->parent->removeSlideByIndex($this->parent->getIndex($this)); $this->parent = $parent; @@ -328,7 +334,7 @@ public function getBackground(): ?AbstractBackground return $this->background; } - public function setBackground(AbstractBackground $background = null): AbstractSlide + public function setBackground(?AbstractBackground $background = null): self { $this->background = $background; @@ -340,7 +346,7 @@ public function getTransition(): ?Transition return $this->slideTransition; } - public function setTransition(Transition $transition = null): self + public function setTransition(?Transition $transition = null): self { $this->slideTransition = $transition; diff --git a/src/PhpPresentation/Slide/Animation.php b/src/PhpPresentation/Slide/Animation.php index 2e6d1dc48..f5215ac2a 100644 --- a/src/PhpPresentation/Slide/Animation.php +++ b/src/PhpPresentation/Slide/Animation.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpPresentation/Slide/Background/Color.php b/src/PhpPresentation/Slide/Background/Color.php index 24507d8dc..22ed3e063 100644 --- a/src/PhpPresentation/Slide/Background/Color.php +++ b/src/PhpPresentation/Slide/Background/Color.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -26,11 +25,11 @@ class Color extends AbstractBackground { /** - * @var StyleColor|null + * @var null|StyleColor */ protected $color; - public function setColor(StyleColor $color = null): self + public function setColor(?StyleColor $color = null): self { $this->color = $color; diff --git a/src/PhpPresentation/Slide/Background/Image.php b/src/PhpPresentation/Slide/Background/Image.php index 39c998e2b..eebd8aee7 100644 --- a/src/PhpPresentation/Slide/Background/Image.php +++ b/src/PhpPresentation/Slide/Background/Image.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -63,8 +62,6 @@ public function getPath(): ?string * @param string $pValue File path * @param bool $pVerifyFile Verify file * - * @throws FileNotFoundException - * * @return self */ public function setPath(string $pValue = '', bool $pVerifyFile = true) @@ -76,7 +73,7 @@ public function setPath(string $pValue = '', bool $pVerifyFile = true) if (0 == $this->width && 0 == $this->height) { // Get width/height - list($this->width, $this->height) = getimagesize($pValue); + [$this->width, $this->height] = getimagesize($pValue); } } $this->path = $pValue; @@ -86,8 +83,6 @@ public function setPath(string $pValue = '', bool $pVerifyFile = true) /** * Get Filename. - * - * @return string */ public function getFilename(): string { @@ -96,8 +91,6 @@ public function getFilename(): string /** * Get Extension. - * - * @return string */ public function getExtension(): string { diff --git a/src/PhpPresentation/Slide/Background/SchemeColor.php b/src/PhpPresentation/Slide/Background/SchemeColor.php index 3cb785df5..380502e89 100644 --- a/src/PhpPresentation/Slide/Background/SchemeColor.php +++ b/src/PhpPresentation/Slide/Background/SchemeColor.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -26,14 +25,14 @@ class SchemeColor extends AbstractBackground { /** - * @var StyleSchemeColor|null + * @var null|StyleSchemeColor */ protected $schemeColor; /** * @return $this */ - public function setSchemeColor(StyleSchemeColor $color = null): self + public function setSchemeColor(?StyleSchemeColor $color = null): self { $this->schemeColor = $color; diff --git a/src/PhpPresentation/Slide/Iterator.php b/src/PhpPresentation/Slide/Iterator.php index d761be9a7..6934b71f6 100644 --- a/src/PhpPresentation/Slide/Iterator.php +++ b/src/PhpPresentation/Slide/Iterator.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -53,14 +52,14 @@ public function __construct(PhpPresentation $subject) */ public function __destruct() { - unset($this->subject); + $this->subject = null; } /** * Rewind iterator. */ #[\ReturnTypeWillChange] - public function rewind() + public function rewind(): void { $this->position = 0; } @@ -70,6 +69,7 @@ public function rewind() * * @return \PhpOffice\PhpPresentation\Slide */ + #[\ReturnTypeWillChange] public function current() { return $this->subject->getSlide($this->position); @@ -80,6 +80,7 @@ public function current() * * @return int */ + #[\ReturnTypeWillChange] public function key() { return $this->position; @@ -89,7 +90,7 @@ public function key() * Next value. */ #[\ReturnTypeWillChange] - public function next() + public function next(): void { ++$this->position; } diff --git a/src/PhpPresentation/Slide/Layout.php b/src/PhpPresentation/Slide/Layout.php index 1c1ec93cb..e4c6726ee 100644 --- a/src/PhpPresentation/Slide/Layout.php +++ b/src/PhpPresentation/Slide/Layout.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpPresentation/Slide/Note.php b/src/PhpPresentation/Slide/Note.php index d1423a026..587576062 100644 --- a/src/PhpPresentation/Slide/Note.php +++ b/src/PhpPresentation/Slide/Note.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -91,7 +90,7 @@ class Note implements ComparableInterface, ShapeContainerInterface * * @param Slide $pParent */ - public function __construct(Slide $pParent = null) + public function __construct(?Slide $pParent = null) { // Set parent $this->parent = $pParent; @@ -100,7 +99,7 @@ public function __construct(Slide $pParent = null) $this->shapeCollection = new ArrayObject(); // Set identifier - $this->identifier = md5(rand(0, 9999) . time()); + $this->identifier = md5(mt_rand(0, 9999) . time()); } /** @@ -115,8 +114,6 @@ public function getShapeCollection() /** * Add shape to slide. - * - * @return AbstractShape */ public function addShape(AbstractShape $shape): AbstractShape { @@ -230,7 +227,7 @@ public function getHashCode(): string * Note that this index may vary during script execution! Only reliable moment is * while doing a write of a workbook and when changes are not allowed. * - * @return int|null Hash index + * @return null|int Hash index */ public function getHashIndex(): ?int { diff --git a/src/PhpPresentation/Slide/SlideLayout.php b/src/PhpPresentation/Slide/SlideLayout.php index 9c30db23b..6393ca7e2 100644 --- a/src/PhpPresentation/Slide/SlideLayout.php +++ b/src/PhpPresentation/Slide/SlideLayout.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -20,6 +19,7 @@ namespace PhpOffice\PhpPresentation\Slide; +use ArrayObject; use PhpOffice\PhpPresentation\ComparableInterface; use PhpOffice\PhpPresentation\ShapeContainerInterface; use PhpOffice\PhpPresentation\Style\ColorMap; @@ -30,30 +30,35 @@ class SlideLayout extends AbstractSlide implements ComparableInterface, ShapeCon * @var SlideMaster */ protected $slideMaster; + /** * Slide relation ID (should not be used by user code!). * * @var string */ public $relationId; + /** * Slide layout NR (should not be used by user code!). * * @var int */ public $layoutNr; + /** * Slide layout ID (should not be used by user code!). * * @var int */ public $layoutId; + /** * Slide layout ID (should not be used by user code!). * - * @var string|null + * @var null|string */ protected $layoutName; + /** * Mapping of colors to the theme. * @@ -69,9 +74,9 @@ public function __construct(SlideMaster $pSlideMaster) // Set parent $this->slideMaster = $pSlideMaster; // Shape collection - $this->shapeCollection = new \ArrayObject(); + $this->shapeCollection = new ArrayObject(); // Set identifier - $this->identifier = md5(rand(0, 9999) . time()); + $this->identifier = md5(mt_rand(0, 9999) . time()); // Set a basic colorMap $this->colorMap = new ColorMap(); } diff --git a/src/PhpPresentation/Slide/SlideMaster.php b/src/PhpPresentation/Slide/SlideMaster.php index 3966f008c..9d877d3f2 100644 --- a/src/PhpPresentation/Slide/SlideMaster.php +++ b/src/PhpPresentation/Slide/SlideMaster.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -20,6 +19,7 @@ namespace PhpOffice\PhpPresentation\Slide; +use ArrayObject; use PhpOffice\PhpPresentation\ComparableInterface; use PhpOffice\PhpPresentation\PhpPresentation; use PhpOffice\PhpPresentation\ShapeContainerInterface; @@ -37,20 +37,24 @@ class SlideMaster extends AbstractSlide implements ComparableInterface, ShapeCon * @var array<SlideLayout> */ protected $slideLayouts = []; + /** * Mapping of colors to the theme. * * @var ColorMap */ public $colorMap; + /** * @var TextStyle */ protected $textStyles; + /** * @var array<SchemeColor> */ protected $arraySchemeColor = []; + /** * @var array<string, string> */ @@ -72,14 +76,14 @@ class SlideMaster extends AbstractSlide implements ComparableInterface, ShapeCon /** * Create a new slideMaster. */ - public function __construct(PhpPresentation $pParent = null) + public function __construct(?PhpPresentation $pParent = null) { // Set parent $this->parent = $pParent; // Shape collection - $this->shapeCollection = new \ArrayObject(); + $this->shapeCollection = new ArrayObject(); // Set identifier - $this->identifier = md5(rand(0, 9999) . time()); + $this->identifier = md5(mt_rand(0, 9999) . time()); // Set a basic colorMap $this->colorMap = new ColorMap(); // Set a white background @@ -98,8 +102,6 @@ public function __construct(PhpPresentation $pParent = null) /** * Create a slideLayout and add it to this presentation. - * - * @return SlideLayout */ public function createSlideLayout(): SlideLayout { @@ -111,12 +113,8 @@ public function createSlideLayout(): SlideLayout /** * Add slideLayout. - * - * @param SlideLayout|null $slideLayout - * - * @return SlideLayout */ - public function addSlideLayout(SlideLayout $slideLayout = null): SlideLayout + public function addSlideLayout(?SlideLayout $slideLayout = null): SlideLayout { $this->slideLayouts[] = $slideLayout; @@ -131,17 +129,11 @@ public function getAllSlideLayouts(): array return $this->slideLayouts; } - /** - * @return TextStyle - */ public function getTextStyles(): TextStyle { return $this->textStyles; } - /** - * @return self - */ public function setTextStyles(TextStyle $textStyle): self { $this->textStyles = $textStyle; @@ -149,9 +141,6 @@ public function setTextStyles(TextStyle $textStyle): self return $this; } - /** - * @return self - */ public function addSchemeColor(SchemeColor $schemeColor): self { $this->arraySchemeColor[$schemeColor->getValue()] = $schemeColor; diff --git a/src/PhpPresentation/Slide/Transition.php b/src/PhpPresentation/Slide/Transition.php index 9836f7c62..b4589ba97 100644 --- a/src/PhpPresentation/Slide/Transition.php +++ b/src/PhpPresentation/Slide/Transition.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -81,22 +80,26 @@ class Transition * @var bool */ protected $hasManualTrigger = false; + /** * @var bool */ protected $hasTimeTrigger = false; + /** - * @var int|null + * @var null|int */ - protected $advanceTimeTrigger = null; + protected $advanceTimeTrigger; + /** - * @var string|null + * @var null|string */ - protected $speed = null; + protected $speed; + /** - * @var string|null + * @var null|string */ - protected $transitionType = null; + protected $transitionType; public function setSpeed(?string $speed = self::SPEED_MEDIUM): self { @@ -144,7 +147,7 @@ public function getAdvanceTimeTrigger(): ?int return $this->advanceTimeTrigger; } - public function setTransitionType(string $type = null): self + public function setTransitionType(?string $type = null): self { $this->transitionType = $type; diff --git a/src/PhpPresentation/Style/Alignment.php b/src/PhpPresentation/Style/Alignment.php index fae963ebe..9e17e7dcd 100644 --- a/src/PhpPresentation/Style/Alignment.php +++ b/src/PhpPresentation/Style/Alignment.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -25,7 +24,7 @@ class Alignment implements ComparableInterface { - /* Horizontal alignment */ + // Horizontal alignment public const HORIZONTAL_GENERAL = 'l'; public const HORIZONTAL_LEFT = 'l'; public const HORIZONTAL_RIGHT = 'r'; @@ -33,14 +32,14 @@ class Alignment implements ComparableInterface public const HORIZONTAL_JUSTIFY = 'just'; public const HORIZONTAL_DISTRIBUTED = 'dist'; - /* Vertical alignment */ + // Vertical alignment public const VERTICAL_BASE = 'base'; public const VERTICAL_AUTO = 'auto'; public const VERTICAL_BOTTOM = 'b'; public const VERTICAL_TOP = 't'; public const VERTICAL_CENTER = 'ctr'; - /* Text direction */ + // Text direction public const TEXT_DIRECTION_HORIZONTAL = 'horz'; public const TEXT_DIRECTION_VERTICAL_90 = 'vert'; public const TEXT_DIRECTION_VERTICAL_270 = 'vert270'; @@ -119,7 +118,7 @@ class Alignment implements ComparableInterface private $marginBottom = 0; /** - * RTL Direction Support + * RTL Direction Support. * * @var bool */ @@ -186,8 +185,6 @@ public function getLevel(): int * Set Level. * * @param int $pValue Ranging 0 - 8 - * - * @throws OutOfBoundsException */ public function setLevel(int $pValue = 0): self { @@ -316,19 +313,11 @@ public function setTextDirection(string $pValue = self::TEXT_DIRECTION_HORIZONTA return $this; } - /** - * @return bool - */ public function isRTL(): bool { return $this->isRTL; } - /** - * @param bool $value - * - * @return self - */ public function setIsRTL(bool $value = false): self { $this->isRTL = $value; @@ -361,7 +350,7 @@ public function getHashCode(): string * Note that this index may vary during script execution! Only reliable moment is * while doing a write of a workbook and when changes are not allowed. * - * @return int|null Hash index + * @return null|int Hash index */ public function getHashIndex(): ?int { diff --git a/src/PhpPresentation/Style/Border.php b/src/PhpPresentation/Style/Border.php index 59b55ba3a..e7bc86545 100644 --- a/src/PhpPresentation/Style/Border.php +++ b/src/PhpPresentation/Style/Border.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -24,7 +23,7 @@ class Border implements ComparableInterface { - /* Line style */ + // Line style public const LINE_NONE = 'none'; public const LINE_SINGLE = 'sng'; public const LINE_DOUBLE = 'dbl'; @@ -32,7 +31,7 @@ class Border implements ComparableInterface public const LINE_THINTHICK = 'thinThick'; public const LINE_TRI = 'tri'; - /* Dash style */ + // Dash style public const DASH_DASH = 'dash'; public const DASH_DASHDOT = 'dashDot'; public const DASH_DOT = 'dot'; @@ -87,8 +86,6 @@ public function __construct() /** * Get line width (in points). - * - * @return int */ public function getLineWidth(): int { @@ -97,10 +94,6 @@ public function getLineWidth(): int /** * Set line width (in points). - * - * @param int $pValue - * - * @return self */ public function setLineWidth(int $pValue = 1): self { @@ -111,8 +104,6 @@ public function setLineWidth(int $pValue = 1): self /** * Get line style. - * - * @return string */ public function getLineStyle(): string { @@ -121,10 +112,6 @@ public function getLineStyle(): string /** * Set line style. - * - * @param string $pValue - * - * @return self */ public function setLineStyle(string $pValue = self::LINE_SINGLE): self { @@ -138,8 +125,6 @@ public function setLineStyle(string $pValue = self::LINE_SINGLE): self /** * Get dash style. - * - * @return string */ public function getDashStyle(): string { @@ -148,10 +133,6 @@ public function getDashStyle(): string /** * Set dash style. - * - * @param string $pValue - * - * @return self */ public function setDashStyle(string $pValue = self::DASH_SOLID): self { @@ -175,12 +156,8 @@ public function getColor(): ?Color /** * Set Border Color. - * - * @param Color|null $color - * - * @return self */ - public function setColor(Color $color = null): self + public function setColor(?Color $color = null): self { $this->color = $color; @@ -209,7 +186,7 @@ public function getHashCode(): string * Note that this index may vary during script execution! Only reliable moment is * while doing a write of a workbook and when changes are not allowed. * - * @return int|null Hash index + * @return null|int Hash index */ public function getHashIndex(): ?int { diff --git a/src/PhpPresentation/Style/Borders.php b/src/PhpPresentation/Style/Borders.php index 01fa0112a..efdc2867b 100644 --- a/src/PhpPresentation/Style/Borders.php +++ b/src/PhpPresentation/Style/Borders.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -176,7 +175,7 @@ public function getHashCode(): string * Note that this index may vary during script execution! Only reliable moment is * while doing a write of a workbook and when changes are not allowed. * - * @return int|null Hash index + * @return null|int Hash index */ public function getHashIndex(): ?int { diff --git a/src/PhpPresentation/Style/Bullet.php b/src/PhpPresentation/Style/Bullet.php index dd3729d5d..e31a06c55 100644 --- a/src/PhpPresentation/Style/Bullet.php +++ b/src/PhpPresentation/Style/Bullet.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -27,12 +26,12 @@ */ class Bullet implements ComparableInterface { - /* Bullet types */ + // Bullet types public const TYPE_NONE = 'none'; public const TYPE_BULLET = 'bullet'; public const TYPE_NUMERIC = 'numeric'; - /* Numeric bullet styles */ + // Numeric bullet styles public const NUMERIC_DEFAULT = 'arabicPeriod'; public const NUMERIC_ALPHALCPARENBOTH = 'alphaLcParenBoth'; public const NUMERIC_ALPHAUCPARENBOTH = 'alphaUcParenBoth'; @@ -281,7 +280,7 @@ public function getHashCode(): string * Note that this index may vary during script execution! Only reliable moment is * while doing a write of a workbook and when changes are not allowed. * - * @return int|null Hash index + * @return null|int Hash index */ public function getHashIndex(): ?int { diff --git a/src/PhpPresentation/Style/Color.php b/src/PhpPresentation/Style/Color.php index 56e51029f..a10ffdc73 100644 --- a/src/PhpPresentation/Style/Color.php +++ b/src/PhpPresentation/Style/Color.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -27,7 +26,7 @@ */ class Color implements ComparableInterface { - /* Colors */ + // Colors public const COLOR_BLACK = 'FF000000'; public const COLOR_WHITE = 'FFFFFFFF'; public const COLOR_RED = 'FFFF0000'; @@ -94,8 +93,6 @@ public function setARGB($pValue = self::COLOR_BLACK) /** * Get the alpha % of the ARGB * Will return 100 if no ARGB. - * - * @return int */ public function getAlpha(): int { @@ -111,8 +108,6 @@ public function getAlpha(): int /** * Set the alpha % of the ARGB. * - * @param int $alpha - * * @return $this */ public function setAlpha(int $alpha = 100): self @@ -140,9 +135,9 @@ public function getRGB() { if (6 == strlen($this->argb)) { return $this->argb; - } else { - return substr($this->argb, 2); } + + return substr($this->argb, 2); } /** @@ -185,7 +180,7 @@ public function getHashCode(): string * Note that this index may vary during script execution! Only reliable moment is * while doing a write of a workbook and when changes are not allowed. * - * @return int|null Hash index + * @return null|int Hash index */ public function getHashIndex(): ?int { diff --git a/src/PhpPresentation/Style/ColorMap.php b/src/PhpPresentation/Style/ColorMap.php index f95a3bc55..5d67c4896 100644 --- a/src/PhpPresentation/Style/ColorMap.php +++ b/src/PhpPresentation/Style/ColorMap.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpPresentation/Style/Fill.php b/src/PhpPresentation/Style/Fill.php index 19b92dbc2..337ea3cb6 100644 --- a/src/PhpPresentation/Style/Fill.php +++ b/src/PhpPresentation/Style/Fill.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -24,7 +23,7 @@ class Fill implements ComparableInterface { - /* Fill types */ + // Fill types public const FILL_NONE = 'none'; public const FILL_SOLID = 'solid'; public const FILL_GRADIENT_LINEAR = 'linear'; @@ -93,8 +92,6 @@ public function __construct() /** * Get Fill Type. - * - * @return string */ public function getFillType(): string { @@ -105,8 +102,6 @@ public function getFillType(): string * Set Fill Type. * * @param string $pValue Fill type - * - * @return self */ public function setFillType(string $pValue = self::FILL_NONE): self { @@ -117,8 +112,6 @@ public function setFillType(string $pValue = self::FILL_NONE): self /** * Get Rotation. - * - * @return float */ public function getRotation(): float { @@ -127,10 +120,6 @@ public function getRotation(): float /** * Set Rotation. - * - * @param float $pValue - * - * @return self */ public function setRotation(float $pValue = 0): self { @@ -141,8 +130,6 @@ public function setRotation(float $pValue = 0): self /** * Get Start Color. - * - * @return Color */ public function getStartColor(): Color { @@ -153,10 +140,6 @@ public function getStartColor(): Color /** * Set Start Color. - * - * @param Color $pValue - * - * @return self */ public function setStartColor(Color $pValue): self { @@ -167,8 +150,6 @@ public function setStartColor(Color $pValue): self /** * Get End Color. - * - * @return Color */ public function getEndColor(): Color { @@ -179,10 +160,6 @@ public function getEndColor(): Color /** * Set End Color. - * - * @param Color $pValue - * - * @return self */ public function setEndColor(Color $pValue): self { @@ -213,7 +190,7 @@ public function getHashCode(): string * Note that this index may vary during script execution! Only reliable moment is * while doing a write of a workbook and when changes are not allowed. * - * @return int|null Hash index + * @return null|int Hash index */ public function getHashIndex(): ?int { diff --git a/src/PhpPresentation/Style/Font.php b/src/PhpPresentation/Style/Font.php index 2e25b257a..9010aa273 100644 --- a/src/PhpPresentation/Style/Font.php +++ b/src/PhpPresentation/Style/Font.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -27,7 +26,7 @@ */ class Font implements ComparableInterface { - /* Underline types */ + // Underline types public const UNDERLINE_NONE = 'none'; public const UNDERLINE_DASH = 'dash'; public const UNDERLINE_DASHHEAVY = 'dashHeavy'; @@ -122,7 +121,7 @@ class Font implements ComparableInterface private $characterSpacing = 0; /** - * Format + * Format. * * @var string */ @@ -141,9 +140,7 @@ public function __construct() } /** - * Get Name - * - * @return string + * Get Name. */ public function getName(): string { @@ -151,11 +148,7 @@ public function getName(): string } /** - * Set Name - * - * @param string $pValue - * - * @return self + * Set Name. */ public function setName(string $pValue = 'Calibri'): self { @@ -169,8 +162,6 @@ public function setName(string $pValue = 'Calibri'): self /** * Get Character Spacing. - * - * @return float */ public function getCharacterSpacing(): float { @@ -180,10 +171,6 @@ public function getCharacterSpacing(): float /** * Set Character Spacing * Value in pt. - * - * @param float $pValue - * - * @return self */ public function setCharacterSpacing(float $pValue = 0): self { @@ -212,8 +199,6 @@ public function setSize(int $pValue = 10): self /** * Get Bold. - * - * @return bool */ public function isBold(): bool { @@ -232,8 +217,6 @@ public function setBold(bool $pValue = false): self /** * Get Italic. - * - * @return bool */ public function isItalic(): bool { @@ -252,8 +235,6 @@ public function setItalic(bool $pValue = false): self /** * Get SuperScript. - * - * @return bool */ public function isSuperScript(): bool { @@ -294,8 +275,6 @@ public function setSubScript(bool $pValue = false): self /** * Get Underline. - * - * @return string */ public function getUnderline(): string { @@ -306,8 +285,6 @@ public function getUnderline(): string * Set Underline. * * @param string $pValue Underline type - * - * @return self */ public function setUnderline(string $pValue = self::UNDERLINE_NONE): self { @@ -321,8 +298,6 @@ public function setUnderline(string $pValue = self::UNDERLINE_NONE): self /** * Get Strikethrough. - * - * @return bool */ public function isStrikethrough(): bool { @@ -358,9 +333,7 @@ public function setColor(Color $pValue): self } /** - * Get format - * - * @return string + * Get format. */ public function getFormat(): string { @@ -368,11 +341,7 @@ public function getFormat(): string } /** - * Set format - * - * @param string $value - * - * @return self + * Set format. */ public function setFormat(string $value = self::FORMAT_LATIN): self { @@ -415,7 +384,7 @@ public function getHashCode(): string * Note that this index may vary during script execution! Only reliable moment is * while doing a write of a workbook and when changes are not allowed. * - * @return int|null Hash index + * @return null|int Hash index */ public function getHashIndex(): ?int { diff --git a/src/PhpPresentation/Style/Outline.php b/src/PhpPresentation/Style/Outline.php index 99714e27d..ed7ba1656 100644 --- a/src/PhpPresentation/Style/Outline.php +++ b/src/PhpPresentation/Style/Outline.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpPresentation/Style/SchemeColor.php b/src/PhpPresentation/Style/SchemeColor.php index 040e103b1..04e724425 100644 --- a/src/PhpPresentation/Style/SchemeColor.php +++ b/src/PhpPresentation/Style/SchemeColor.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpPresentation/Style/Shadow.php b/src/PhpPresentation/Style/Shadow.php index 826dd47d9..bdbae7e04 100644 --- a/src/PhpPresentation/Style/Shadow.php +++ b/src/PhpPresentation/Style/Shadow.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -27,7 +26,7 @@ */ class Shadow implements ComparableInterface { - /* Shadow alignment */ + // Shadow alignment public const SHADOW_BOTTOM = 'b'; public const SHADOW_BOTTOM_LEFT = 'bl'; public const SHADOW_BOTTOM_RIGHT = 'br'; @@ -73,7 +72,7 @@ class Shadow implements ComparableInterface private $alignment = self::SHADOW_BOTTOM_RIGHT; /** - * @var Color|null + * @var null|Color */ private $color; @@ -200,7 +199,7 @@ public function getColor(): ?Color /** * Set Color. */ - public function setColor(Color $pValue = null): self + public function setColor(?Color $pValue = null): self { $this->color = $pValue; @@ -241,7 +240,7 @@ public function getHashCode(): string * Note that this index may vary during script execution! Only reliable moment is * while doing a write of a workbook and when changes are not allowed. * - * @return int|null Hash index + * @return null|int Hash index */ public function getHashIndex(): ?int { diff --git a/src/PhpPresentation/Style/TextStyle.php b/src/PhpPresentation/Style/TextStyle.php index 64d7c5abf..a57216e15 100644 --- a/src/PhpPresentation/Style/TextStyle.php +++ b/src/PhpPresentation/Style/TextStyle.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -28,10 +27,12 @@ class TextStyle * @var array<int, RichTextParagraph> */ protected $bodyStyle = []; + /** * @var array<int, RichTextParagraph> */ protected $titleStyle = []; + /** * @var array<int, RichTextParagraph> */ @@ -39,8 +40,6 @@ class TextStyle /** * TextStyle constructor. - * - * @param bool $default */ public function __construct(bool $default = true) { @@ -72,7 +71,7 @@ public function __construct(bool $default = true) private function checkLvl(?int $lvl): bool { - if (is_null($lvl) || $lvl > 9) { + if (null === $lvl || $lvl > 9) { return false; } diff --git a/src/PhpPresentation/Writer/AbstractDecoratorWriter.php b/src/PhpPresentation/Writer/AbstractDecoratorWriter.php index 9b12bf936..aab1d0eda 100644 --- a/src/PhpPresentation/Writer/AbstractDecoratorWriter.php +++ b/src/PhpPresentation/Writer/AbstractDecoratorWriter.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -26,9 +25,6 @@ abstract class AbstractDecoratorWriter { - /** - * @return ZipInterface - */ abstract public function render(): ZipInterface; /** diff --git a/src/PhpPresentation/Writer/AbstractWriter.php b/src/PhpPresentation/Writer/AbstractWriter.php index 14179efc3..3d935c417 100644 --- a/src/PhpPresentation/Writer/AbstractWriter.php +++ b/src/PhpPresentation/Writer/AbstractWriter.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -41,12 +40,12 @@ abstract class AbstractWriter /** * Private PhpPresentation. * - * @var PhpPresentation|null + * @var null|PhpPresentation */ protected $oPresentation; /** - * @var ZipInterface|null + * @var null|ZipInterface */ protected $oZipAdapter; @@ -69,11 +68,11 @@ public function getPhpPresentation(): ?PhpPresentation /** * Get PhpPresentation object. * - * @param PhpPresentation|null $pPhpPresentation PhpPresentation object + * @param null|PhpPresentation $pPhpPresentation PhpPresentation object * * @return self */ - public function setPhpPresentation(PhpPresentation $pPhpPresentation = null) + public function setPhpPresentation(?PhpPresentation $pPhpPresentation = null) { $this->oPresentation = $pPhpPresentation; @@ -111,7 +110,7 @@ protected function allDrawings(): array // Get an array of all slide layouts $aSlideLayouts = []; - array_walk_recursive($aSlideMasterLayouts, function ($oSlideLayout) use (&$aSlideLayouts) { + array_walk_recursive($aSlideMasterLayouts, function ($oSlideLayout) use (&$aSlideLayouts): void { $aSlideLayouts[] = $oSlideLayout; }); diff --git a/src/PhpPresentation/Writer/ODPresentation.php b/src/PhpPresentation/Writer/ODPresentation.php index a963259db..1e227dd9c 100644 --- a/src/PhpPresentation/Writer/ODPresentation.php +++ b/src/PhpPresentation/Writer/ODPresentation.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -28,6 +27,7 @@ use PhpOffice\PhpPresentation\Exception\InvalidParameterException; use PhpOffice\PhpPresentation\HashTable; use PhpOffice\PhpPresentation\PhpPresentation; +use ReflectionClass; /** * ODPresentation writer. @@ -58,7 +58,7 @@ class ODPresentation extends AbstractWriter implements WriterInterface * * @param PhpPresentation $pPhpPresentation */ - public function __construct(PhpPresentation $pPhpPresentation = null) + public function __construct(?PhpPresentation $pPhpPresentation = null) { // Assign PhpPresentation $this->setPhpPresentation($pPhpPresentation ?? new PhpPresentation()); @@ -74,10 +74,6 @@ public function __construct(PhpPresentation $pPhpPresentation = null) /** * Save PhpPresentation to file. - * - * @throws FileCopyException - * @throws FileRemoveException - * @throws InvalidParameterException */ public function save(string $pFilename): void { @@ -105,14 +101,14 @@ public function save(string $pFilename): void $arrayChart = []; $arrayFiles = []; - $oDir = new DirectoryIterator(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'ODPresentation'); + $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); + $class = new ReflectionClass($class); if ($class->isAbstract() || !$class->isSubclassOf('PhpOffice\PhpPresentation\Writer\ODPresentation\AbstractDecoratorWriter')) { continue; @@ -160,18 +156,15 @@ public function hasDiskCaching() /** * Set use disk caching where possible? * - * @param bool $pValue * @param string $directory Disk caching directory * - * @throws DirectoryNotFoundException - * * @return \PhpOffice\PhpPresentation\Writer\ODPresentation */ - public function setUseDiskCaching(bool $pValue = false, string $directory = null) + public function setUseDiskCaching(bool $pValue = false, ?string $directory = null) { $this->useDiskCaching = $pValue; - if (!is_null($directory)) { + if (null !== $directory) { if (!is_dir($directory)) { throw new DirectoryNotFoundException($directory); } diff --git a/src/PhpPresentation/Writer/ODPresentation/AbstractDecoratorWriter.php b/src/PhpPresentation/Writer/ODPresentation/AbstractDecoratorWriter.php index 7683106b6..98c6064ea 100644 --- a/src/PhpPresentation/Writer/ODPresentation/AbstractDecoratorWriter.php +++ b/src/PhpPresentation/Writer/ODPresentation/AbstractDecoratorWriter.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpPresentation/Writer/ODPresentation/Content.php b/src/PhpPresentation/Writer/ODPresentation/Content.php index bf9fc5b65..4cd604b42 100644 --- a/src/PhpPresentation/Writer/ODPresentation/Content.php +++ b/src/PhpPresentation/Writer/ODPresentation/Content.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -179,7 +178,7 @@ protected function writeContent(): string $oAlign = $item['oAlign_' . $level]; // text:list-level-style-bullet $objWriter->startElement('text:list-level-style-bullet'); - $objWriter->writeAttribute('text:level', intval($level) + 1); + $objWriter->writeAttribute('text:level', (int) $level + 1); $objWriter->writeAttribute('text:bullet-char', $oStyle->getBulletChar()); // style:list-level-properties $objWriter->startElement('style:list-level-properties'); @@ -235,21 +234,27 @@ protected function writeContent(): string switch ($item->getAlignment()->getHorizontal()) { case Alignment::HORIZONTAL_LEFT: $objWriter->writeAttribute('fo:text-align', 'left'); + break; case Alignment::HORIZONTAL_RIGHT: $objWriter->writeAttribute('fo:text-align', 'right'); + break; case Alignment::HORIZONTAL_CENTER: $objWriter->writeAttribute('fo:text-align', 'center'); + break; case Alignment::HORIZONTAL_JUSTIFY: $objWriter->writeAttribute('fo:text-align', 'justify'); + break; case Alignment::HORIZONTAL_DISTRIBUTED: $objWriter->writeAttribute('fo:text-align', 'justify'); + break; default: $objWriter->writeAttribute('fo:text-align', 'left'); + break; } $objWriter->writeAttribute( @@ -278,6 +283,7 @@ protected function writeContent(): string $objWriter->writeAttributeIf($item->getFont()->isBold(), 'fo:font-weight', 'bold'); $objWriter->writeAttribute('fo:language', ($item->getLanguage() ? $item->getLanguage() : 'en')); $objWriter->writeAttribute('style:script-type', 'latin'); + break; case Font::FORMAT_EAST_ASIAN: $objWriter->writeAttribute('style:font-family-asian', $item->getFont()->getName()); @@ -285,6 +291,7 @@ protected function writeContent(): string $objWriter->writeAttributeIf($item->getFont()->isBold(), 'style:font-weight-asian', 'bold'); $objWriter->writeAttribute('style:language-asian', ($item->getLanguage() ? $item->getLanguage() : 'en')); $objWriter->writeAttribute('style:script-type', 'asian'); + break; case Font::FORMAT_COMPLEX_SCRIPT: $objWriter->writeAttribute('style:font-family-complex', $item->getFont()->getName()); @@ -292,6 +299,7 @@ protected function writeContent(): string $objWriter->writeAttributeIf($item->getFont()->isBold(), 'style:font-weight-complex', 'bold'); $objWriter->writeAttribute('style:language-complex', ($item->getLanguage() ? $item->getLanguage() : 'en')); $objWriter->writeAttribute('style:script-type', 'complex'); + break; } @@ -318,7 +326,7 @@ protected function writeContent(): string $pSlide = $this->getPresentation()->getSlide($i); $objWriter->startElement('draw:page'); $name = $pSlide->getName(); - if (!is_null($name)) { + if (null !== $name) { $objWriter->writeAttribute('draw:name', $name); } $objWriter->writeAttribute('draw:master-page-name', 'Standard'); @@ -549,7 +557,7 @@ protected function writeShapeTxt(XMLWriter $objWriter, RichText $shape): void } elseif ('bullet' == $paragraph->getBulletStyle()->getBulletType()) { $bCstShpHasBullet = true; // Open the bullet list - if ('bullet' != $sCstShpLastBullet || ($sCstShpLastBullet == $paragraph->getBulletStyle()->getBulletType() && $iCstShpLastBulletLvl < $paragraph->getAlignment()->getLevel())) { + if ('bullet' != $sCstShpLastBullet || $iCstShpLastBulletLvl < $paragraph->getAlignment()->getLevel()) { // text:list $objWriter->startElement('text:list'); $objWriter->writeAttribute('text:style-name', 'L_' . $paragraph->getBulletStyle()->getHashCode()); @@ -633,9 +641,7 @@ protected function writeShapeTxt(XMLWriter $objWriter, RichText $shape): void */ protected function writeShapeComment(XMLWriter $objWriter, Comment $oShape): void { - /* - * Note : This element is not valid in the Schema 1.2 - */ + // Note : This element is not valid in the Schema 1.2 // officeooo:annotation $objWriter->startElement('officeooo:annotation'); $objWriter->writeAttribute('svg:x', number_format(CommonDrawing::pixelsToCentimeters((int) $oShape->getOffsetX()), 2, '.', '') . 'cm'); @@ -874,15 +880,18 @@ protected function writeTxtStyle(XMLWriter $objWriter, RichText $shape): void case Fill::FILL_GRADIENT_PATH: $objWriter->writeAttribute('draw:fill', 'gradient'); $objWriter->writeAttribute('draw:fill-gradient-name', 'gradient_' . $shape->getFill()->getHashCode()); + break; case Fill::FILL_SOLID: $objWriter->writeAttribute('draw:fill', 'solid'); $objWriter->writeAttribute('draw:fill-color', '#' . $shape->getFill()->getStartColor()->getRGB()); + break; case Fill::FILL_NONE: default: $objWriter->writeAttribute('draw:fill', 'none'); $objWriter->writeAttribute('draw:fill-color', '#' . $shape->getFill()->getStartColor()->getRGB()); + break; } // Border @@ -894,6 +903,7 @@ protected function writeTxtStyle(XMLWriter $objWriter, RichText $shape): void switch ($shape->getBorder()->getDashStyle()) { case Border::DASH_SOLID: $objWriter->writeAttribute('draw:stroke', 'solid'); + break; case Border::DASH_DASH: case Border::DASH_DASHDOT: @@ -907,9 +917,11 @@ protected function writeTxtStyle(XMLWriter $objWriter, RichText $shape): void case Border::DASH_SYSDOT: $objWriter->writeAttribute('draw:stroke', 'dash'); $objWriter->writeAttribute('draw:stroke-dash', 'strokeDash_' . $shape->getBorder()->getDashStyle()); + break; default: $objWriter->writeAttribute('draw:stroke', 'none'); + break; } } @@ -995,12 +1007,15 @@ protected function writeLineStyle(XMLWriter $objWriter, Line $shape): void switch ($shape->getBorder()->getLineStyle()) { case Border::LINE_NONE: $objWriter->writeAttribute('draw:stroke', 'none'); + break; case Border::LINE_SINGLE: $objWriter->writeAttribute('draw:stroke', 'solid'); + break; default: $objWriter->writeAttribute('draw:stroke', 'none'); + break; } $objWriter->writeAttribute('svg:stroke-color', '#' . $shape->getBorder()->getColor()->getRGB()); @@ -1034,9 +1049,7 @@ protected function writeTableStyle(XMLWriter $objWriter, Table $shape): void $objWriter->writeAttribute('style:name', 'gr' . $this->shapeId . 'r' . $keyRow . 'c' . $keyCell); $objWriter->writeAttribute('style:family', 'table-cell'); - /* - * Note : This element is not valid in the Schema 1.2 - */ + // Note : This element is not valid in the Schema 1.2 // style:graphic-properties if (Fill::FILL_NONE != $shapeCell->getFill()->getFillType()) { $objWriter->startElement('style:graphic-properties'); @@ -1157,166 +1170,214 @@ protected function writeStyleSlide(XMLWriter $objWriter, Slide $slide, int $incP // style:style/style:drawing-page-properties $objWriter->startElement('style:drawing-page-properties'); $objWriter->writeAttributeIf(!$slide->isVisible(), 'presentation:visibility', 'hidden'); - if (!is_null($oTransition = $slide->getTransition())) { + if (null !== ($oTransition = $slide->getTransition())) { $objWriter->writeAttribute('presentation:duration', 'PT' . number_format($oTransition->getAdvanceTimeTrigger() / 1000, 6, '.', '') . 'S'); $objWriter->writeAttributeIf($oTransition->hasManualTrigger(), 'presentation:transition-type', 'manual'); $objWriter->writeAttributeIf($oTransition->hasTimeTrigger(), 'presentation:transition-type', 'automatic'); switch ($oTransition->getSpeed()) { case Transition::SPEED_FAST: $objWriter->writeAttribute('presentation:transition-speed', 'fast'); + break; case Transition::SPEED_MEDIUM: $objWriter->writeAttribute('presentation:transition-speed', 'medium'); + break; case Transition::SPEED_SLOW: $objWriter->writeAttribute('presentation:transition-speed', 'slow'); + break; } - /* - * http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part1.html#property-presentation_transition-style - */ + // http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part1.html#property-presentation_transition-style switch ($oTransition->getTransitionType()) { case Transition::TRANSITION_BLINDS_HORIZONTAL: $objWriter->writeAttribute('presentation:transition-style', 'horizontal-stripes'); + break; case Transition::TRANSITION_BLINDS_VERTICAL: $objWriter->writeAttribute('presentation:transition-style', 'vertical-stripes'); + break; case Transition::TRANSITION_CHECKER_HORIZONTAL: $objWriter->writeAttribute('presentation:transition-style', 'horizontal-checkerboard'); + break; case Transition::TRANSITION_CHECKER_VERTICAL: $objWriter->writeAttribute('presentation:transition-style', 'vertical-checkerboard'); + break; case Transition::TRANSITION_CIRCLE: $objWriter->writeAttribute('presentation:transition-style', 'none'); + break; case Transition::TRANSITION_COMB_HORIZONTAL: $objWriter->writeAttribute('presentation:transition-style', 'none'); + break; case Transition::TRANSITION_COMB_VERTICAL: $objWriter->writeAttribute('presentation:transition-style', 'none'); + break; case Transition::TRANSITION_COVER_DOWN: $objWriter->writeAttribute('presentation:transition-style', 'uncover-to-bottom'); + break; case Transition::TRANSITION_COVER_LEFT: $objWriter->writeAttribute('presentation:transition-style', 'uncover-to-left'); + break; case Transition::TRANSITION_COVER_LEFT_DOWN: $objWriter->writeAttribute('presentation:transition-style', 'uncover-to-lowerleft'); + break; case Transition::TRANSITION_COVER_LEFT_UP: $objWriter->writeAttribute('presentation:transition-style', 'uncover-to-upperleft'); + break; case Transition::TRANSITION_COVER_RIGHT: $objWriter->writeAttribute('presentation:transition-style', 'uncover-to-right'); + break; case Transition::TRANSITION_COVER_RIGHT_DOWN: $objWriter->writeAttribute('presentation:transition-style', 'uncover-to-lowerright'); + break; case Transition::TRANSITION_COVER_RIGHT_UP: $objWriter->writeAttribute('presentation:transition-style', 'uncover-to-upperright'); + break; case Transition::TRANSITION_COVER_UP: $objWriter->writeAttribute('presentation:transition-style', 'uncover-to-top'); + break; case Transition::TRANSITION_CUT: $objWriter->writeAttribute('presentation:transition-style', 'none'); + break; case Transition::TRANSITION_DIAMOND: $objWriter->writeAttribute('presentation:transition-style', 'none'); + break; case Transition::TRANSITION_DISSOLVE: $objWriter->writeAttribute('presentation:transition-style', 'dissolve'); + break; case Transition::TRANSITION_FADE: $objWriter->writeAttribute('presentation:transition-style', 'fade-from-center'); + break; case Transition::TRANSITION_NEWSFLASH: $objWriter->writeAttribute('presentation:transition-style', 'none'); + break; case Transition::TRANSITION_PLUS: $objWriter->writeAttribute('presentation:transition-style', 'close'); + break; case Transition::TRANSITION_PULL_DOWN: $objWriter->writeAttribute('presentation:transition-style', 'stretch-from-bottom'); + break; case Transition::TRANSITION_PULL_LEFT: $objWriter->writeAttribute('presentation:transition-style', 'stretch-from-left'); + break; case Transition::TRANSITION_PULL_RIGHT: $objWriter->writeAttribute('presentation:transition-style', 'stretch-from-right'); + break; case Transition::TRANSITION_PULL_UP: $objWriter->writeAttribute('presentation:transition-style', 'stretch-from-top'); + break; case Transition::TRANSITION_PUSH_DOWN: $objWriter->writeAttribute('presentation:transition-style', 'roll-from-bottom'); + break; case Transition::TRANSITION_PUSH_LEFT: $objWriter->writeAttribute('presentation:transition-style', 'roll-from-left'); + break; case Transition::TRANSITION_PUSH_RIGHT: $objWriter->writeAttribute('presentation:transition-style', 'roll-from-right'); + break; case Transition::TRANSITION_PUSH_UP: $objWriter->writeAttribute('presentation:transition-style', 'roll-from-top'); + break; case Transition::TRANSITION_RANDOM: $objWriter->writeAttribute('presentation:transition-style', 'random'); + break; case Transition::TRANSITION_RANDOMBAR_HORIZONTAL: $objWriter->writeAttribute('presentation:transition-style', 'horizontal-lines'); + break; case Transition::TRANSITION_RANDOMBAR_VERTICAL: $objWriter->writeAttribute('presentation:transition-style', 'vertical-lines'); + break; case Transition::TRANSITION_SPLIT_IN_HORIZONTAL: $objWriter->writeAttribute('presentation:transition-style', 'close-horizontal'); + break; case Transition::TRANSITION_SPLIT_OUT_HORIZONTAL: $objWriter->writeAttribute('presentation:transition-style', 'open-horizontal'); + break; case Transition::TRANSITION_SPLIT_IN_VERTICAL: $objWriter->writeAttribute('presentation:transition-style', 'close-vertical'); + break; case Transition::TRANSITION_SPLIT_OUT_VERTICAL: $objWriter->writeAttribute('presentation:transition-style', 'open-vertical'); + break; case Transition::TRANSITION_STRIPS_LEFT_DOWN: $objWriter->writeAttribute('presentation:transition-style', 'none'); + break; case Transition::TRANSITION_STRIPS_LEFT_UP: $objWriter->writeAttribute('presentation:transition-style', 'none'); + break; case Transition::TRANSITION_STRIPS_RIGHT_DOWN: $objWriter->writeAttribute('presentation:transition-style', 'none'); + break; case Transition::TRANSITION_STRIPS_RIGHT_UP: $objWriter->writeAttribute('presentation:transition-style', 'none'); + break; case Transition::TRANSITION_WEDGE: $objWriter->writeAttribute('presentation:transition-style', 'none'); + break; case Transition::TRANSITION_WIPE_DOWN: $objWriter->writeAttribute('presentation:transition-style', 'fade-from-bottom'); + break; case Transition::TRANSITION_WIPE_LEFT: $objWriter->writeAttribute('presentation:transition-style', 'fade-from-left'); + break; case Transition::TRANSITION_WIPE_RIGHT: $objWriter->writeAttribute('presentation:transition-style', 'fade-from-right'); + break; case Transition::TRANSITION_WIPE_UP: $objWriter->writeAttribute('presentation:transition-style', 'fade-from-top'); + break; case Transition::TRANSITION_ZOOM_IN: $objWriter->writeAttribute('presentation:transition-style', 'none'); + break; case Transition::TRANSITION_ZOOM_OUT: $objWriter->writeAttribute('presentation:transition-style', 'none'); + break; } } @@ -1347,10 +1408,12 @@ protected function writeStylePartFill(XMLWriter $objWriter, ?Fill $oFill): void case Fill::FILL_SOLID: $objWriter->writeAttribute('draw:fill', 'solid'); $objWriter->writeAttribute('draw:fill-color', '#' . $oFill->getStartColor()->getRGB()); + break; case Fill::FILL_NONE: default: $objWriter->writeAttribute('draw:fill', 'none'); + break; } } diff --git a/src/PhpPresentation/Writer/ODPresentation/Meta.php b/src/PhpPresentation/Writer/ODPresentation/Meta.php index d976503e8..cc1ca03ab 100644 --- a/src/PhpPresentation/Writer/ODPresentation/Meta.php +++ b/src/PhpPresentation/Writer/ODPresentation/Meta.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -26,9 +25,6 @@ class Meta extends AbstractDecoratorWriter { - /** - * @return ZipInterface - */ public function render(): ZipInterface { // Create XML writer @@ -83,20 +79,24 @@ public function render(): ZipInterface case DocumentProperties::PROPERTY_TYPE_FLOAT: $objWriter->writeAttribute('meta:value-type', 'float'); $objWriter->writeRaw((string) $propertyValue); + break; case DocumentProperties::PROPERTY_TYPE_BOOLEAN: $objWriter->writeAttribute('meta:value-type', 'boolean'); $objWriter->writeRaw($propertyValue ? 'true' : 'false'); + break; case DocumentProperties::PROPERTY_TYPE_DATE: $objWriter->writeAttribute('meta:value-type', 'date'); $objWriter->writeRaw(date(DATE_W3C, (int) $propertyValue)); + break; case DocumentProperties::PROPERTY_TYPE_STRING: case DocumentProperties::PROPERTY_TYPE_UNKNOWN: default: $objWriter->writeAttribute('meta:value-type', 'string'); $objWriter->writeRaw((string) $propertyValue); + break; } $objWriter->endElement(); diff --git a/src/PhpPresentation/Writer/ODPresentation/MetaInfManifest.php b/src/PhpPresentation/Writer/ODPresentation/MetaInfManifest.php index 49f023e76..b97f3d6f4 100644 --- a/src/PhpPresentation/Writer/ODPresentation/MetaInfManifest.php +++ b/src/PhpPresentation/Writer/ODPresentation/MetaInfManifest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -27,9 +26,6 @@ class MetaInfManifest extends AbstractDecoratorWriter { - /** - * @return ZipInterface - */ public function render(): ZipInterface { // Create XML writer diff --git a/src/PhpPresentation/Writer/ODPresentation/Mimetype.php b/src/PhpPresentation/Writer/ODPresentation/Mimetype.php index 80101241d..5a7060417 100644 --- a/src/PhpPresentation/Writer/ODPresentation/Mimetype.php +++ b/src/PhpPresentation/Writer/ODPresentation/Mimetype.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -24,9 +23,6 @@ class Mimetype extends AbstractDecoratorWriter { - /** - * @return ZipInterface - */ public function render(): ZipInterface { $this->getZip()->addFromString('mimetype', 'application/vnd.oasis.opendocument.presentation'); diff --git a/src/PhpPresentation/Writer/ODPresentation/ObjectsChart.php b/src/PhpPresentation/Writer/ODPresentation/ObjectsChart.php index 12ded0723..41aa54b58 100644 --- a/src/PhpPresentation/Writer/ODPresentation/ObjectsChart.php +++ b/src/PhpPresentation/Writer/ODPresentation/ObjectsChart.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -48,22 +47,27 @@ class ObjectsChart extends AbstractDecoratorWriter * @var XMLWriter */ protected $xmlContent; + /** * @var mixed */ protected $arrayData; + /** * @var mixed */ protected $arrayTitle; + /** * @var int */ protected $numData; + /** * @var int */ protected $numSeries; + /** * @var string */ @@ -326,15 +330,18 @@ protected function writeAxisMainStyle(Chart\Axis $axis, string $styleName, Abstr switch ($axis->getTickLabelPosition()) { case Axis::TICK_LABEL_POSITION_NEXT_TO: $this->xmlContent->writeAttribute('chart:axis-label-position', 'near-axis'); + break; case Axis::TICK_LABEL_POSITION_HIGH: $this->xmlContent->writeAttribute('chart:axis-position', '0'); $this->xmlContent->writeAttribute('chart:axis-label-position', 'outside-end'); + break; case Axis::TICK_LABEL_POSITION_LOW: $this->xmlContent->writeAttribute('chart:axis-position', '0'); $this->xmlContent->writeAttribute('chart:axis-label-position', 'outside-start'); $this->xmlContent->writeAttribute('chart:tick-mark-position', 'at-axis'); + break; } $this->xmlContent->writeAttributeIf($chartType instanceof Radar && $styleName == 'styleAxisX', 'chart:reverse-direction', 'true'); @@ -449,19 +456,24 @@ protected function writeLegend(Chart $chart): void switch ($chart->getLegend()->getPosition()) { case Chart\Legend::POSITION_BOTTOM: $position = 'bottom'; + break; case Chart\Legend::POSITION_LEFT: $position = 'start'; + break; case Chart\Legend::POSITION_TOP: $position = 'top'; + break; case Chart\Legend::POSITION_TOPRIGHT: $position = 'top-end'; + break; case Chart\Legend::POSITION_RIGHT: default: $position = 'end'; + break; } $this->xmlContent->writeAttribute('chart:legend-position', $position); @@ -573,12 +585,15 @@ protected function writePlotAreaStyle(Chart $chart): void switch ($chart->getDisplayBlankAs()) { case Chart::BLANKAS_ZERO: $this->xmlContent->writeAttribute('chart:treat-empty-cells', 'use-zero'); + break; case Chart::BLANKAS_GAP: $this->xmlContent->writeAttribute('chart:treat-empty-cells', 'leave-gap'); + break; case Chart::BLANKAS_SPAN: $this->xmlContent->writeAttribute('chart:treat-empty-cells', 'ignore'); + break; } if ($chartType instanceof AbstractTypeBar) { @@ -706,27 +721,27 @@ protected function writeSeriesStyle(Chart $chart, Chart\Series $series): void } if ($chartType instanceof Line || $chartType instanceof Scatter) { $oMarker = $series->getMarker(); - /* - * @link : http://www.datypic.com/sc/odf/a-chart_symbol-type.html - */ + // @link : http://www.datypic.com/sc/odf/a-chart_symbol-type.html $this->xmlContent->writeAttributeIf(Chart\Marker::SYMBOL_NONE == $oMarker->getSymbol(), 'chart:symbol-type', 'none'); - /* - * @link : http://www.datypic.com/sc/odf/a-chart_symbol-name.html - */ + // @link : http://www.datypic.com/sc/odf/a-chart_symbol-name.html $this->xmlContent->writeAttributeIf(Chart\Marker::SYMBOL_NONE != $oMarker->getSymbol(), 'chart:symbol-type', 'named-symbol'); if (Chart\Marker::SYMBOL_NONE != $oMarker->getSymbol()) { switch ($oMarker->getSymbol()) { case Chart\Marker::SYMBOL_DASH: $symbolName = 'horizontal-bar'; + break; case Chart\Marker::SYMBOL_DOT: $symbolName = 'circle'; + break; case Chart\Marker::SYMBOL_TRIANGLE: $symbolName = 'arrow-up'; + break; default: $symbolName = $oMarker->getSymbol(); + break; } $this->xmlContent->writeAttribute('chart:symbol-name', $symbolName); @@ -880,13 +895,13 @@ protected function writeTable(): void // table:table-cell $this->xmlContent->startElement('table:table-cell'); - $cellValueTypeFloat = is_null($cell) ? true : is_numeric($cell); + $cellValueTypeFloat = null === $cell ? true : is_numeric($cell); $this->xmlContent->writeAttributeIf(!$cellValueTypeFloat, 'office:value-type', 'string'); $this->xmlContent->writeAttributeIf($cellValueTypeFloat, 'office:value-type', 'float'); - $this->xmlContent->writeAttributeIf($cellValueTypeFloat, 'office:value', is_null($cell) ? 'NaN' : $cell); + $this->xmlContent->writeAttributeIf($cellValueTypeFloat, 'office:value', null === $cell ? 'NaN' : $cell); // text:p $this->xmlContent->startElement('text:p'); - $this->xmlContent->text(is_null($cell) ? 'NaN' : (string) $cell); + $this->xmlContent->text(null === $cell ? 'NaN' : (string) $cell); $this->xmlContent->endElement(); // > table:table-cell $this->xmlContent->endElement(); diff --git a/src/PhpPresentation/Writer/ODPresentation/Pictures.php b/src/PhpPresentation/Writer/ODPresentation/Pictures.php index ac8cfa933..ba83e8306 100644 --- a/src/PhpPresentation/Writer/ODPresentation/Pictures.php +++ b/src/PhpPresentation/Writer/ODPresentation/Pictures.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -26,9 +25,6 @@ class Pictures extends AbstractDecoratorWriter { - /** - * @return ZipInterface - */ public function render(): ZipInterface { $arrMedia = []; diff --git a/src/PhpPresentation/Writer/ODPresentation/Styles.php b/src/PhpPresentation/Writer/ODPresentation/Styles.php index 6bc8cbfb2..a36a067cf 100644 --- a/src/PhpPresentation/Writer/ODPresentation/Styles.php +++ b/src/PhpPresentation/Writer/ODPresentation/Styles.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -39,6 +38,7 @@ class Styles extends AbstractDecoratorWriter * @var array<int, string> */ protected $arrayGradient = []; + /** * Stores font styles draw:stroke-dash nodes. * @@ -199,6 +199,7 @@ protected function writeRichTextStyle(XMLWriter $objWriter, RichText $shape): vo $objWriter->writeAttribute('draw:distance', '0.105cm'); $objWriter->writeAttribute('draw:dots2', '1'); $objWriter->writeAttribute('draw:dots2-length', '0.14cm'); + break; case Border::DASH_DASHDOT: $objWriter->writeAttribute('draw:distance', '0.105cm'); @@ -206,16 +207,19 @@ protected function writeRichTextStyle(XMLWriter $objWriter, RichText $shape): vo $objWriter->writeAttribute('draw:dots1-length', '0.035cm'); $objWriter->writeAttribute('draw:dots2', '1'); $objWriter->writeAttribute('draw:dots2-length', '0.14cm'); + break; case Border::DASH_DOT: $objWriter->writeAttribute('draw:distance', '0.105cm'); $objWriter->writeAttribute('draw:dots1', '1'); $objWriter->writeAttribute('draw:dots1-length', '0.035cm'); + break; case Border::DASH_LARGEDASH: $objWriter->writeAttribute('draw:distance', '0.105cm'); $objWriter->writeAttribute('draw:dots2', '1'); $objWriter->writeAttribute('draw:dots2-length', '0.28cm'); + break; case Border::DASH_LARGEDASHDOT: $objWriter->writeAttribute('draw:distance', '0.105cm'); @@ -223,6 +227,7 @@ protected function writeRichTextStyle(XMLWriter $objWriter, RichText $shape): vo $objWriter->writeAttribute('draw:dots1-length', '0.035cm'); $objWriter->writeAttribute('draw:dots2', '1'); $objWriter->writeAttribute('draw:dots2-length', '0.28cm'); + break; case Border::DASH_LARGEDASHDOTDOT: $objWriter->writeAttribute('draw:distance', '0.105cm'); @@ -230,11 +235,13 @@ protected function writeRichTextStyle(XMLWriter $objWriter, RichText $shape): vo $objWriter->writeAttribute('draw:dots1-length', '0.035cm'); $objWriter->writeAttribute('draw:dots2', '1'); $objWriter->writeAttribute('draw:dots2-length', '0.28cm'); + break; case Border::DASH_SYSDASH: $objWriter->writeAttribute('draw:distance', '0.035cm'); $objWriter->writeAttribute('draw:dots2', '1'); $objWriter->writeAttribute('draw:dots2-length', '0.105cm'); + break; case Border::DASH_SYSDASHDOT: $objWriter->writeAttribute('draw:distance', '0.035cm'); @@ -242,6 +249,7 @@ protected function writeRichTextStyle(XMLWriter $objWriter, RichText $shape): vo $objWriter->writeAttribute('draw:dots1-length', '0.035cm'); $objWriter->writeAttribute('draw:dots2', '1'); $objWriter->writeAttribute('draw:dots2-length', '0.105cm'); + break; case Border::DASH_SYSDASHDOTDOT: $objWriter->writeAttribute('draw:distance', '0.035cm'); @@ -249,11 +257,13 @@ protected function writeRichTextStyle(XMLWriter $objWriter, RichText $shape): vo $objWriter->writeAttribute('draw:dots1-length', '0.035cm'); $objWriter->writeAttribute('draw:dots2', '1'); $objWriter->writeAttribute('draw:dots2-length', '0.105cm'); + break; case Border::DASH_SYSDOT: $objWriter->writeAttribute('draw:distance', '0.035cm'); $objWriter->writeAttribute('draw:dots1', '1'); $objWriter->writeAttribute('draw:dots1-length', '0.035cm'); + break; } $objWriter->endElement(); diff --git a/src/PhpPresentation/Writer/ODPresentation/ThumbnailsThumbnail.php b/src/PhpPresentation/Writer/ODPresentation/ThumbnailsThumbnail.php index 1d754335f..7d05129b6 100644 --- a/src/PhpPresentation/Writer/ODPresentation/ThumbnailsThumbnail.php +++ b/src/PhpPresentation/Writer/ODPresentation/ThumbnailsThumbnail.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -32,7 +31,7 @@ public function render(): ZipInterface // PNG : 8bit, non-interlaced with full alpha transparency $gdImage = imagecreatefromstring(file_get_contents($pathThumbnail)); if ($gdImage) { - list($width, $height) = getimagesize($pathThumbnail); + [$width, $height] = getimagesize($pathThumbnail); $gdRender = imagecreatetruecolor(128, 128); $colorBgAlpha = imagecolorallocatealpha($gdRender, 0, 0, 0, 127); diff --git a/src/PhpPresentation/Writer/PowerPoint2007.php b/src/PhpPresentation/Writer/PowerPoint2007.php index e98a61837..934944a98 100644 --- a/src/PhpPresentation/Writer/PowerPoint2007.php +++ b/src/PhpPresentation/Writer/PowerPoint2007.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -55,7 +54,7 @@ class PowerPoint2007 extends AbstractWriter implements WriterInterface * * @param PhpPresentation $pPhpPresentation */ - public function __construct(PhpPresentation $pPhpPresentation = null) + public function __construct(?PhpPresentation $pPhpPresentation = null) { // Assign PhpPresentation $this->setPhpPresentation($pPhpPresentation ?? new PhpPresentation()); @@ -71,10 +70,6 @@ public function __construct(PhpPresentation $pPhpPresentation = null) /** * Save PhpPresentation to file. - * - * @throws FileCopyException - * @throws FileRemoveException - * @throws InvalidParameterException */ public function save(string $pFilename): void { @@ -98,7 +93,7 @@ public function save(string $pFilename): void $oZip = $this->getZipAdapter(); $oZip->open($pFilename); - $oDir = new DirectoryIterator(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'PowerPoint2007'); + $oDir = new DirectoryIterator(__DIR__ . DIRECTORY_SEPARATOR . 'PowerPoint2007'); $arrayFiles = []; foreach ($oDir as $oFile) { if (!$oFile->isFile()) { @@ -152,18 +147,15 @@ public function hasDiskCaching() /** * Set use disk caching where possible? * - * @param bool $useDiskCaching * @param string $directory Disk caching directory * - * @throws DirectoryNotFoundException - * * @return \PhpOffice\PhpPresentation\Writer\PowerPoint2007 */ - public function setUseDiskCaching(bool $useDiskCaching = false, string $directory = null) + public function setUseDiskCaching(bool $useDiskCaching = false, ?string $directory = null) { $this->useDiskCaching = $useDiskCaching; - if (!is_null($directory)) { + if (null !== $directory) { if (!is_dir($directory)) { throw new DirectoryNotFoundException($directory); } diff --git a/src/PhpPresentation/Writer/PowerPoint2007/AbstractDecoratorWriter.php b/src/PhpPresentation/Writer/PowerPoint2007/AbstractDecoratorWriter.php index 362d94193..0c77e9516 100644 --- a/src/PhpPresentation/Writer/PowerPoint2007/AbstractDecoratorWriter.php +++ b/src/PhpPresentation/Writer/PowerPoint2007/AbstractDecoratorWriter.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -59,7 +58,6 @@ protected function writeRelationship(XMLWriter $objWriter, int $pId, string $pTy * @param XMLWriter $objWriter XML Writer * @param Border $pBorder Border * @param string $pElementName Element name - * @param bool $isMarker */ protected function writeBorder(XMLWriter $objWriter, Border $pBorder, string $pElementName = 'L', bool $isMarker = false): void { @@ -125,7 +123,7 @@ protected function writeBorder(XMLWriter $objWriter, Border $pBorder, string $pE protected function writeColor(XMLWriter $objWriter, Color $color, ?int $alpha = null): void { - if (is_null($alpha)) { + if (null === $alpha) { $alpha = $color->getAlpha(); } @@ -145,7 +143,7 @@ protected function writeColor(XMLWriter $objWriter, Color $color, ?int $alpha = * Write Fill. * * @param XMLWriter $objWriter XML Writer - * @param Fill|null $pFill Fill style + * @param null|Fill $pFill Fill style */ protected function writeFill(XMLWriter $objWriter, ?Fill $pFill): void { @@ -257,7 +255,7 @@ protected function writePatternFill(XMLWriter $objWriter, Fill $pFill): void } /** - * Write Outline + * Write Outline. */ protected function writeOutline(XMLWriter $objWriter, ?Outline $oOutline): void { diff --git a/src/PhpPresentation/Writer/PowerPoint2007/AbstractSlide.php b/src/PhpPresentation/Writer/PowerPoint2007/AbstractSlide.php index c310379bd..930a22959 100644 --- a/src/PhpPresentation/Writer/PowerPoint2007/AbstractSlide.php +++ b/src/PhpPresentation/Writer/PowerPoint2007/AbstractSlide.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -122,8 +121,6 @@ protected function writeDrawingRelations(AbstractSlideAlias $pSlideMaster, XMLWr /** * @param array<int, AbstractShape>|ArrayObject<int, AbstractShape> $shapes * @param int $shapeId - * - * @throws UndefinedChartTypeException */ protected function writeShapeCollection(XMLWriter $objWriter, $shapes = [], &$shapeId = 0): void { @@ -159,8 +156,6 @@ protected function writeShapeCollection(XMLWriter $objWriter, $shapes = [], &$sh * Write txt. * * @param XMLWriter $objWriter XML Writer - * @param RichText $shape - * @param int $shapeId */ protected function writeShapeText(XMLWriter $objWriter, RichText $shape, int $shapeId): void { @@ -191,7 +186,7 @@ protected function writeShapeText(XMLWriter $objWriter, RichText $shape, int $sh $objWriter->startElement('p:nvPr'); $objWriter->startElement('p:ph'); $objWriter->writeAttribute('type', $shape->getPlaceholder()->getType()); - if (!is_null($shape->getPlaceholder()->getIdx())) { + if (null !== $shape->getPlaceholder()->getIdx()) { $objWriter->writeAttribute('idx', $shape->getPlaceholder()->getIdx()); } $objWriter->endElement(); @@ -272,10 +267,10 @@ protected function writeShapeText(XMLWriter $objWriter, RichText $shape, int $sh // a:spAutoFit $objWriter->startElement('a:' . $shape->getAutoFit()); if (RichText::AUTOFIT_NORMAL == $shape->getAutoFit()) { - if (!is_null($shape->getFontScale())) { + if (null !== $shape->getFontScale()) { $objWriter->writeAttribute('fontScale', $shape->getFontScale() * 1000); } - if (!is_null($shape->getLineSpaceReduction())) { + if (null !== $shape->getLineSpaceReduction()) { $objWriter->writeAttribute('lnSpcReduction', $shape->getLineSpaceReduction() * 1000); } } @@ -311,8 +306,6 @@ protected function writeShapeText(XMLWriter $objWriter, RichText $shape, int $sh * Write table. * * @param XMLWriter $objWriter XML Writer - * @param ShapeTable $shape - * @param int $shapeId */ protected function writeShapeTable(XMLWriter $objWriter, ShapeTable $shape, int $shapeId): void { @@ -1089,11 +1082,9 @@ protected function writeNote(Note $pNote): string } /** - * Write AutoShape + * Write AutoShape. * * @param XMLWriter $objWriter XML Writer - * @param AutoShape $shape - * @param int $shapeId */ protected function writeShapeAutoShape(XMLWriter $objWriter, AutoShape $shape, int $shapeId): void { @@ -1186,7 +1177,7 @@ protected function writeShapeAutoShape(XMLWriter $objWriter, AutoShape $shape, i } /** - * Write chart + * Write chart. * * @param XMLWriter $objWriter XML Writer */ @@ -1300,9 +1291,7 @@ protected function writeShapePic(XMLWriter $objWriter, AbstractGraphic $shape, i $objWriter->writeAttribute('type', $shape->getPlaceholder()->getType()); $objWriter->endElement(); } - /* - * @link : https://github.com/stefslon/exportToPPTX/blob/master/exportToPPTX.m#L2128 - */ + // @link : https://github.com/stefslon/exportToPPTX/blob/master/exportToPPTX.m#L2128 if ($shape instanceof Media) { // p:nvPr > a:videoFile $objWriter->startElement('a:videoFile'); @@ -1514,9 +1503,7 @@ protected function writeSlideBackground(AbstractSlideAlias $pSlide, XMLWriter $o // > p:bgPr $objWriter->endElement(); } - /* - * @link : http://www.officeopenxml.com/prSlide-background.php - */ + // @link : http://www.officeopenxml.com/prSlide-background.php if ($oBackground instanceof Slide\Background\SchemeColor) { // p:bgRef $objWriter->startElement('p:bgRef'); @@ -1543,7 +1530,7 @@ protected function writeSlideTransition(XMLWriter $objWriter, ?Slide\Transition return; } $objWriter->startElement('p:transition'); - if (!is_null($transition->getSpeed())) { + if (null !== $transition->getSpeed()) { $objWriter->writeAttribute('spd', $transition->getSpeed()); } $objWriter->writeAttribute('advClick', $transition->hasManualTrigger() ? '1' : '0'); @@ -1556,222 +1543,269 @@ protected function writeSlideTransition(XMLWriter $objWriter, ?Slide\Transition $objWriter->startElement('p:blinds'); $objWriter->writeAttribute('dir', 'horz'); $objWriter->endElement(); + break; case Slide\Transition::TRANSITION_BLINDS_VERTICAL: $objWriter->startElement('p:blinds'); $objWriter->writeAttribute('dir', 'vert'); $objWriter->endElement(); + break; case Slide\Transition::TRANSITION_CHECKER_HORIZONTAL: $objWriter->startElement('p:checker'); $objWriter->writeAttribute('dir', 'horz'); $objWriter->endElement(); + break; case Slide\Transition::TRANSITION_CHECKER_VERTICAL: $objWriter->startElement('p:checker'); $objWriter->writeAttribute('dir', 'vert'); $objWriter->endElement(); + break; case Slide\Transition::TRANSITION_CIRCLE: $objWriter->writeElement('p:circle'); + break; case Slide\Transition::TRANSITION_COMB_HORIZONTAL: $objWriter->startElement('p:comb'); $objWriter->writeAttribute('dir', 'horz'); $objWriter->endElement(); + break; case Slide\Transition::TRANSITION_COMB_VERTICAL: $objWriter->startElement('p:comb'); $objWriter->writeAttribute('dir', 'vert'); $objWriter->endElement(); + break; case Slide\Transition::TRANSITION_COVER_DOWN: $objWriter->startElement('p:cover'); $objWriter->writeAttribute('dir', 'd'); $objWriter->endElement(); + break; case Slide\Transition::TRANSITION_COVER_LEFT: $objWriter->startElement('p:cover'); $objWriter->writeAttribute('dir', 'l'); $objWriter->endElement(); + break; case Slide\Transition::TRANSITION_COVER_LEFT_DOWN: $objWriter->startElement('p:cover'); $objWriter->writeAttribute('dir', 'ld'); $objWriter->endElement(); + break; case Slide\Transition::TRANSITION_COVER_LEFT_UP: $objWriter->startElement('p:cover'); $objWriter->writeAttribute('dir', 'lu'); $objWriter->endElement(); + break; case Slide\Transition::TRANSITION_COVER_RIGHT: $objWriter->startElement('p:cover'); $objWriter->writeAttribute('dir', 'r'); $objWriter->endElement(); + break; case Slide\Transition::TRANSITION_COVER_RIGHT_DOWN: $objWriter->startElement('p:cover'); $objWriter->writeAttribute('dir', 'rd'); $objWriter->endElement(); + break; case Slide\Transition::TRANSITION_COVER_RIGHT_UP: $objWriter->startElement('p:cover'); $objWriter->writeAttribute('dir', 'ru'); $objWriter->endElement(); + break; case Slide\Transition::TRANSITION_COVER_UP: $objWriter->startElement('p:cover'); $objWriter->writeAttribute('dir', 'u'); $objWriter->endElement(); + break; case Slide\Transition::TRANSITION_CUT: $objWriter->writeElement('p:cut'); + break; case Slide\Transition::TRANSITION_DIAMOND: $objWriter->writeElement('p:diamond'); + break; case Slide\Transition::TRANSITION_DISSOLVE: $objWriter->writeElement('p:dissolve'); + break; case Slide\Transition::TRANSITION_FADE: $objWriter->writeElement('p:fade'); + break; case Slide\Transition::TRANSITION_NEWSFLASH: $objWriter->writeElement('p:newsflash'); + break; case Slide\Transition::TRANSITION_PLUS: $objWriter->writeElement('p:plus'); + break; case Slide\Transition::TRANSITION_PULL_DOWN: $objWriter->startElement('p:pull'); $objWriter->writeAttribute('dir', 'd'); $objWriter->endElement(); + break; case Slide\Transition::TRANSITION_PULL_LEFT: $objWriter->startElement('p:pull'); $objWriter->writeAttribute('dir', 'l'); $objWriter->endElement(); + break; case Slide\Transition::TRANSITION_PULL_RIGHT: $objWriter->startElement('p:pull'); $objWriter->writeAttribute('dir', 'r'); $objWriter->endElement(); + break; case Slide\Transition::TRANSITION_PULL_UP: $objWriter->startElement('p:pull'); $objWriter->writeAttribute('dir', 'u'); $objWriter->endElement(); + break; case Slide\Transition::TRANSITION_PUSH_DOWN: $objWriter->startElement('p:push'); $objWriter->writeAttribute('dir', 'd'); $objWriter->endElement(); + break; case Slide\Transition::TRANSITION_PUSH_LEFT: $objWriter->startElement('p:push'); $objWriter->writeAttribute('dir', 'l'); $objWriter->endElement(); + break; case Slide\Transition::TRANSITION_PUSH_RIGHT: $objWriter->startElement('p:push'); $objWriter->writeAttribute('dir', 'r'); $objWriter->endElement(); + break; case Slide\Transition::TRANSITION_PUSH_UP: $objWriter->startElement('p:push'); $objWriter->writeAttribute('dir', 'u'); $objWriter->endElement(); + break; case Slide\Transition::TRANSITION_RANDOM: $objWriter->writeElement('p:random'); + break; case Slide\Transition::TRANSITION_RANDOMBAR_HORIZONTAL: $objWriter->startElement('p:randomBar'); $objWriter->writeAttribute('dir', 'horz'); $objWriter->endElement(); + break; case Slide\Transition::TRANSITION_RANDOMBAR_VERTICAL: $objWriter->startElement('p:randomBar'); $objWriter->writeAttribute('dir', 'vert'); $objWriter->endElement(); + break; case Slide\Transition::TRANSITION_SPLIT_IN_HORIZONTAL: $objWriter->startElement('p:split'); $objWriter->writeAttribute('dir', 'in'); $objWriter->writeAttribute('orient', 'horz'); $objWriter->endElement(); + break; case Slide\Transition::TRANSITION_SPLIT_OUT_HORIZONTAL: $objWriter->startElement('p:split'); $objWriter->writeAttribute('dir', 'out'); $objWriter->writeAttribute('orient', 'horz'); $objWriter->endElement(); + break; case Slide\Transition::TRANSITION_SPLIT_IN_VERTICAL: $objWriter->startElement('p:split'); $objWriter->writeAttribute('dir', 'in'); $objWriter->writeAttribute('orient', 'vert'); $objWriter->endElement(); + break; case Slide\Transition::TRANSITION_SPLIT_OUT_VERTICAL: $objWriter->startElement('p:split'); $objWriter->writeAttribute('dir', 'out'); $objWriter->writeAttribute('orient', 'vert'); $objWriter->endElement(); + break; case Slide\Transition::TRANSITION_STRIPS_LEFT_DOWN: $objWriter->startElement('p:strips'); $objWriter->writeAttribute('dir', 'ld'); $objWriter->endElement(); + break; case Slide\Transition::TRANSITION_STRIPS_LEFT_UP: $objWriter->startElement('p:strips'); $objWriter->writeAttribute('dir', 'lu'); $objWriter->endElement(); + break; case Slide\Transition::TRANSITION_STRIPS_RIGHT_DOWN: $objWriter->startElement('p:strips'); $objWriter->writeAttribute('dir', 'rd'); $objWriter->endElement(); + break; case Slide\Transition::TRANSITION_STRIPS_RIGHT_UP: $objWriter->startElement('p:strips'); $objWriter->writeAttribute('dir', 'ru'); $objWriter->endElement(); + break; case Slide\Transition::TRANSITION_WEDGE: $objWriter->writeElement('p:wedge'); + break; case Slide\Transition::TRANSITION_WIPE_DOWN: $objWriter->startElement('p:wipe'); $objWriter->writeAttribute('dir', 'd'); $objWriter->endElement(); + break; case Slide\Transition::TRANSITION_WIPE_LEFT: $objWriter->startElement('p:wipe'); $objWriter->writeAttribute('dir', 'l'); $objWriter->endElement(); + break; case Slide\Transition::TRANSITION_WIPE_RIGHT: $objWriter->startElement('p:wipe'); $objWriter->writeAttribute('dir', 'r'); $objWriter->endElement(); + break; case Slide\Transition::TRANSITION_WIPE_UP: $objWriter->startElement('p:wipe'); $objWriter->writeAttribute('dir', 'u'); $objWriter->endElement(); + break; case Slide\Transition::TRANSITION_ZOOM_IN: $objWriter->startElement('p:zoom'); $objWriter->writeAttribute('dir', 'in'); $objWriter->endElement(); + break; case Slide\Transition::TRANSITION_ZOOM_OUT: $objWriter->startElement('p:zoom'); $objWriter->writeAttribute('dir', 'out'); $objWriter->endElement(); + break; } @@ -1782,10 +1816,10 @@ private function getGUID(): string { if (function_exists('com_create_guid')) { return com_create_guid(); - } else { - mt_srand(intval(microtime(true) * 10000)); - $charid = strtoupper(md5(uniqid((string) rand(), true))); - $hyphen = chr(45); // "-" + } + mt_srand((int) (microtime(true) * 10000)); + $charid = strtoupper(md5(uniqid((string) mt_rand(), true))); + $hyphen = chr(45); // "-" $uuid = chr(123)// "{" . substr($charid, 0, 8) . $hyphen . substr($charid, 8, 4) . $hyphen @@ -1794,7 +1828,6 @@ private function getGUID(): string . substr($charid, 20, 12) . chr(125); // "}" - return $uuid; - } + return $uuid; } } diff --git a/src/PhpPresentation/Writer/PowerPoint2007/CommentAuthors.php b/src/PhpPresentation/Writer/PowerPoint2007/CommentAuthors.php index 35b90e177..a73a88518 100644 --- a/src/PhpPresentation/Writer/PowerPoint2007/CommentAuthors.php +++ b/src/PhpPresentation/Writer/PowerPoint2007/CommentAuthors.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpPresentation/Writer/PowerPoint2007/ContentTypes.php b/src/PhpPresentation/Writer/PowerPoint2007/ContentTypes.php index 6d0a6d7e3..541e8c1d1 100644 --- a/src/PhpPresentation/Writer/PowerPoint2007/ContentTypes.php +++ b/src/PhpPresentation/Writer/PowerPoint2007/ContentTypes.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -93,6 +92,7 @@ public function render(): ZipInterface if ($oShape instanceof Comment) { $this->writeOverrideContentType($objWriter, '/ppt/comments/comment' . ($i + 1) . '.xml', 'application/vnd.openxmlformats-officedocument.presentationml.comments+xml'); $hasComments = true; + break; } } diff --git a/src/PhpPresentation/Writer/PowerPoint2007/DocPropsApp.php b/src/PhpPresentation/Writer/PowerPoint2007/DocPropsApp.php index fe81c5086..882cf3c8c 100644 --- a/src/PhpPresentation/Writer/PowerPoint2007/DocPropsApp.php +++ b/src/PhpPresentation/Writer/PowerPoint2007/DocPropsApp.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpPresentation/Writer/PowerPoint2007/DocPropsCore.php b/src/PhpPresentation/Writer/PowerPoint2007/DocPropsCore.php index f1afb28df..63897ee18 100644 --- a/src/PhpPresentation/Writer/PowerPoint2007/DocPropsCore.php +++ b/src/PhpPresentation/Writer/PowerPoint2007/DocPropsCore.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -50,13 +49,13 @@ public function render(): ZipInterface // dcterms:created $objWriter->startElement('dcterms:created'); $objWriter->writeAttribute('xsi:type', 'dcterms:W3CDTF'); - $objWriter->writeRaw(gmdate("Y-m-d\TH:i:s\Z", $this->oPresentation->getDocumentProperties()->getCreated())); + $objWriter->writeRaw(gmdate('Y-m-d\\TH:i:s\\Z', $this->oPresentation->getDocumentProperties()->getCreated())); $objWriter->endElement(); // dcterms:modified $objWriter->startElement('dcterms:modified'); $objWriter->writeAttribute('xsi:type', 'dcterms:W3CDTF'); - $objWriter->writeRaw(gmdate("Y-m-d\TH:i:s\Z", $this->oPresentation->getDocumentProperties()->getModified())); + $objWriter->writeRaw(gmdate('Y-m-d\\TH:i:s\\Z', $this->oPresentation->getDocumentProperties()->getModified())); $objWriter->endElement(); // dc:title diff --git a/src/PhpPresentation/Writer/PowerPoint2007/DocPropsCustom.php b/src/PhpPresentation/Writer/PowerPoint2007/DocPropsCustom.php index ea651ac40..ccb257fa4 100644 --- a/src/PhpPresentation/Writer/PowerPoint2007/DocPropsCustom.php +++ b/src/PhpPresentation/Writer/PowerPoint2007/DocPropsCustom.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -68,20 +67,25 @@ public function render(): ZipInterface switch ($propertyType) { case DocumentProperties::PROPERTY_TYPE_INTEGER: $objWriter->writeElement('vt:i4', (string) $propertyValue); + break; case DocumentProperties::PROPERTY_TYPE_FLOAT: $objWriter->writeElement('vt:r8', (string) $propertyValue); + break; case DocumentProperties::PROPERTY_TYPE_BOOLEAN: $objWriter->writeElement('vt:bool', $propertyValue ? 'true' : 'false'); + break; case DocumentProperties::PROPERTY_TYPE_DATE: $objWriter->startElement('vt:filetime'); $objWriter->writeRaw(date(DATE_W3C, (int) $propertyValue)); $objWriter->endElement(); + break; default: $objWriter->writeElement('vt:lpwstr', (string) $propertyValue); + break; } $objWriter->endElement(); diff --git a/src/PhpPresentation/Writer/PowerPoint2007/DocPropsThumbnail.php b/src/PhpPresentation/Writer/PowerPoint2007/DocPropsThumbnail.php index 6c54be1ec..358affd6a 100644 --- a/src/PhpPresentation/Writer/PowerPoint2007/DocPropsThumbnail.php +++ b/src/PhpPresentation/Writer/PowerPoint2007/DocPropsThumbnail.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/src/PhpPresentation/Writer/PowerPoint2007/PptCharts.php b/src/PhpPresentation/Writer/PowerPoint2007/PptCharts.php index 4d03776f1..5076aa849 100644 --- a/src/PhpPresentation/Writer/PowerPoint2007/PptCharts.php +++ b/src/PhpPresentation/Writer/PowerPoint2007/PptCharts.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -48,9 +47,6 @@ class PptCharts extends AbstractDecoratorWriter { - /** - * @throws FileRemoveException - */ public function render(): ZipInterface { for ($i = 0; $i < $this->getDrawingHashTable()->count(); ++$i) { @@ -229,8 +225,6 @@ protected function writeChart(Chart $chart): string * Write chart to XML format. * * @return string String output - * - * @throws FileRemoveException */ protected function writeSpreadsheet(PhpPresentation $presentation, Chart $chart, string $tempName): string { @@ -244,7 +238,8 @@ protected function writeSpreadsheet(PhpPresentation $presentation, Chart $chart, } $spreadsheet->getProperties() ->setCreator( - $presentation->getDocumentProperties()->getCreator())->setLastModifiedBy( + $presentation->getDocumentProperties()->getCreator() + )->setLastModifiedBy( $presentation->getDocumentProperties()->getLastModifiedBy() ) ->setTitle($title); @@ -368,7 +363,7 @@ protected function writeMultipleValuesOrReference(XMLWriter $objWriter, bool $is // c:pt $objWriter->startElement('c:pt'); $objWriter->writeAttribute('idx', $i); - $objWriter->writeElement('c:v', strval($values[$i])); + $objWriter->writeElement('c:v', (string) ($values[$i])); $objWriter->endElement(); } } else { @@ -386,7 +381,7 @@ protected function writeMultipleValuesOrReference(XMLWriter $objWriter, bool $is // c:pt $objWriter->startElement('c:pt'); $objWriter->writeAttribute('idx', $i); - $objWriter->writeElement('c:v', strval($values[$i])); + $objWriter->writeElement('c:v', (string) ($values[$i])); $objWriter->endElement(); } @@ -397,7 +392,7 @@ protected function writeMultipleValuesOrReference(XMLWriter $objWriter, bool $is } /** - * Write Title + * Write Title. */ protected function writeTitle(XMLWriter $objWriter, Title $subject): void { @@ -494,8 +489,6 @@ protected function writeTitle(XMLWriter $objWriter, Title $subject): void * Write Plot Area. * * @param XMLWriter $objWriter XML Writer - * - * @throws UndefinedChartTypeException */ protected function writePlotArea(XMLWriter $objWriter, PlotArea $subject, Chart $chart): void { @@ -700,7 +693,6 @@ protected function writeLayout(XMLWriter $objWriter, $subject): void * * @param XMLWriter $objWriter XML Writer * @param Chart\Type\Area $subject - * @param bool $includeSheet */ protected function writeTypeArea(XMLWriter $objWriter, Area $subject, bool $includeSheet = false): void { @@ -802,7 +794,6 @@ protected function writeTypeArea(XMLWriter $objWriter, Area $subject, bool $incl * * @param XMLWriter $objWriter XML Writer * @param Chart\Type\Bar $subject - * @param bool $includeSheet */ protected function writeTypeBar(XMLWriter $objWriter, Bar $subject, bool $includeSheet = false): void { @@ -1014,7 +1005,6 @@ protected function writeTypeBar(XMLWriter $objWriter, Bar $subject, bool $includ * * @param XMLWriter $objWriter XML Writer * @param Chart\Type\Bar3D $subject - * @param bool $includeSheet */ protected function writeTypeBar3D(XMLWriter $objWriter, Bar3D $subject, bool $includeSheet = false): void { @@ -1206,8 +1196,6 @@ protected function writeTypeBar3D(XMLWriter $objWriter, Bar3D $subject, bool $in * Write Type Pie. * * @param XMLWriter $objWriter XML Writer - * @param Doughnut $subject - * @param bool $includeSheet */ protected function writeTypeDoughnut(XMLWriter $objWriter, Doughnut $subject, bool $includeSheet = false): void { @@ -1365,8 +1353,6 @@ protected function writeTypeDoughnut(XMLWriter $objWriter, Doughnut $subject, bo * Write Type Pie. * * @param XMLWriter $objWriter XML Writer - * @param Pie $subject - * @param bool $includeSheet */ protected function writeTypePie(XMLWriter $objWriter, Pie $subject, bool $includeSheet = false): void { @@ -1530,8 +1516,6 @@ protected function writeTypePie(XMLWriter $objWriter, Pie $subject, bool $includ * Write Type Pie3D. * * @param XMLWriter $objWriter XML Writer - * @param Pie3D $subject - * @param bool $includeSheet */ protected function writeTypePie3D(XMLWriter $objWriter, Pie3D $subject, bool $includeSheet = false): void { @@ -1689,8 +1673,6 @@ protected function writeTypePie3D(XMLWriter $objWriter, Pie3D $subject, bool $in * Write Type Line. * * @param XMLWriter $objWriter XML Writer - * @param Line $subject - * @param bool $includeSheet */ protected function writeTypeLine(XMLWriter $objWriter, Line $subject, bool $includeSheet = false): void { @@ -1855,11 +1837,9 @@ protected function writeTypeLine(XMLWriter $objWriter, Line $subject, bool $incl } /** - * Write Type Radar + * Write Type Radar. * * @param XMLWriter $objWriter XML Writer - * @param Radar $subject - * @param bool $includeSheet */ protected function writeTypeRadar(XMLWriter $objWriter, Radar $subject, bool $includeSheet = false): void { @@ -2026,11 +2006,7 @@ protected function writeTypeRadar(XMLWriter $objWriter, Radar $subject, bool $in } /** - * Write Type Scatter - * - * @param XMLWriter $objWriter - * @param Scatter $subject - * @param bool $includeSheet + * Write Type Scatter. */ protected function writeTypeScatter(XMLWriter $objWriter, Scatter $subject, bool $includeSheet = false): void { @@ -2206,8 +2182,6 @@ protected function writeTypeScatter(XMLWriter $objWriter, Scatter $subject, bool /** * Write chart relationships to XML format. * - * @param Chart $pChart - * * @return string XML Output */ protected function writeChartRelationships(Chart $pChart): string @@ -2233,10 +2207,6 @@ protected function writeChartRelationships(Chart $pChart): string return $objWriter->getData(); } - /** - * @param XMLWriter $objWriter - * @param Chart\Marker $marker - */ protected function writeSeriesMarker(XMLWriter $objWriter, Chart\Marker $marker): void { // c:marker @@ -2276,12 +2246,6 @@ protected function writeSeriesMarker(XMLWriter $objWriter, Chart\Marker $marker) $objWriter->endElement(); } - /** - * @param XMLWriter $objWriter - * @param Chart\Axis $oAxis - * @param string $typeAxis - * @param Chart\Type\AbstractType $typeChart - */ protected function writeAxis(XMLWriter $objWriter, Chart\Axis $oAxis, string $typeAxis, Chart\Type\AbstractType $typeChart): void { if (Chart\Axis::AXIS_X != $typeAxis && Chart\Axis::AXIS_Y != $typeAxis) { @@ -2539,10 +2503,6 @@ protected function writeAxis(XMLWriter $objWriter, Chart\Axis $oAxis, string $ty $objWriter->endElement(); } - /** - * @param XMLWriter $objWriter - * @param Gridlines $oGridlines - */ protected function writeAxisGridlines(XMLWriter $objWriter, Gridlines $oGridlines): void { // c:spPr diff --git a/src/PhpPresentation/Writer/PowerPoint2007/PptComments.php b/src/PhpPresentation/Writer/PowerPoint2007/PptComments.php index 5a30c08a4..e585cd247 100644 --- a/src/PhpPresentation/Writer/PowerPoint2007/PptComments.php +++ b/src/PhpPresentation/Writer/PowerPoint2007/PptComments.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -28,9 +27,6 @@ class PptComments extends AbstractDecoratorWriter { - /** - * @return ZipInterface - */ public function render(): ZipInterface { foreach ($this->getPresentation()->getAllSlides() as $numSlide => $oSlide) { @@ -44,9 +40,6 @@ public function render(): ZipInterface return $this->getZip(); } - /** - * @return string - */ protected function writeSlideComments(Slide $oSlide): string { /** diff --git a/src/PhpPresentation/Writer/PowerPoint2007/PptMedia.php b/src/PhpPresentation/Writer/PowerPoint2007/PptMedia.php index 85a7acecc..13caebfed 100644 --- a/src/PhpPresentation/Writer/PowerPoint2007/PptMedia.php +++ b/src/PhpPresentation/Writer/PowerPoint2007/PptMedia.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -25,9 +24,6 @@ class PptMedia extends AbstractDecoratorWriter { - /** - * @return ZipInterface - */ public function render(): ZipInterface { for ($i = 0; $i < $this->getDrawingHashTable()->count(); ++$i) { diff --git a/src/PhpPresentation/Writer/PowerPoint2007/PptPresProps.php b/src/PhpPresentation/Writer/PowerPoint2007/PptPresProps.php index c28f12d22..05f0103d2 100644 --- a/src/PhpPresentation/Writer/PowerPoint2007/PptPresProps.php +++ b/src/PhpPresentation/Writer/PowerPoint2007/PptPresProps.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -25,9 +24,6 @@ class PptPresProps extends AbstractDecoratorWriter { - /** - * @return ZipInterface - */ public function render(): ZipInterface { $presentationPpts = $this->oPresentation->getPresentationProperties(); diff --git a/src/PhpPresentation/Writer/PowerPoint2007/PptPresentation.php b/src/PhpPresentation/Writer/PowerPoint2007/PptPresentation.php index a6aa3c133..6f93dd466 100644 --- a/src/PhpPresentation/Writer/PowerPoint2007/PptPresentation.php +++ b/src/PhpPresentation/Writer/PowerPoint2007/PptPresentation.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -26,9 +25,6 @@ class PptPresentation extends AbstractDecoratorWriter { - /** - * @return ZipInterface - */ public function render(): ZipInterface { // Create XML writer diff --git a/src/PhpPresentation/Writer/PowerPoint2007/PptSlideLayouts.php b/src/PhpPresentation/Writer/PowerPoint2007/PptSlideLayouts.php index b482579d7..58a718a04 100644 --- a/src/PhpPresentation/Writer/PowerPoint2007/PptSlideLayouts.php +++ b/src/PhpPresentation/Writer/PowerPoint2007/PptSlideLayouts.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -30,9 +29,6 @@ class PptSlideLayouts extends AbstractSlide { - /** - * @return ZipInterface - */ public function render(): ZipInterface { foreach ($this->oPresentation->getAllMasterSlides() as $oSlideMaster) { @@ -181,7 +177,7 @@ protected function writeSlideLayout(SlideLayout $pSlideLayout): string // p:sldLayout\p:clrMapOvr\ $objWriter->endElement(); - if (!is_null($pSlideLayout->getTransition())) { + if (null !== $pSlideLayout->getTransition()) { $this->writeSlideTransition($objWriter, $pSlideLayout->getTransition()); } diff --git a/src/PhpPresentation/Writer/PowerPoint2007/PptSlideMasters.php b/src/PhpPresentation/Writer/PowerPoint2007/PptSlideMasters.php index a7758a898..9a266ad01 100644 --- a/src/PhpPresentation/Writer/PowerPoint2007/PptSlideMasters.php +++ b/src/PhpPresentation/Writer/PowerPoint2007/PptSlideMasters.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -30,9 +29,6 @@ class PptSlideMasters extends AbstractSlide { - /** - * @return ZipInterface - */ public function render(): ZipInterface { foreach ($this->oPresentation->getAllMasterSlides() as $oMasterSlide) { @@ -178,7 +174,7 @@ protected function writeSlideMaster(SlideMaster $pSlide): string // p:sldMaster\p:sldLayoutIdLst $objWriter->startElement('p:sldLayoutIdLst'); foreach ($pSlide->getAllSlideLayouts() as $layout) { - /* @var $layout Slide\SlideLayout */ + // @var $layout Slide\SlideLayout $objWriter->startElement('p:sldLayoutId'); $objWriter->writeAttribute('id', $layout->layoutId); $objWriter->writeAttribute('r:id', $layout->relationId); @@ -237,7 +233,7 @@ protected function writeSlideMaster(SlideMaster $pSlide): string $objWriter->endElement(); // p:sldMaster\p:txStyles\ - if (!is_null($pSlide->getTransition())) { + if (null !== $pSlide->getTransition()) { $this->writeSlideTransition($objWriter, $pSlide->getTransition()); } diff --git a/src/PhpPresentation/Writer/PowerPoint2007/PptSlides.php b/src/PhpPresentation/Writer/PowerPoint2007/PptSlides.php index 8c2999d04..7e29fc0da 100644 --- a/src/PhpPresentation/Writer/PowerPoint2007/PptSlides.php +++ b/src/PhpPresentation/Writer/PowerPoint2007/PptSlides.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -40,8 +39,6 @@ class PptSlides extends AbstractSlide { /** * Add slides (drawings, ...) and slide relationships (drawings, ...). - * - * @return ZipInterface */ public function render(): ZipInterface { @@ -331,12 +328,14 @@ protected function writeSlideRelationships(Slide $pSlide): string while ($iterator->valid()) { if ($iterator->current() instanceof Comment) { $hasSlideComment = true; + break; } elseif ($iterator->current() instanceof Group) { $iterator2 = $iterator->current()->getShapeCollection()->getIterator(); while ($iterator2->valid()) { if ($iterator2->current() instanceof Comment) { $hasSlideComment = true; + break 2; } $iterator2->next(); diff --git a/src/PhpPresentation/Writer/PowerPoint2007/PptTableProps.php b/src/PhpPresentation/Writer/PowerPoint2007/PptTableProps.php index ff2c5f851..f92f6ddb3 100644 --- a/src/PhpPresentation/Writer/PowerPoint2007/PptTableProps.php +++ b/src/PhpPresentation/Writer/PowerPoint2007/PptTableProps.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -25,9 +24,6 @@ class PptTableProps extends AbstractDecoratorWriter { - /** - * @return ZipInterface - */ public function render(): ZipInterface { // Create XML writer diff --git a/src/PhpPresentation/Writer/PowerPoint2007/PptTheme.php b/src/PhpPresentation/Writer/PowerPoint2007/PptTheme.php index c2c9e8e9b..9b53b7c1c 100644 --- a/src/PhpPresentation/Writer/PowerPoint2007/PptTheme.php +++ b/src/PhpPresentation/Writer/PowerPoint2007/PptTheme.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -26,9 +25,6 @@ class PptTheme extends AbstractDecoratorWriter { - /** - * @return ZipInterface - */ public function render(): ZipInterface { foreach ($this->oPresentation->getAllMasterSlides() as $oMasterSlide) { @@ -80,7 +76,7 @@ protected function writeTheme(Slide\SlideMaster $oMasterSlide): string // Create XML writer $objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY); - $name = 'Theme' . rand(1, 100); + $name = 'Theme' . mt_rand(1, 100); // XML header $objWriter->startDocument('1.0', 'UTF-8', 'yes'); diff --git a/src/PhpPresentation/Writer/PowerPoint2007/PptViewProps.php b/src/PhpPresentation/Writer/PowerPoint2007/PptViewProps.php index 2a8947384..17891a69a 100644 --- a/src/PhpPresentation/Writer/PowerPoint2007/PptViewProps.php +++ b/src/PhpPresentation/Writer/PowerPoint2007/PptViewProps.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -25,9 +24,6 @@ class PptViewProps extends AbstractDecoratorWriter { - /** - * @return ZipInterface - */ public function render(): ZipInterface { // Create XML writer diff --git a/src/PhpPresentation/Writer/PowerPoint2007/Relationships.php b/src/PhpPresentation/Writer/PowerPoint2007/Relationships.php index 9069ed485..58eb325dd 100644 --- a/src/PhpPresentation/Writer/PowerPoint2007/Relationships.php +++ b/src/PhpPresentation/Writer/PowerPoint2007/Relationships.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -29,8 +28,6 @@ class Relationships extends AbstractDecoratorWriter { /** * Add relationships to ZIP file. - * - * @return ZipInterface */ public function render(): ZipInterface { @@ -134,6 +131,7 @@ protected function writePresentationRelationships(): string continue; } $this->writeRelationship($objWriter, $relationId++, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/commentAuthors', 'commentAuthors.xml'); + break 2; } } diff --git a/src/PhpPresentation/Writer/Serialized.php b/src/PhpPresentation/Writer/Serialized.php index 5482c1e2e..ea556a846 100644 --- a/src/PhpPresentation/Writer/Serialized.php +++ b/src/PhpPresentation/Writer/Serialized.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -38,7 +37,7 @@ class Serialized extends AbstractWriter implements WriterInterface * * @param \PhpOffice\PhpPresentation\PhpPresentation $pPhpPresentation */ - public function __construct(PhpPresentation $pPhpPresentation = null) + public function __construct(?PhpPresentation $pPhpPresentation = null) { // Set PhpPresentation $this->setPhpPresentation($pPhpPresentation ?? new PhpPresentation()); @@ -49,9 +48,6 @@ public function __construct(PhpPresentation $pPhpPresentation = null) /** * Save PhpPresentation to file. - * - * @throws DirectoryNotFoundException - * @throws InvalidParameterException */ public function save(string $pFilename): void { @@ -93,12 +89,11 @@ public function save(string $pFilename): void /** * Serialize PhpPresentation object to XML. * - * @param PhpPresentation|null $pPhpPresentation * @param string $pFilename * * @return string XML Output */ - protected function writeSerialized(PhpPresentation $pPhpPresentation = null, $pFilename = '') + protected function writeSerialized(?PhpPresentation $pPhpPresentation = null, $pFilename = '') { // Clone $pPhpPresentation $pPhpPresentation = clone $pPhpPresentation; diff --git a/src/PhpPresentation/Writer/WriterInterface.php b/src/PhpPresentation/Writer/WriterInterface.php index ab64192e1..7c04b7adb 100644 --- a/src/PhpPresentation/Writer/WriterInterface.php +++ b/src/PhpPresentation/Writer/WriterInterface.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -26,7 +25,7 @@ interface WriterInterface { /** - * Save PhpPresentation to file + * Save PhpPresentation to file. */ public function save(string $pFilename): void; } diff --git a/tests/PhpPresentation/Tests/AbstractShapeTest.php b/tests/PhpPresentation/Tests/AbstractShapeTest.php index 8cb097b2d..d254cc5eb 100644 --- a/tests/PhpPresentation/Tests/AbstractShapeTest.php +++ b/tests/PhpPresentation/Tests/AbstractShapeTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -43,25 +42,25 @@ public function testConstruct(): void { $object = new RichText(); - $this->assertEquals(0, $object->getOffsetX()); - $this->assertEquals(0, $object->getOffsetY()); - $this->assertEquals(0, $object->getHeight()); - $this->assertEquals(0, $object->getRotation()); - $this->assertEquals(0, $object->getWidth()); - $this->assertInstanceOf(Border::class, $object->getBorder()); - $this->assertEquals(Border::LINE_NONE, $object->getBorder()->getLineStyle()); - $this->assertInstanceOf(Fill::class, $object->getFill()); - $this->assertInstanceOf(Shadow::class, $object->getShadow()); + self::assertEquals(0, $object->getOffsetX()); + self::assertEquals(0, $object->getOffsetY()); + self::assertEquals(0, $object->getHeight()); + self::assertEquals(0, $object->getRotation()); + self::assertEquals(0, $object->getWidth()); + self::assertInstanceOf(Border::class, $object->getBorder()); + self::assertEquals(Border::LINE_NONE, $object->getBorder()->getLineStyle()); + self::assertInstanceOf(Fill::class, $object->getFill()); + self::assertInstanceOf(Shadow::class, $object->getShadow()); } public function testFill(): void { $object = new RichText(); - $this->assertInstanceOf(AbstractShape::class, $object->setFill()); - $this->assertNull($object->getFill()); - $this->assertInstanceOf(AbstractShape::class, $object->setFill(new Fill())); - $this->assertInstanceOf(Fill::class, $object->getFill()); + self::assertInstanceOf(AbstractShape::class, $object->setFill()); + self::assertNull($object->getFill()); + self::assertInstanceOf(AbstractShape::class, $object->setFill(new Fill())); + self::assertInstanceOf(Fill::class, $object->getFill()); } public function testHeight(): void @@ -69,24 +68,24 @@ public function testHeight(): void $object = new RichText(); $value = mt_rand(1, 100); - $this->assertInstanceOf(AbstractShape::class, $object->setHeight()); - $this->assertEquals(0, $object->getHeight()); - $this->assertInstanceOf(AbstractShape::class, $object->setHeight($value)); - $this->assertEquals($value, $object->getHeight()); + self::assertInstanceOf(AbstractShape::class, $object->setHeight()); + self::assertEquals(0, $object->getHeight()); + self::assertInstanceOf(AbstractShape::class, $object->setHeight($value)); + self::assertEquals($value, $object->getHeight()); } public function testHyperlink(): void { $object = new RichText(); - $this->assertInstanceOf(AbstractShape::class, $object->setHyperlink()); - $this->assertFalse($object->hasHyperlink()); - $this->assertInstanceOf(Hyperlink::class, $object->getHyperlink()); - $this->assertTrue($object->hasHyperlink()); - $this->assertInstanceOf(AbstractShape::class, $object->setHyperlink(new Hyperlink('http://www.google.fr'))); - $this->assertTrue($object->hasHyperlink()); - $this->assertInstanceOf(Hyperlink::class, $object->getHyperlink()); - $this->assertTrue($object->hasHyperlink()); + self::assertInstanceOf(AbstractShape::class, $object->setHyperlink()); + self::assertFalse($object->hasHyperlink()); + self::assertInstanceOf(Hyperlink::class, $object->getHyperlink()); + self::assertTrue($object->hasHyperlink()); + self::assertInstanceOf(AbstractShape::class, $object->setHyperlink(new Hyperlink('http://www.google.fr'))); + self::assertTrue($object->hasHyperlink()); + self::assertInstanceOf(Hyperlink::class, $object->getHyperlink()); + self::assertTrue($object->hasHyperlink()); } public function testOffsetX(): void @@ -94,10 +93,10 @@ public function testOffsetX(): void $object = new RichText(); $value = mt_rand(1, 100); - $this->assertInstanceOf(AbstractShape::class, $object->setOffsetX()); - $this->assertEquals(0, $object->getOffsetX()); - $this->assertInstanceOf(AbstractShape::class, $object->setOffsetX($value)); - $this->assertEquals($value, $object->getOffsetX()); + self::assertInstanceOf(AbstractShape::class, $object->setOffsetX()); + self::assertEquals(0, $object->getOffsetX()); + self::assertInstanceOf(AbstractShape::class, $object->setOffsetX($value)); + self::assertEquals($value, $object->getOffsetX()); } public function testOffsetY(): void @@ -105,10 +104,10 @@ public function testOffsetY(): void $object = new RichText(); $value = mt_rand(1, 100); - $this->assertInstanceOf(AbstractShape::class, $object->setOffsetY()); - $this->assertEquals(0, $object->getOffsetY()); - $this->assertInstanceOf(AbstractShape::class, $object->setOffsetY($value)); - $this->assertEquals($value, $object->getOffsetY()); + self::assertInstanceOf(AbstractShape::class, $object->setOffsetY()); + self::assertEquals(0, $object->getOffsetY()); + self::assertInstanceOf(AbstractShape::class, $object->setOffsetY($value)); + self::assertEquals($value, $object->getOffsetY()); } public function testRotation(): void @@ -116,20 +115,20 @@ public function testRotation(): void $object = new RichText(); $value = mt_rand(1, 100); - $this->assertInstanceOf(AbstractShape::class, $object->setRotation()); - $this->assertEquals(0, $object->getRotation()); - $this->assertInstanceOf(AbstractShape::class, $object->setRotation($value)); - $this->assertEquals($value, $object->getRotation()); + self::assertInstanceOf(AbstractShape::class, $object->setRotation()); + self::assertEquals(0, $object->getRotation()); + self::assertInstanceOf(AbstractShape::class, $object->setRotation($value)); + self::assertEquals($value, $object->getRotation()); } public function testShadow(): void { $object = new RichText(); - $this->assertInstanceOf(AbstractShape::class, $object->setShadow()); - $this->assertNull($object->getShadow()); - $this->assertInstanceOf(AbstractShape::class, $object->setShadow(new Shadow())); - $this->assertInstanceOf(Shadow::class, $object->getShadow()); + self::assertInstanceOf(AbstractShape::class, $object->setShadow()); + self::assertNull($object->getShadow()); + self::assertInstanceOf(AbstractShape::class, $object->setShadow(new Shadow())); + self::assertInstanceOf(Shadow::class, $object->getShadow()); } public function testWidth(): void @@ -137,10 +136,10 @@ public function testWidth(): void $object = new RichText(); $value = mt_rand(1, 100); - $this->assertInstanceOf(AbstractShape::class, $object->setWidth()); - $this->assertEquals(0, $object->getWidth()); - $this->assertInstanceOf(AbstractShape::class, $object->setWidth($value)); - $this->assertEquals($value, $object->getWidth()); + self::assertInstanceOf(AbstractShape::class, $object->setWidth()); + self::assertEquals(0, $object->getWidth()); + self::assertInstanceOf(AbstractShape::class, $object->setWidth($value)); + self::assertEquals($value, $object->getWidth()); } public function testWidthAndHeight(): void @@ -148,38 +147,38 @@ public function testWidthAndHeight(): void $object = new RichText(); $value = mt_rand(1, 100); - $this->assertInstanceOf(AbstractShape::class, $object->setWidthAndHeight()); - $this->assertEquals(0, $object->getWidth()); - $this->assertEquals(0, $object->getHeight()); - $this->assertInstanceOf(AbstractShape::class, $object->setWidthAndHeight($value)); - $this->assertEquals($value, $object->getWidth()); - $this->assertEquals(0, $object->getHeight()); - $this->assertInstanceOf(AbstractShape::class, $object->setWidthAndHeight($value, $value)); - $this->assertEquals($value, $object->getWidth()); - $this->assertEquals($value, $object->getHeight()); + self::assertInstanceOf(AbstractShape::class, $object->setWidthAndHeight()); + self::assertEquals(0, $object->getWidth()); + self::assertEquals(0, $object->getHeight()); + self::assertInstanceOf(AbstractShape::class, $object->setWidthAndHeight($value)); + self::assertEquals($value, $object->getWidth()); + self::assertEquals(0, $object->getHeight()); + self::assertInstanceOf(AbstractShape::class, $object->setWidthAndHeight($value, $value)); + self::assertEquals($value, $object->getWidth()); + self::assertEquals($value, $object->getHeight()); } public function testPlaceholder(): void { $object = new RichText(); - $this->assertFalse($object->isPlaceholder(), 'Standard Shape should not be a placeholder object'); - $this->assertNull($object->getPlaceholder()); - $this->assertInstanceOf( + self::assertFalse($object->isPlaceholder(), 'Standard Shape should not be a placeholder object'); + self::assertNull($object->getPlaceholder()); + self::assertInstanceOf( AbstractShape::class, $object->setPlaceHolder(new Placeholder(Placeholder::PH_TYPE_TITLE)) ); - $this->assertTrue($object->isPlaceholder()); - $this->assertInstanceOf(Placeholder::class, $object->getPlaceholder()); - $this->assertEquals('title', $object->getPlaceholder()->getType()); + self::assertTrue($object->isPlaceholder()); + self::assertInstanceOf(Placeholder::class, $object->getPlaceholder()); + self::assertEquals('title', $object->getPlaceholder()->getType()); $object = new RichText(); - $this->assertFalse($object->isPlaceholder(), 'Standard Shape should not be a placeholder object'); + self::assertFalse($object->isPlaceholder(), 'Standard Shape should not be a placeholder object'); $placeholder = new Placeholder(Placeholder::PH_TYPE_TITLE); $placeholder->setType(Placeholder::PH_TYPE_SUBTITLE); - $this->assertInstanceOf(AbstractShape::class, $object->setPlaceHolder($placeholder)); - $this->assertTrue($object->isPlaceholder()); - $this->assertInstanceOf(Placeholder::class, $object->getPlaceholder()); - $this->assertEquals('subTitle', $object->getPlaceholder()->getType()); + self::assertInstanceOf(AbstractShape::class, $object->setPlaceHolder($placeholder)); + self::assertTrue($object->isPlaceholder()); + self::assertInstanceOf(Placeholder::class, $object->getPlaceholder()); + self::assertEquals('subTitle', $object->getPlaceholder()->getType()); } public function testContainer(): void @@ -190,11 +189,11 @@ public function testContainer(): void $oSlide = new Slide(); $oSlide->addShape($object2); - $this->assertNull($object->getContainer()); - $this->assertInstanceOf(AbstractShape::class, $object->setContainer($oSlide)); - $this->assertInstanceOf(Slide::class, $object->getContainer()); - $this->assertInstanceOf(AbstractShape::class, $object->setContainer(null, true)); - $this->assertNull($object->getContainer()); + self::assertNull($object->getContainer()); + self::assertInstanceOf(AbstractShape::class, $object->setContainer($oSlide)); + self::assertInstanceOf(Slide::class, $object->getContainer()); + self::assertInstanceOf(AbstractShape::class, $object->setContainer(null, true)); + self::assertNull($object->getContainer()); } public function testContainerException(): void @@ -202,9 +201,9 @@ public function testContainerException(): void $object = new RichText(); $oSlide = new Slide(); - $this->assertNull($object->getContainer()); - $this->assertInstanceOf(AbstractShape::class, $object->setContainer($oSlide)); - $this->assertInstanceOf(Slide::class, $object->getContainer()); + self::assertNull($object->getContainer()); + self::assertInstanceOf(AbstractShape::class, $object->setContainer($oSlide)); + self::assertInstanceOf(Slide::class, $object->getContainer()); $this->expectException(ShapeContainerAlreadyAssignedException::class); $this->expectExceptionMessage('The shape PhpOffice\PhpPresentation\AbstractShape has already a container assigned'); $object->setContainer(null); diff --git a/tests/PhpPresentation/Tests/AutoloaderTest.php b/tests/PhpPresentation/Tests/AutoloaderTest.php index c1b32c0c4..a93e5f4a0 100644 --- a/tests/PhpPresentation/Tests/AutoloaderTest.php +++ b/tests/PhpPresentation/Tests/AutoloaderTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -34,7 +33,7 @@ class AutoloaderTest extends TestCase public function testRegister(): void { Autoloader::register(); - $this->assertContains( + self::assertContains( ['PhpOffice\\PhpPresentation\\Autoloader', 'autoload'], spl_autoload_functions() ); @@ -48,7 +47,7 @@ public function testAutoload(): void $declared = get_declared_classes(); $declaredCount = count($declared); Autoloader::autoload('Foo'); - $this->assertEquals( + self::assertEquals( $declaredCount, count(get_declared_classes()), 'PhpOffice\\PhpPresentation\\Autoloader::autoload() is trying to load ' . diff --git a/tests/PhpPresentation/Tests/DocumentLayoutTest.php b/tests/PhpPresentation/Tests/DocumentLayoutTest.php index 1d1c1c488..58351938d 100644 --- a/tests/PhpPresentation/Tests/DocumentLayoutTest.php +++ b/tests/PhpPresentation/Tests/DocumentLayoutTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -37,9 +36,9 @@ public function testConstruct(): void { $object = new DocumentLayout(); - $this->assertEquals('screen4x3', $object->getDocumentLayout()); - $this->assertEquals(9144000, $object->getCX()); - $this->assertEquals(6858000, $object->getCY()); + self::assertEquals('screen4x3', $object->getDocumentLayout()); + self::assertEquals(9144000, $object->getCX()); + self::assertEquals(6858000, $object->getCY()); } /** @@ -49,52 +48,52 @@ public function testSetCustomLayout(): void { $object = new DocumentLayout(); $object->setDocumentLayout(['cx' => 6858000, 'cy' => 9144000], false); - $this->assertEquals(DocumentLayout::LAYOUT_CUSTOM, $object->getDocumentLayout()); - $this->assertEquals(9144000, $object->getCX()); - $this->assertEquals(6858000, $object->getCY()); + self::assertEquals(DocumentLayout::LAYOUT_CUSTOM, $object->getDocumentLayout()); + self::assertEquals(9144000, $object->getCX()); + self::assertEquals(6858000, $object->getCY()); $object->setDocumentLayout(['cx' => 6858000, 'cy' => 9144000], true); - $this->assertEquals(DocumentLayout::LAYOUT_CUSTOM, $object->getDocumentLayout()); - $this->assertEquals(6858000, $object->getCX()); - $this->assertEquals(9144000, $object->getCY()); + self::assertEquals(DocumentLayout::LAYOUT_CUSTOM, $object->getDocumentLayout()); + self::assertEquals(6858000, $object->getCX()); + self::assertEquals(9144000, $object->getCY()); } public function testCX(): void { $value = mt_rand(1, 100000); $object = new DocumentLayout(); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentLayout', $object->setCX($value)); - $this->assertEquals($value, $object->getCX()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentLayout', $object->setCX($value, DocumentLayout::UNIT_CENTIMETER)); - $this->assertEquals($value, $object->getCX(DocumentLayout::UNIT_CENTIMETER)); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentLayout', $object->setCX($value, DocumentLayout::UNIT_EMU)); - $this->assertEquals($value, $object->getCX(DocumentLayout::UNIT_EMU)); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentLayout', $object->setCX($value, DocumentLayout::UNIT_INCH)); - $this->assertEquals($value, $object->getCX(DocumentLayout::UNIT_INCH)); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentLayout', $object->setCX($value, DocumentLayout::UNIT_MILLIMETER)); - $this->assertEquals($value, $object->getCX(DocumentLayout::UNIT_MILLIMETER)); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentLayout', $object->setCX($value, DocumentLayout::UNIT_POINT)); - $this->assertEquals($value, $object->getCX(DocumentLayout::UNIT_POINT)); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentLayout', $object->setCX($value, DocumentLayout::UNIT_PIXEL)); - $this->assertEquals($value, $object->getCX(DocumentLayout::UNIT_PIXEL)); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentLayout', $object->setCX($value)); + self::assertEquals($value, $object->getCX()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentLayout', $object->setCX($value, DocumentLayout::UNIT_CENTIMETER)); + self::assertEquals($value, $object->getCX(DocumentLayout::UNIT_CENTIMETER)); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentLayout', $object->setCX($value, DocumentLayout::UNIT_EMU)); + self::assertEquals($value, $object->getCX(DocumentLayout::UNIT_EMU)); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentLayout', $object->setCX($value, DocumentLayout::UNIT_INCH)); + self::assertEquals($value, $object->getCX(DocumentLayout::UNIT_INCH)); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentLayout', $object->setCX($value, DocumentLayout::UNIT_MILLIMETER)); + self::assertEquals($value, $object->getCX(DocumentLayout::UNIT_MILLIMETER)); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentLayout', $object->setCX($value, DocumentLayout::UNIT_POINT)); + self::assertEquals($value, $object->getCX(DocumentLayout::UNIT_POINT)); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentLayout', $object->setCX($value, DocumentLayout::UNIT_PIXEL)); + self::assertEquals($value, $object->getCX(DocumentLayout::UNIT_PIXEL)); } public function testCY(): void { $value = mt_rand(1, 100000); $object = new DocumentLayout(); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentLayout', $object->setCY($value)); - $this->assertEquals($value, $object->getCY()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentLayout', $object->setCY($value, DocumentLayout::UNIT_CENTIMETER)); - $this->assertEquals($value, $object->getCY(DocumentLayout::UNIT_CENTIMETER)); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentLayout', $object->setCY($value, DocumentLayout::UNIT_EMU)); - $this->assertEquals($value, $object->getCY(DocumentLayout::UNIT_EMU)); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentLayout', $object->setCY($value, DocumentLayout::UNIT_INCH)); - $this->assertEquals($value, $object->getCY(DocumentLayout::UNIT_INCH)); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentLayout', $object->setCY($value, DocumentLayout::UNIT_MILLIMETER)); - $this->assertEquals($value, $object->getCY(DocumentLayout::UNIT_MILLIMETER)); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentLayout', $object->setCY($value, DocumentLayout::UNIT_POINT)); - $this->assertEquals($value, $object->getCY(DocumentLayout::UNIT_POINT)); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentLayout', $object->setCY($value, DocumentLayout::UNIT_PIXEL)); - $this->assertEquals($value, $object->getCY(DocumentLayout::UNIT_PIXEL)); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentLayout', $object->setCY($value)); + self::assertEquals($value, $object->getCY()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentLayout', $object->setCY($value, DocumentLayout::UNIT_CENTIMETER)); + self::assertEquals($value, $object->getCY(DocumentLayout::UNIT_CENTIMETER)); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentLayout', $object->setCY($value, DocumentLayout::UNIT_EMU)); + self::assertEquals($value, $object->getCY(DocumentLayout::UNIT_EMU)); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentLayout', $object->setCY($value, DocumentLayout::UNIT_INCH)); + self::assertEquals($value, $object->getCY(DocumentLayout::UNIT_INCH)); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentLayout', $object->setCY($value, DocumentLayout::UNIT_MILLIMETER)); + self::assertEquals($value, $object->getCY(DocumentLayout::UNIT_MILLIMETER)); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentLayout', $object->setCY($value, DocumentLayout::UNIT_POINT)); + self::assertEquals($value, $object->getCY(DocumentLayout::UNIT_POINT)); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentLayout', $object->setCY($value, DocumentLayout::UNIT_PIXEL)); + self::assertEquals($value, $object->getCY(DocumentLayout::UNIT_PIXEL)); } } diff --git a/tests/PhpPresentation/Tests/DocumentPropertiesTest.php b/tests/PhpPresentation/Tests/DocumentPropertiesTest.php index 3e520d045..5d0b37259 100644 --- a/tests/PhpPresentation/Tests/DocumentPropertiesTest.php +++ b/tests/PhpPresentation/Tests/DocumentPropertiesTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -53,7 +52,7 @@ public function testGetSet(): void $get = "get{$key}"; $set = "set{$key}"; $object->$set($val); - $this->assertEquals($val, $object->$get()); + self::assertEquals($val, $object->$get()); } } @@ -73,7 +72,7 @@ public function testGetSetNull(): void $get = "get{$key}"; $set = "set{$key}"; $object->$set(); - $this->assertEquals($time, $object->$get()); + self::assertEquals($time, $object->$get()); } } @@ -82,52 +81,52 @@ public function testCustomProperties(): void $valueTime = time(); $object = new DocumentProperties(); - $this->assertIsArray($object->getCustomProperties()); - $this->assertCount(0, $object->getCustomProperties()); - $this->assertFalse($object->isCustomPropertySet('pName')); - $this->assertNull($object->getCustomPropertyType('pName')); - $this->assertNull($object->getCustomPropertyValue('pName')); - - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentProperties', $object->setCustomProperty('pName', 'pValue', null)); - $this->assertCount(1, $object->getCustomProperties()); - $this->assertTrue($object->isCustomPropertySet('pName')); - $this->assertEquals(DocumentProperties::PROPERTY_TYPE_STRING, $object->getCustomPropertyType('pName')); - $this->assertEquals('pValue', $object->getCustomPropertyValue('pName')); - - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentProperties', $object->setCustomProperty('pName', 2, null)); - $this->assertCount(1, $object->getCustomProperties()); - $this->assertTrue($object->isCustomPropertySet('pName')); - $this->assertEquals(DocumentProperties::PROPERTY_TYPE_INTEGER, $object->getCustomPropertyType('pName')); - $this->assertEquals(2, $object->getCustomPropertyValue('pName')); - - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentProperties', $object->setCustomProperty('pName', 2.1, null)); - $this->assertCount(1, $object->getCustomProperties()); - $this->assertTrue($object->isCustomPropertySet('pName')); - $this->assertEquals(DocumentProperties::PROPERTY_TYPE_FLOAT, $object->getCustomPropertyType('pName')); - $this->assertEquals(2.1, $object->getCustomPropertyValue('pName')); - - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentProperties', $object->setCustomProperty('pName', true, null)); - $this->assertCount(1, $object->getCustomProperties()); - $this->assertTrue($object->isCustomPropertySet('pName')); - $this->assertEquals(DocumentProperties::PROPERTY_TYPE_BOOLEAN, $object->getCustomPropertyType('pName')); - $this->assertEquals(true, $object->getCustomPropertyValue('pName')); - - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentProperties', $object->setCustomProperty('pName', null, null)); - $this->assertCount(1, $object->getCustomProperties()); - $this->assertTrue($object->isCustomPropertySet('pName')); - $this->assertEquals(DocumentProperties::PROPERTY_TYPE_STRING, $object->getCustomPropertyType('pName')); - $this->assertEquals(null, $object->getCustomPropertyValue('pName')); - - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentProperties', $object->setCustomProperty('pName', $valueTime, DocumentProperties::PROPERTY_TYPE_DATE)); - $this->assertCount(1, $object->getCustomProperties()); - $this->assertTrue($object->isCustomPropertySet('pName')); - $this->assertEquals(DocumentProperties::PROPERTY_TYPE_DATE, $object->getCustomPropertyType('pName')); - $this->assertEquals($valueTime, $object->getCustomPropertyValue('pName')); - - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentProperties', $object->setCustomProperty('pName', (string) $valueTime, DocumentProperties::PROPERTY_TYPE_UNKNOWN)); - $this->assertCount(1, $object->getCustomProperties()); - $this->assertTrue($object->isCustomPropertySet('pName')); - $this->assertEquals(DocumentProperties::PROPERTY_TYPE_STRING, $object->getCustomPropertyType('pName')); - $this->assertEquals($valueTime, $object->getCustomPropertyValue('pName')); + self::assertIsArray($object->getCustomProperties()); + self::assertCount(0, $object->getCustomProperties()); + self::assertFalse($object->isCustomPropertySet('pName')); + self::assertNull($object->getCustomPropertyType('pName')); + self::assertNull($object->getCustomPropertyValue('pName')); + + self::assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentProperties', $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::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::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::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::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::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::assertCount(1, $object->getCustomProperties()); + self::assertTrue($object->isCustomPropertySet('pName')); + self::assertEquals(DocumentProperties::PROPERTY_TYPE_STRING, $object->getCustomPropertyType('pName')); + self::assertEquals($valueTime, $object->getCustomPropertyValue('pName')); } } diff --git a/tests/PhpPresentation/Tests/HashTableTest.php b/tests/PhpPresentation/Tests/HashTableTest.php index 18c3a149a..e6503135c 100644 --- a/tests/PhpPresentation/Tests/HashTableTest.php +++ b/tests/PhpPresentation/Tests/HashTableTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -35,11 +34,11 @@ public function testConstructNull(): void { $object = new HashTable(); - $this->assertEquals(0, $object->count()); - $this->assertNull($object->getByIndex()); - $this->assertNull($object->getByHashCode()); - $this->assertIsArray($object->toArray()); - $this->assertEmpty($object->toArray()); + self::assertEquals(0, $object->count()); + self::assertNull($object->getByIndex()); + self::assertNull($object->getByHashCode()); + self::assertIsArray($object->toArray()); + self::assertEmpty($object->toArray()); } public function testConstructSource(): void @@ -49,9 +48,9 @@ public function testConstructSource(): void new Slide(), ]); - $this->assertEquals(2, $object->count()); - $this->assertIsArray($object->toArray()); - $this->assertCount(2, $object->toArray()); + self::assertEquals(2, $object->count()); + self::assertIsArray($object->toArray()); + self::assertCount(2, $object->toArray()); } public function testAdd(): void @@ -63,22 +62,22 @@ public function testAdd(): void $object->addFromSource(); // Add From Source : Array $object->addFromSource([$oSlide]); - $this->assertIsArray($object->toArray()); - $this->assertCount(1, $object->toArray()); + self::assertIsArray($object->toArray()); + self::assertCount(1, $object->toArray()); // Clear $object->clear(); - $this->assertEmpty($object->toArray()); + self::assertEmpty($object->toArray()); // Add Object $object->add($oSlide); - $this->assertCount(1, $object->toArray()); + self::assertCount(1, $object->toArray()); $object->clear(); // Add Object w/Hash Index - $oSlide->setHashIndex(rand(1, 100)); + $oSlide->setHashIndex(mt_rand(1, 100)); $object->add($oSlide); - $this->assertCount(1, $object->toArray()); + self::assertCount(1, $object->toArray()); // Add Object w/the same Hash Index $object->add($oSlide); - $this->assertCount(1, $object->toArray()); + self::assertCount(1, $object->toArray()); } public function testIndex(): void @@ -91,10 +90,10 @@ public function testIndex(): void $object->add($oSlide1); $object->add($oSlide2); // Index - $this->assertEquals(0, $object->getIndexForHashCode($oSlide1->getHashCode())); - $this->assertEquals(1, $object->getIndexForHashCode($oSlide2->getHashCode())); - $this->assertEquals($oSlide1, $object->getByIndex(0)); - $this->assertEquals($oSlide2, $object->getByIndex(1)); + self::assertEquals(0, $object->getIndexForHashCode($oSlide1->getHashCode())); + self::assertEquals(1, $object->getIndexForHashCode($oSlide2->getHashCode())); + self::assertEquals($oSlide1, $object->getByIndex(0)); + self::assertEquals($oSlide2, $object->getByIndex(1)); } public function testRemove(): void @@ -110,8 +109,8 @@ public function testRemove(): void $object->add($oSlide3); // Remove $object->remove($oSlide2); - $this->assertCount(2, $object->toArray()); + self::assertCount(2, $object->toArray()); $object->remove($oSlide3); - $this->assertCount(1, $object->toArray()); + self::assertCount(1, $object->toArray()); } } diff --git a/tests/PhpPresentation/Tests/IOFactoryTest.php b/tests/PhpPresentation/Tests/IOFactoryTest.php index d17f61548..504890891 100644 --- a/tests/PhpPresentation/Tests/IOFactoryTest.php +++ b/tests/PhpPresentation/Tests/IOFactoryTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -40,7 +39,7 @@ public function testCreateWriter(): void { $class = 'PhpOffice\\PhpPresentation\\Writer\\PowerPoint2007'; - $this->assertInstanceOf($class, IOFactory::createWriter(new PhpPresentation())); + self::assertInstanceOf($class, IOFactory::createWriter(new PhpPresentation())); } /** @@ -50,7 +49,7 @@ public function testCreateReader(): void { $class = 'PhpOffice\\PhpPresentation\\Reader\\ReaderInterface'; - $this->assertInstanceOf($class, IOFactory::createReader('Serialized')); + self::assertInstanceOf($class, IOFactory::createReader('Serialized')); } /** @@ -65,7 +64,7 @@ public function testLoadClassException(): void public function testLoad(): void { - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\PhpPresentation', IOFactory::load(PHPPRESENTATION_TESTS_BASE_DIR . DIRECTORY_SEPARATOR . 'resources' . DIRECTORY_SEPARATOR . 'files' . DIRECTORY_SEPARATOR . 'serialized.phppt')); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\PhpPresentation', IOFactory::load(PHPPRESENTATION_TESTS_BASE_DIR . DIRECTORY_SEPARATOR . 'resources' . DIRECTORY_SEPARATOR . 'files' . DIRECTORY_SEPARATOR . 'serialized.phppt')); } /** diff --git a/tests/PhpPresentation/Tests/PhpPresentationTest.php b/tests/PhpPresentation/Tests/PhpPresentationTest.php index 3370f9246..a093e6b02 100644 --- a/tests/PhpPresentation/Tests/PhpPresentationTest.php +++ b/tests/PhpPresentation/Tests/PhpPresentationTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -42,30 +41,30 @@ public function testConstruct(): void $object = new PhpPresentation(); $slide = $object->getSlide(); - $this->assertEquals(new DocumentProperties(), $object->getDocumentProperties()); - $this->assertEquals(new DocumentLayout(), $object->getLayout()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide', $object->getSlide()); - $this->assertCount(1, $object->getAllSlides()); - $this->assertEquals(0, $object->getIndex($slide)); - $this->assertEquals(1, $object->getSlideCount()); - $this->assertEquals(0, $object->getActiveSlideIndex()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\Iterator', $object->getSlideIterator()); + self::assertEquals(new DocumentProperties(), $object->getDocumentProperties()); + self::assertEquals(new DocumentLayout(), $object->getLayout()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Slide', $object->getSlide()); + self::assertCount(1, $object->getAllSlides()); + self::assertEquals(0, $object->getIndex($slide)); + self::assertEquals(1, $object->getSlideCount()); + self::assertEquals(0, $object->getActiveSlideIndex()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\Iterator', $object->getSlideIterator()); } public function testProperties(): void { $object = new PhpPresentation(); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentProperties', $object->getDocumentProperties()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\PhpPresentation', $object->setDocumentProperties(new DocumentProperties())); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentProperties', $object->getDocumentProperties()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentProperties', $object->getDocumentProperties()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\PhpPresentation', $object->setDocumentProperties(new DocumentProperties())); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentProperties', $object->getDocumentProperties()); } public function testPresentationProperties(): void { $object = new PhpPresentation(); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\PresentationProperties', $object->getPresentationProperties()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\PhpPresentation', $object->setPresentationProperties(new PresentationProperties())); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\PresentationProperties', $object->getPresentationProperties()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\PresentationProperties', $object->getPresentationProperties()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\PhpPresentation', $object->setPresentationProperties(new PresentationProperties())); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\PresentationProperties', $object->getPresentationProperties()); } /** @@ -78,7 +77,7 @@ public function testAddExternalSlide(): void $object = new PhpPresentation(); $object->addExternalSlide($slide); - $this->assertEquals(2, $object->getSlideCount()); + self::assertEquals(2, $object->getSlideCount()); } /** @@ -87,7 +86,7 @@ public function testAddExternalSlide(): void public function testCopy(): void { $object = new PhpPresentation(); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\PhpPresentation', $object->copy()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\PhpPresentation', $object->copy()); } /** diff --git a/tests/PhpPresentation/Tests/PresentationPropertiesTest.php b/tests/PhpPresentation/Tests/PresentationPropertiesTest.php index 56d88f5d4..aaa7c74b0 100644 --- a/tests/PhpPresentation/Tests/PresentationPropertiesTest.php +++ b/tests/PhpPresentation/Tests/PresentationPropertiesTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -33,49 +32,49 @@ class PresentationPropertiesTest extends TestCase public function testCommentVisible(): void { $object = new PresentationProperties(); - $this->assertFalse($object->isCommentVisible()); - $this->assertInstanceOf(PresentationProperties::class, $object->setCommentVisible(true)); - $this->assertTrue($object->isCommentVisible()); - $this->assertInstanceOf(PresentationProperties::class, $object->setCommentVisible(false)); - $this->assertFalse($object->isCommentVisible()); - $this->assertInstanceOf(PresentationProperties::class, $object->setCommentVisible()); - $this->assertFalse($object->isCommentVisible()); + self::assertFalse($object->isCommentVisible()); + self::assertInstanceOf(PresentationProperties::class, $object->setCommentVisible(true)); + self::assertTrue($object->isCommentVisible()); + self::assertInstanceOf(PresentationProperties::class, $object->setCommentVisible(false)); + self::assertFalse($object->isCommentVisible()); + self::assertInstanceOf(PresentationProperties::class, $object->setCommentVisible()); + self::assertFalse($object->isCommentVisible()); } public function testLoopUntilEsc(): void { $object = new PresentationProperties(); - $this->assertFalse($object->isLoopContinuouslyUntilEsc()); - $this->assertInstanceOf(PresentationProperties::class, $object->setLoopContinuouslyUntilEsc(true)); - $this->assertTrue($object->isLoopContinuouslyUntilEsc()); - $this->assertInstanceOf(PresentationProperties::class, $object->setLoopContinuouslyUntilEsc(false)); - $this->assertFalse($object->isLoopContinuouslyUntilEsc()); - $this->assertInstanceOf(PresentationProperties::class, $object->setLoopContinuouslyUntilEsc()); - $this->assertFalse($object->isLoopContinuouslyUntilEsc()); + self::assertFalse($object->isLoopContinuouslyUntilEsc()); + self::assertInstanceOf(PresentationProperties::class, $object->setLoopContinuouslyUntilEsc(true)); + self::assertTrue($object->isLoopContinuouslyUntilEsc()); + self::assertInstanceOf(PresentationProperties::class, $object->setLoopContinuouslyUntilEsc(false)); + self::assertFalse($object->isLoopContinuouslyUntilEsc()); + self::assertInstanceOf(PresentationProperties::class, $object->setLoopContinuouslyUntilEsc()); + self::assertFalse($object->isLoopContinuouslyUntilEsc()); } public function testLastView(): void { $object = new PresentationProperties(); - $this->assertEquals(PresentationProperties::VIEW_SLIDE, $object->getLastView()); - $this->assertInstanceOf(PresentationProperties::class, $object->setLastView('AAAA')); - $this->assertEquals(PresentationProperties::VIEW_SLIDE, $object->getLastView()); - $this->assertInstanceOf(PresentationProperties::class, $object->setLastView(PresentationProperties::VIEW_OUTLINE)); - $this->assertEquals(PresentationProperties::VIEW_OUTLINE, $object->getLastView()); - $this->assertInstanceOf(PresentationProperties::class, $object->setLastView()); - $this->assertEquals(PresentationProperties::VIEW_SLIDE, $object->getLastView()); + self::assertEquals(PresentationProperties::VIEW_SLIDE, $object->getLastView()); + self::assertInstanceOf(PresentationProperties::class, $object->setLastView('AAAA')); + self::assertEquals(PresentationProperties::VIEW_SLIDE, $object->getLastView()); + self::assertInstanceOf(PresentationProperties::class, $object->setLastView(PresentationProperties::VIEW_OUTLINE)); + self::assertEquals(PresentationProperties::VIEW_OUTLINE, $object->getLastView()); + self::assertInstanceOf(PresentationProperties::class, $object->setLastView()); + self::assertEquals(PresentationProperties::VIEW_SLIDE, $object->getLastView()); } public function testMarkAsFinal(): void { $object = new PresentationProperties(); - $this->assertFalse($object->isMarkedAsFinal()); - $this->assertInstanceOf(PresentationProperties::class, $object->markAsFinal(true)); - $this->assertTrue($object->isMarkedAsFinal()); - $this->assertInstanceOf(PresentationProperties::class, $object->markAsFinal(false)); - $this->assertFalse($object->isMarkedAsFinal()); - $this->assertInstanceOf(PresentationProperties::class, $object->markAsFinal()); - $this->assertTrue($object->isMarkedAsFinal()); + self::assertFalse($object->isMarkedAsFinal()); + self::assertInstanceOf(PresentationProperties::class, $object->markAsFinal(true)); + self::assertTrue($object->isMarkedAsFinal()); + self::assertInstanceOf(PresentationProperties::class, $object->markAsFinal(false)); + self::assertFalse($object->isMarkedAsFinal()); + self::assertInstanceOf(PresentationProperties::class, $object->markAsFinal()); + self::assertTrue($object->isMarkedAsFinal()); } /** @@ -85,19 +84,19 @@ public function testSlideshowType(?string $value, string $expected): void { $object = new PresentationProperties(); // Default - $this->assertEquals(PresentationProperties::SLIDESHOW_TYPE_PRESENT, $object->getSlideshowType()); + self::assertEquals(PresentationProperties::SLIDESHOW_TYPE_PRESENT, $object->getSlideshowType()); // Set value - if (is_null($value)) { - $this->assertInstanceOf(PresentationProperties::class, $object->setSlideshowType()); + if (null === $value) { + self::assertInstanceOf(PresentationProperties::class, $object->setSlideshowType()); } else { - $this->assertInstanceOf(PresentationProperties::class, $object->setSlideshowType($value)); + self::assertInstanceOf(PresentationProperties::class, $object->setSlideshowType($value)); } // Check value - $this->assertEquals($expected, $object->getSlideshowType()); + self::assertEquals($expected, $object->getSlideshowType()); } /** - * @return array<array<string|null>> + * @return array<array<null|string>> */ public function dataProviderSlideshowType(): array { @@ -130,24 +129,24 @@ public function testThumbnail(): void $imagePath = PHPPRESENTATION_TESTS_BASE_DIR . DIRECTORY_SEPARATOR . 'resources' . DIRECTORY_SEPARATOR . 'images' . DIRECTORY_SEPARATOR . 'PhpPresentationLogo.png'; $object = new PresentationProperties(); - $this->assertNull($object->getThumbnailPath()); - $this->assertInstanceOf(PresentationProperties::class, $object->setThumbnailPath('AAAA')); - $this->assertNull($object->getThumbnailPath()); - $this->assertInstanceOf(PresentationProperties::class, $object->setThumbnailPath()); - $this->assertNull($object->getThumbnailPath()); - $this->assertInstanceOf(PresentationProperties::class, $object->setThumbnailPath($imagePath)); - $this->assertEquals($imagePath, $object->getThumbnailPath()); - $this->assertInstanceOf(PresentationProperties::class, $object->setThumbnailPath()); - $this->assertEquals($imagePath, $object->getThumbnailPath()); + self::assertNull($object->getThumbnailPath()); + self::assertInstanceOf(PresentationProperties::class, $object->setThumbnailPath('AAAA')); + self::assertNull($object->getThumbnailPath()); + self::assertInstanceOf(PresentationProperties::class, $object->setThumbnailPath()); + self::assertNull($object->getThumbnailPath()); + self::assertInstanceOf(PresentationProperties::class, $object->setThumbnailPath($imagePath)); + self::assertEquals($imagePath, $object->getThumbnailPath()); + self::assertInstanceOf(PresentationProperties::class, $object->setThumbnailPath()); + self::assertEquals($imagePath, $object->getThumbnailPath()); } public function testZoom(): void { $object = new PresentationProperties(); - $this->assertEquals(1, $object->getZoom()); - $this->assertInstanceOf(PresentationProperties::class, $object->setZoom(2.3)); - $this->assertEquals(2.3, $object->getZoom()); - $this->assertInstanceOf(PresentationProperties::class, $object->setZoom()); - $this->assertEquals(1, $object->getZoom()); + self::assertEquals(1, $object->getZoom()); + self::assertInstanceOf(PresentationProperties::class, $object->setZoom(2.3)); + self::assertEquals(2.3, $object->getZoom()); + self::assertInstanceOf(PresentationProperties::class, $object->setZoom()); + self::assertEquals(1, $object->getZoom()); } } diff --git a/tests/PhpPresentation/Tests/Reader/ODPresentationTest.php b/tests/PhpPresentation/Tests/Reader/ODPresentationTest.php index 418215bbf..62fb2d0e7 100644 --- a/tests/PhpPresentation/Tests/Reader/ODPresentationTest.php +++ b/tests/PhpPresentation/Tests/Reader/ODPresentationTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -47,16 +46,16 @@ public function testCanRead(): void $object = new ODPresentation(); $file = PHPPRESENTATION_TESTS_BASE_DIR . '/resources/files/Sample_00_01.ppt'; - $this->assertFalse($object->canRead($file)); + self::assertFalse($object->canRead($file)); $file = PHPPRESENTATION_TESTS_BASE_DIR . '/resources/files/serialized.phppt'; - $this->assertFalse($object->canRead($file)); + self::assertFalse($object->canRead($file)); $file = PHPPRESENTATION_TESTS_BASE_DIR . '/resources/files/Sample_12.pptx'; - $this->assertFalse($object->canRead($file)); + self::assertFalse($object->canRead($file)); $file = PHPPRESENTATION_TESTS_BASE_DIR . '/resources/files/Sample_12.odp'; - $this->assertTrue($object->canRead($file)); + self::assertTrue($object->canRead($file)); } public function testLoadFileNotExists(): void @@ -95,475 +94,475 @@ public function testLoadFile01(): void $file = PHPPRESENTATION_TESTS_BASE_DIR . '/resources/files/Sample_12.odp'; $object = new ODPresentation(); $oPhpPresentation = $object->load($file); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\PhpPresentation', $oPhpPresentation); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\PhpPresentation', $oPhpPresentation); // Document Properties - $this->assertEquals('PHPOffice', $oPhpPresentation->getDocumentProperties()->getCreator()); - $this->assertEquals('PHPPresentation Team', $oPhpPresentation->getDocumentProperties()->getLastModifiedBy()); - $this->assertEquals('Sample 02 Title', $oPhpPresentation->getDocumentProperties()->getTitle()); - $this->assertEquals('Sample 02 Subject', $oPhpPresentation->getDocumentProperties()->getSubject()); - $this->assertEquals('Sample 02 Description', $oPhpPresentation->getDocumentProperties()->getDescription()); - $this->assertEquals('office 2007 openxml libreoffice odt php', $oPhpPresentation->getDocumentProperties()->getKeywords()); - $this->assertIsArray($oPhpPresentation->getDocumentProperties()->getCustomProperties()); - $this->assertCount(0, $oPhpPresentation->getDocumentProperties()->getCustomProperties()); + self::assertEquals('PHPOffice', $oPhpPresentation->getDocumentProperties()->getCreator()); + self::assertEquals('PHPPresentation Team', $oPhpPresentation->getDocumentProperties()->getLastModifiedBy()); + self::assertEquals('Sample 02 Title', $oPhpPresentation->getDocumentProperties()->getTitle()); + self::assertEquals('Sample 02 Subject', $oPhpPresentation->getDocumentProperties()->getSubject()); + self::assertEquals('Sample 02 Description', $oPhpPresentation->getDocumentProperties()->getDescription()); + self::assertEquals('office 2007 openxml libreoffice odt php', $oPhpPresentation->getDocumentProperties()->getKeywords()); + self::assertIsArray($oPhpPresentation->getDocumentProperties()->getCustomProperties()); + self::assertCount(0, $oPhpPresentation->getDocumentProperties()->getCustomProperties()); // Presentation Properties - $this->assertEquals(PresentationProperties::SLIDESHOW_TYPE_PRESENT, $oPhpPresentation->getPresentationProperties()->getSlideshowType()); + self::assertEquals(PresentationProperties::SLIDESHOW_TYPE_PRESENT, $oPhpPresentation->getPresentationProperties()->getSlideshowType()); - $this->assertCount(4, $oPhpPresentation->getAllSlides()); + self::assertCount(4, $oPhpPresentation->getAllSlides()); // Slide 1 $oSlide1 = $oPhpPresentation->getSlide(0); $arrayShape = (array) $oSlide1->getShapeCollection(); - $this->assertCount(2, $arrayShape); + self::assertCount(2, $arrayShape); // Slide 1 : Shape 1 /** @var Gd $oShape */ $oShape = $arrayShape[0]; - $this->assertInstanceOf(Gd::class, $oShape); - $this->assertEquals('PHPPresentation logo', $oShape->getName()); - $this->assertEquals('PHPPresentation logo', $oShape->getDescription()); - $this->assertEquals(36, $oShape->getHeight()); - $this->assertEquals(10, $oShape->getOffsetX()); - $this->assertEquals(10, $oShape->getOffsetY()); - $this->assertEquals('image/png', $oShape->getMimeType()); - $this->assertTrue($oShape->getShadow()->isVisible()); - $this->assertEquals(45, $oShape->getShadow()->getDirection()); - $this->assertEquals(10, $oShape->getShadow()->getDistance()); + self::assertInstanceOf(Gd::class, $oShape); + self::assertEquals('PHPPresentation logo', $oShape->getName()); + self::assertEquals('PHPPresentation logo', $oShape->getDescription()); + self::assertEquals(36, $oShape->getHeight()); + self::assertEquals(10, $oShape->getOffsetX()); + self::assertEquals(10, $oShape->getOffsetY()); + self::assertEquals('image/png', $oShape->getMimeType()); + self::assertTrue($oShape->getShadow()->isVisible()); + self::assertEquals(45, $oShape->getShadow()->getDirection()); + self::assertEquals(10, $oShape->getShadow()->getDistance()); // Slide 1 : Shape 2 /** @var RichText $oShape */ $oShape = $arrayShape[1]; - $this->assertInstanceOf(RichText::class, $oShape); - $this->assertEquals(200, $oShape->getHeight()); - $this->assertEquals(600, $oShape->getWidth()); - $this->assertEquals(10, $oShape->getOffsetX()); - $this->assertEquals(400, $oShape->getOffsetY()); + self::assertInstanceOf(RichText::class, $oShape); + self::assertEquals(200, $oShape->getHeight()); + self::assertEquals(600, $oShape->getWidth()); + self::assertEquals(10, $oShape->getOffsetX()); + self::assertEquals(400, $oShape->getOffsetY()); $arrayParagraphs = $oShape->getParagraphs(); - $this->assertCount(1, $arrayParagraphs); + self::assertCount(1, $arrayParagraphs); $oParagraph = $arrayParagraphs[0]; - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Paragraph', $oParagraph); - $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); - $this->assertFalse($oParagraph->getAlignment()->isRTL()); - $this->assertEquals(0, $oParagraph->getSpacingAfter()); - $this->assertEquals(0, $oParagraph->getSpacingBefore()); - $this->assertEquals(Paragraph::LINE_SPACING_MODE_PERCENT, $oParagraph->getLineSpacingMode()); - $this->assertEquals(100, $oParagraph->getLineSpacing()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Paragraph', $oParagraph); + self::assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); + self::assertFalse($oParagraph->getAlignment()->isRTL()); + self::assertEquals(0, $oParagraph->getSpacingAfter()); + self::assertEquals(0, $oParagraph->getSpacingBefore()); + self::assertEquals(Paragraph::LINE_SPACING_MODE_PERCENT, $oParagraph->getLineSpacingMode()); + self::assertEquals(100, $oParagraph->getLineSpacing()); $arrayRichText = $oParagraph->getRichTextElements(); - $this->assertCount(3, $arrayRichText); + self::assertCount(3, $arrayRichText); // Slide 1 : Shape 2 : Paragraph 1 $oRichText = $arrayRichText[0]; - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); - $this->assertEquals('Introduction to', $oRichText->getText()); - $this->assertTrue($oRichText->getFont()->isBold()); - $this->assertEquals(28, $oRichText->getFont()->getSize()); - $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); - $this->assertEquals('Calibri', $oRichText->getFont()->getName()); - $this->assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + self::assertEquals('Introduction to', $oRichText->getText()); + self::assertTrue($oRichText->getFont()->isBold()); + self::assertEquals(28, $oRichText->getFont()->getSize()); + self::assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + self::assertEquals('Calibri', $oRichText->getFont()->getName()); + self::assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); // Slide 1 : Shape 2 : Paragraph 2 $oRichText = $arrayRichText[1]; - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\BreakElement', $oRichText); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\BreakElement', $oRichText); // Slide 1 : Shape 2 : Paragraph 3 $oRichText = $arrayRichText[2]; - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); - $this->assertEquals('PHPPresentation', $oRichText->getText()); - $this->assertTrue($oRichText->getFont()->isBold()); - $this->assertEquals(60, $oRichText->getFont()->getSize()); - $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); - $this->assertEquals('Calibri', $oRichText->getFont()->getName()); - $this->assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + self::assertEquals('PHPPresentation', $oRichText->getText()); + self::assertTrue($oRichText->getFont()->isBold()); + self::assertEquals(60, $oRichText->getFont()->getSize()); + self::assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + self::assertEquals('Calibri', $oRichText->getFont()->getName()); + self::assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); // Slide 2 $oSlide2 = $oPhpPresentation->getSlide(1); $arrayShape = (array) $oSlide2->getShapeCollection(); - $this->assertCount(3, $arrayShape); + self::assertCount(3, $arrayShape); // Slide 2 : Shape 1 /** @var Gd $oShape */ $oShape = $arrayShape[0]; - $this->assertInstanceOf(Gd::class, $oShape); - $this->assertEquals('PHPPresentation logo', $oShape->getName()); - $this->assertEquals('PHPPresentation logo', $oShape->getDescription()); - $this->assertEquals(36, $oShape->getHeight()); - $this->assertEquals(10, $oShape->getOffsetX()); - $this->assertEquals(10, $oShape->getOffsetY()); - $this->assertEquals('image/png', $oShape->getMimeType()); - $this->assertTrue($oShape->getShadow()->isVisible()); - $this->assertEquals(45, $oShape->getShadow()->getDirection()); - $this->assertEquals(10, $oShape->getShadow()->getDistance()); + self::assertInstanceOf(Gd::class, $oShape); + self::assertEquals('PHPPresentation logo', $oShape->getName()); + self::assertEquals('PHPPresentation logo', $oShape->getDescription()); + self::assertEquals(36, $oShape->getHeight()); + self::assertEquals(10, $oShape->getOffsetX()); + self::assertEquals(10, $oShape->getOffsetY()); + self::assertEquals('image/png', $oShape->getMimeType()); + self::assertTrue($oShape->getShadow()->isVisible()); + self::assertEquals(45, $oShape->getShadow()->getDirection()); + self::assertEquals(10, $oShape->getShadow()->getDistance()); // Slide 2 : Shape 2 /** @var RichText $oShape */ $oShape = $arrayShape[1]; - $this->assertInstanceOf(RichText::class, $oShape); - $this->assertEquals(100, $oShape->getHeight()); - $this->assertEquals(930, $oShape->getWidth()); - $this->assertEquals(10, $oShape->getOffsetX()); - $this->assertEquals(50, $oShape->getOffsetY()); + self::assertInstanceOf(RichText::class, $oShape); + self::assertEquals(100, $oShape->getHeight()); + self::assertEquals(930, $oShape->getWidth()); + self::assertEquals(10, $oShape->getOffsetX()); + self::assertEquals(50, $oShape->getOffsetY()); $arrayParagraphs = $oShape->getParagraphs(); - $this->assertCount(1, $arrayParagraphs); + self::assertCount(1, $arrayParagraphs); $oParagraph = $arrayParagraphs[0]; - $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); - $this->assertFalse($oParagraph->getAlignment()->isRTL()); + self::assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); + self::assertFalse($oParagraph->getAlignment()->isRTL()); $arrayRichText = $oParagraph->getRichTextElements(); - $this->assertCount(1, $arrayRichText); + self::assertCount(1, $arrayRichText); // Slide 2 : Shape 2 : Paragraph 1 $oRichText = $arrayRichText[0]; - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); - $this->assertEquals('What is PHPPresentation?', $oRichText->getText()); - $this->assertTrue($oRichText->getFont()->isBold()); - $this->assertEquals(48, $oRichText->getFont()->getSize()); - $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + self::assertEquals('What is PHPPresentation?', $oRichText->getText()); + self::assertTrue($oRichText->getFont()->isBold()); + self::assertEquals(48, $oRichText->getFont()->getSize()); + self::assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); // Slide 2 : Shape 3 /** @var RichText $oShape */ $oShape = $arrayShape[2]; - $this->assertInstanceOf(RichText::class, $oShape); - $this->assertEquals(600, $oShape->getHeight()); - $this->assertEquals(930, $oShape->getWidth()); - $this->assertEquals(10, $oShape->getOffsetX()); - $this->assertEquals(130, $oShape->getOffsetY()); + self::assertInstanceOf(RichText::class, $oShape); + self::assertEquals(600, $oShape->getHeight()); + self::assertEquals(930, $oShape->getWidth()); + self::assertEquals(10, $oShape->getOffsetX()); + self::assertEquals(130, $oShape->getOffsetY()); $arrayParagraphs = $oShape->getParagraphs(); - $this->assertCount(4, $arrayParagraphs); + self::assertCount(4, $arrayParagraphs); // Slide 2 : Shape 3 : Paragraph 1 $oParagraph = $arrayParagraphs[0]; - $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); - $this->assertFalse($oParagraph->getAlignment()->isRTL()); + self::assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); + self::assertFalse($oParagraph->getAlignment()->isRTL()); // $this->assertEquals(25, $oParagraph->getAlignment()->getMarginLeft()); // $this->assertEquals(-25, $oParagraph->getAlignment()->getIndent()); - $this->assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); + self::assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); $arrayRichText = $oParagraph->getRichTextElements(); - $this->assertCount(1, $arrayRichText); + self::assertCount(1, $arrayRichText); $oRichText = $arrayRichText[0]; - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); - $this->assertEquals('A class library', $oRichText->getText()); - $this->assertEquals(36, $oRichText->getFont()->getSize()); - $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); - $this->assertEquals('Calibri', $oRichText->getFont()->getName()); - $this->assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + self::assertEquals('A class library', $oRichText->getText()); + self::assertEquals(36, $oRichText->getFont()->getSize()); + self::assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + self::assertEquals('Calibri', $oRichText->getFont()->getName()); + self::assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); // Slide 2 : Shape 3 : Paragraph 2 $oParagraph = $arrayParagraphs[1]; - $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); - $this->assertFalse($oParagraph->getAlignment()->isRTL()); + self::assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); + self::assertFalse($oParagraph->getAlignment()->isRTL()); // $this->assertEquals(25, $oParagraph->getAlignment()->getMarginLeft()); // $this->assertEquals(-25, $oParagraph->getAlignment()->getIndent()); - $this->assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); + self::assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); $arrayRichText = $oParagraph->getRichTextElements(); - $this->assertCount(1, $arrayRichText); + self::assertCount(1, $arrayRichText); $oRichText = $arrayRichText[0]; - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); - $this->assertEquals('Written in PHP', $oRichText->getText()); - $this->assertEquals(36, $oRichText->getFont()->getSize()); - $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); - $this->assertEquals('Calibri', $oRichText->getFont()->getName()); - $this->assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + self::assertEquals('Written in PHP', $oRichText->getText()); + self::assertEquals(36, $oRichText->getFont()->getSize()); + self::assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + self::assertEquals('Calibri', $oRichText->getFont()->getName()); + self::assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); // Slide 2 : Shape 3 : Paragraph 3 $oParagraph = $arrayParagraphs[2]; - $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); - $this->assertFalse($oParagraph->getAlignment()->isRTL()); + self::assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); + self::assertFalse($oParagraph->getAlignment()->isRTL()); // $this->assertEquals(25, $oParagraph->getAlignment()->getMarginLeft()); // $this->assertEquals(-25, $oParagraph->getAlignment()->getIndent()); - $this->assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); + self::assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); $arrayRichText = $oParagraph->getRichTextElements(); - $this->assertCount(1, $arrayRichText); + self::assertCount(1, $arrayRichText); $oRichText = $arrayRichText[0]; - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); - $this->assertEquals('Representing a presentation', $oRichText->getText()); - $this->assertEquals(36, $oRichText->getFont()->getSize()); - $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); - $this->assertEquals('Calibri', $oRichText->getFont()->getName()); - $this->assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + self::assertEquals('Representing a presentation', $oRichText->getText()); + self::assertEquals(36, $oRichText->getFont()->getSize()); + self::assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + self::assertEquals('Calibri', $oRichText->getFont()->getName()); + self::assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); // Slide 2 : Shape 3 : Paragraph 4 $oParagraph = $arrayParagraphs[3]; - $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); - $this->assertFalse($oParagraph->getAlignment()->isRTL()); + self::assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); + self::assertFalse($oParagraph->getAlignment()->isRTL()); // $this->assertEquals(25, $oParagraph->getAlignment()->getMarginLeft()); // $this->assertEquals(-25, $oParagraph->getAlignment()->getIndent()); - $this->assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); + self::assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); $arrayRichText = $oParagraph->getRichTextElements(); - $this->assertCount(1, $arrayRichText); + self::assertCount(1, $arrayRichText); $oRichText = $arrayRichText[0]; - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); - $this->assertEquals('Supports writing to different file formats', $oRichText->getText()); - $this->assertEquals(36, $oRichText->getFont()->getSize()); - $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); - $this->assertEquals('Calibri', $oRichText->getFont()->getName()); - $this->assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + self::assertEquals('Supports writing to different file formats', $oRichText->getText()); + self::assertEquals(36, $oRichText->getFont()->getSize()); + self::assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + self::assertEquals('Calibri', $oRichText->getFont()->getName()); + self::assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); // Slide 3 $oSlide2 = $oPhpPresentation->getSlide(2); $arrayShape = (array) $oSlide2->getShapeCollection(); - $this->assertCount(3, $arrayShape); + self::assertCount(3, $arrayShape); // Slide 3 : Shape 1 /** @var Gd $oShape */ $oShape = $arrayShape[0]; - $this->assertInstanceOf(Gd::class, $oShape); - $this->assertEquals('PHPPresentation logo', $oShape->getName()); - $this->assertEquals('PHPPresentation logo', $oShape->getDescription()); - $this->assertEquals(36, $oShape->getHeight()); - $this->assertEquals(10, $oShape->getOffsetX()); - $this->assertEquals(10, $oShape->getOffsetY()); - $this->assertEquals('image/png', $oShape->getMimeType()); - $this->assertTrue($oShape->getShadow()->isVisible()); - $this->assertEquals(45, $oShape->getShadow()->getDirection()); - $this->assertEquals(10, $oShape->getShadow()->getDistance()); + self::assertInstanceOf(Gd::class, $oShape); + self::assertEquals('PHPPresentation logo', $oShape->getName()); + self::assertEquals('PHPPresentation logo', $oShape->getDescription()); + self::assertEquals(36, $oShape->getHeight()); + self::assertEquals(10, $oShape->getOffsetX()); + self::assertEquals(10, $oShape->getOffsetY()); + self::assertEquals('image/png', $oShape->getMimeType()); + self::assertTrue($oShape->getShadow()->isVisible()); + self::assertEquals(45, $oShape->getShadow()->getDirection()); + self::assertEquals(10, $oShape->getShadow()->getDistance()); // Slide 3 : Shape 2 /** @var RichText $oShape */ $oShape = $arrayShape[1]; - $this->assertInstanceOf(RichText::class, $oShape); - $this->assertEquals(100, $oShape->getHeight()); - $this->assertEquals(930, $oShape->getWidth()); - $this->assertEquals(10, $oShape->getOffsetX()); - $this->assertEquals(50, $oShape->getOffsetY()); + self::assertInstanceOf(RichText::class, $oShape); + self::assertEquals(100, $oShape->getHeight()); + self::assertEquals(930, $oShape->getWidth()); + self::assertEquals(10, $oShape->getOffsetX()); + self::assertEquals(50, $oShape->getOffsetY()); $arrayParagraphs = $oShape->getParagraphs(); - $this->assertCount(1, $arrayParagraphs); + self::assertCount(1, $arrayParagraphs); $oParagraph = $arrayParagraphs[0]; - $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); - $this->assertFalse($oParagraph->getAlignment()->isRTL()); - $this->assertEquals(0, $oParagraph->getSpacingAfter()); - $this->assertEquals(0, $oParagraph->getSpacingBefore()); - $this->assertEquals(Paragraph::LINE_SPACING_MODE_PERCENT, $oParagraph->getLineSpacingMode()); - $this->assertEquals(100, $oParagraph->getLineSpacing()); + self::assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); + self::assertFalse($oParagraph->getAlignment()->isRTL()); + self::assertEquals(0, $oParagraph->getSpacingAfter()); + self::assertEquals(0, $oParagraph->getSpacingBefore()); + self::assertEquals(Paragraph::LINE_SPACING_MODE_PERCENT, $oParagraph->getLineSpacingMode()); + self::assertEquals(100, $oParagraph->getLineSpacing()); $arrayRichText = $oParagraph->getRichTextElements(); - $this->assertCount(1, $arrayRichText); + self::assertCount(1, $arrayRichText); // Slide 3 : Shape 2 : Paragraph 1 $oRichText = $arrayRichText[0]; - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); - $this->assertEquals('What\'s the point?', $oRichText->getText()); - $this->assertTrue($oRichText->getFont()->isBold()); - $this->assertEquals(48, $oRichText->getFont()->getSize()); - $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); - $this->assertEquals('Calibri', $oRichText->getFont()->getName()); - $this->assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + self::assertEquals('What\'s the point?', $oRichText->getText()); + self::assertTrue($oRichText->getFont()->isBold()); + self::assertEquals(48, $oRichText->getFont()->getSize()); + self::assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + self::assertEquals('Calibri', $oRichText->getFont()->getName()); + self::assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); // Slide 3 : Shape 2 /** @var RichText $oShape */ $oShape = $arrayShape[2]; - $this->assertInstanceOf(RichText::class, $oShape); - $this->assertEquals(600, $oShape->getHeight()); - $this->assertEquals(930, $oShape->getWidth()); - $this->assertEquals(10, $oShape->getOffsetX()); - $this->assertEquals(130, $oShape->getOffsetY()); + self::assertInstanceOf(RichText::class, $oShape); + self::assertEquals(600, $oShape->getHeight()); + self::assertEquals(930, $oShape->getWidth()); + self::assertEquals(10, $oShape->getOffsetX()); + self::assertEquals(130, $oShape->getOffsetY()); $arrayParagraphs = $oShape->getParagraphs(); - $this->assertCount(8, $arrayParagraphs); + self::assertCount(8, $arrayParagraphs); // Slide 3 : Shape 3 : Paragraph 1 $oParagraph = $arrayParagraphs[0]; - $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); - $this->assertFalse($oParagraph->getAlignment()->isRTL()); + self::assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); + self::assertFalse($oParagraph->getAlignment()->isRTL()); // $this->assertEquals(25, $oParagraph->getAlignment()->getMarginLeft()); // $this->assertEquals(-25, $oParagraph->getAlignment()->getIndent()); - $this->assertEquals(0, $oParagraph->getAlignment()->getLevel()); - $this->assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); + self::assertEquals(0, $oParagraph->getAlignment()->getLevel()); + self::assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); $arrayRichText = $oParagraph->getRichTextElements(); - $this->assertCount(1, $arrayRichText); + self::assertCount(1, $arrayRichText); $oRichText = $arrayRichText[0]; - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); - $this->assertEquals('Generate slide decks', $oRichText->getText()); - $this->assertEquals(36, $oRichText->getFont()->getSize()); - $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); - $this->assertEquals('Calibri', $oRichText->getFont()->getName()); - $this->assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + self::assertEquals('Generate slide decks', $oRichText->getText()); + self::assertEquals(36, $oRichText->getFont()->getSize()); + self::assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + self::assertEquals('Calibri', $oRichText->getFont()->getName()); + self::assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); // Slide 3 : Shape 3 : Paragraph 2 $oParagraph = $arrayParagraphs[1]; - $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); - $this->assertFalse($oParagraph->getAlignment()->isRTL()); + self::assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); + self::assertFalse($oParagraph->getAlignment()->isRTL()); // $this->assertEquals(75, $oParagraph->getAlignment()->getMarginLeft()); // $this->assertEquals(-25, $oParagraph->getAlignment()->getIndent()); - $this->assertEquals(1, $oParagraph->getAlignment()->getLevel()); - $this->assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); + self::assertEquals(1, $oParagraph->getAlignment()->getLevel()); + self::assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); $arrayRichText = $oParagraph->getRichTextElements(); - $this->assertCount(1, $arrayRichText); + self::assertCount(1, $arrayRichText); $oRichText = $arrayRichText[0]; - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); - $this->assertEquals('Represent business data', $oRichText->getText()); - $this->assertEquals(36, $oRichText->getFont()->getSize()); - $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); - $this->assertEquals('Calibri', $oRichText->getFont()->getName()); - $this->assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + self::assertEquals('Represent business data', $oRichText->getText()); + self::assertEquals(36, $oRichText->getFont()->getSize()); + self::assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + self::assertEquals('Calibri', $oRichText->getFont()->getName()); + self::assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); // Slide 3 : Shape 3 : Paragraph 3 $oParagraph = $arrayParagraphs[2]; - $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); - $this->assertFalse($oParagraph->getAlignment()->isRTL()); + self::assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); + self::assertFalse($oParagraph->getAlignment()->isRTL()); // $this->assertEquals(75, $oParagraph->getAlignment()->getMarginLeft()); // $this->assertEquals(-25, $oParagraph->getAlignment()->getIndent()); - $this->assertEquals(1, $oParagraph->getAlignment()->getLevel()); - $this->assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); + self::assertEquals(1, $oParagraph->getAlignment()->getLevel()); + self::assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); $arrayRichText = $oParagraph->getRichTextElements(); - $this->assertCount(1, $arrayRichText); + self::assertCount(1, $arrayRichText); $oRichText = $arrayRichText[0]; - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); - $this->assertEquals('Show a family slide show', $oRichText->getText()); - $this->assertEquals(36, $oRichText->getFont()->getSize()); - $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); - $this->assertEquals('Calibri', $oRichText->getFont()->getName()); - $this->assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + self::assertEquals('Show a family slide show', $oRichText->getText()); + self::assertEquals(36, $oRichText->getFont()->getSize()); + self::assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + self::assertEquals('Calibri', $oRichText->getFont()->getName()); + self::assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); // Slide 3 : Shape 3 : Paragraph 4 $oParagraph = $arrayParagraphs[3]; - $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); - $this->assertFalse($oParagraph->getAlignment()->isRTL()); + self::assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); + self::assertFalse($oParagraph->getAlignment()->isRTL()); // $this->assertEquals(75, $oParagraph->getAlignment()->getMarginLeft()); // $this->assertEquals(-25, $oParagraph->getAlignment()->getIndent()); - $this->assertEquals(1, $oParagraph->getAlignment()->getLevel()); - $this->assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); + self::assertEquals(1, $oParagraph->getAlignment()->getLevel()); + self::assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); $arrayRichText = $oParagraph->getRichTextElements(); - $this->assertCount(1, $arrayRichText); + self::assertCount(1, $arrayRichText); $oRichText = $arrayRichText[0]; - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); - $this->assertEquals('...', $oRichText->getText()); - $this->assertEquals(36, $oRichText->getFont()->getSize()); - $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); - $this->assertEquals('Calibri', $oRichText->getFont()->getName()); - $this->assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + self::assertEquals('...', $oRichText->getText()); + self::assertEquals(36, $oRichText->getFont()->getSize()); + self::assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + self::assertEquals('Calibri', $oRichText->getFont()->getName()); + self::assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); // Slide 3 : Shape 3 : Paragraph 5 $oParagraph = $arrayParagraphs[4]; - $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); - $this->assertFalse($oParagraph->getAlignment()->isRTL()); + self::assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); + self::assertFalse($oParagraph->getAlignment()->isRTL()); // $this->assertEquals(25, $oParagraph->getAlignment()->getMarginLeft()); // $this->assertEquals(-25, $oParagraph->getAlignment()->getIndent()); - $this->assertEquals(0, $oParagraph->getAlignment()->getLevel()); - $this->assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); + self::assertEquals(0, $oParagraph->getAlignment()->getLevel()); + self::assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); $arrayRichText = $oParagraph->getRichTextElements(); - $this->assertCount(1, $arrayRichText); + self::assertCount(1, $arrayRichText); $oRichText = $arrayRichText[0]; - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); - $this->assertEquals('Export these to different formats', $oRichText->getText()); - $this->assertEquals(36, $oRichText->getFont()->getSize()); - $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); - $this->assertEquals('Calibri', $oRichText->getFont()->getName()); - $this->assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + self::assertEquals('Export these to different formats', $oRichText->getText()); + self::assertEquals(36, $oRichText->getFont()->getSize()); + self::assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + self::assertEquals('Calibri', $oRichText->getFont()->getName()); + self::assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); // Slide 3 : Shape 3 : Paragraph 6 $oParagraph = $arrayParagraphs[5]; - $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); - $this->assertFalse($oParagraph->getAlignment()->isRTL()); + self::assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); + self::assertFalse($oParagraph->getAlignment()->isRTL()); // $this->assertEquals(75, $oParagraph->getAlignment()->getMarginLeft()); // $this->assertEquals(-25, $oParagraph->getAlignment()->getIndent()); - $this->assertEquals(1, $oParagraph->getAlignment()->getLevel()); - $this->assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); + self::assertEquals(1, $oParagraph->getAlignment()->getLevel()); + self::assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); $arrayRichText = $oParagraph->getRichTextElements(); - $this->assertCount(1, $arrayRichText); + self::assertCount(1, $arrayRichText); $oRichText = $arrayRichText[0]; - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); - $this->assertEquals('PHPPresentation 2007', $oRichText->getText()); - $this->assertEquals(36, $oRichText->getFont()->getSize()); - $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); - $this->assertEquals('Calibri', $oRichText->getFont()->getName()); - $this->assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + self::assertEquals('PHPPresentation 2007', $oRichText->getText()); + self::assertEquals(36, $oRichText->getFont()->getSize()); + self::assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + self::assertEquals('Calibri', $oRichText->getFont()->getName()); + self::assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); // Slide 3 : Shape 3 : Paragraph 7 $oParagraph = $arrayParagraphs[6]; - $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); - $this->assertFalse($oParagraph->getAlignment()->isRTL()); + self::assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); + self::assertFalse($oParagraph->getAlignment()->isRTL()); // $this->assertEquals(75, $oParagraph->getAlignment()->getMarginLeft()); // $this->assertEquals(-25, $oParagraph->getAlignment()->getIndent()); - $this->assertEquals(1, $oParagraph->getAlignment()->getLevel()); - $this->assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); + self::assertEquals(1, $oParagraph->getAlignment()->getLevel()); + self::assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); $arrayRichText = $oParagraph->getRichTextElements(); - $this->assertCount(1, $arrayRichText); + self::assertCount(1, $arrayRichText); $oRichText = $arrayRichText[0]; - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); - $this->assertEquals('Serialized', $oRichText->getText()); - $this->assertEquals(36, $oRichText->getFont()->getSize()); - $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); - $this->assertEquals('Calibri', $oRichText->getFont()->getName()); - $this->assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + self::assertEquals('Serialized', $oRichText->getText()); + self::assertEquals(36, $oRichText->getFont()->getSize()); + self::assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + self::assertEquals('Calibri', $oRichText->getFont()->getName()); + self::assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); // Slide 3 : Shape 3 : Paragraph 8 $oParagraph = $arrayParagraphs[7]; - $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); - $this->assertFalse($oParagraph->getAlignment()->isRTL()); + self::assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); + self::assertFalse($oParagraph->getAlignment()->isRTL()); // $this->assertEquals(75, $oParagraph->getAlignment()->getMarginLeft()); // $this->assertEquals(-25, $oParagraph->getAlignment()->getIndent()); - $this->assertEquals(1, $oParagraph->getAlignment()->getLevel()); - $this->assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); + self::assertEquals(1, $oParagraph->getAlignment()->getLevel()); + self::assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); $arrayRichText = $oParagraph->getRichTextElements(); - $this->assertCount(1, $arrayRichText); + self::assertCount(1, $arrayRichText); $oRichText = $arrayRichText[0]; - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); - $this->assertEquals('... (more to come) ...', $oRichText->getText()); - $this->assertEquals(36, $oRichText->getFont()->getSize()); - $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); - $this->assertEquals('Calibri', $oRichText->getFont()->getName()); - $this->assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + self::assertEquals('... (more to come) ...', $oRichText->getText()); + self::assertEquals(36, $oRichText->getFont()->getSize()); + self::assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + self::assertEquals('Calibri', $oRichText->getFont()->getName()); + self::assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); // Slide 4 $oSlide3 = $oPhpPresentation->getSlide(3); $arrayShape = (array) $oSlide3->getShapeCollection(); - $this->assertCount(3, $arrayShape); + self::assertCount(3, $arrayShape); // Slide 4 : Shape 1 /** @var Gd $oShape */ $oShape = $arrayShape[0]; - $this->assertInstanceOf(Gd::class, $oShape); - $this->assertEquals('PHPPresentation logo', $oShape->getName()); - $this->assertEquals('PHPPresentation logo', $oShape->getDescription()); - $this->assertEquals(36, $oShape->getHeight()); - $this->assertEquals(10, $oShape->getOffsetX()); - $this->assertEquals(10, $oShape->getOffsetY()); - $this->assertEquals('image/png', $oShape->getMimeType()); - $this->assertTrue($oShape->getShadow()->isVisible()); - $this->assertEquals(45, $oShape->getShadow()->getDirection()); - $this->assertEquals(10, $oShape->getShadow()->getDistance()); + self::assertInstanceOf(Gd::class, $oShape); + self::assertEquals('PHPPresentation logo', $oShape->getName()); + self::assertEquals('PHPPresentation logo', $oShape->getDescription()); + self::assertEquals(36, $oShape->getHeight()); + self::assertEquals(10, $oShape->getOffsetX()); + self::assertEquals(10, $oShape->getOffsetY()); + self::assertEquals('image/png', $oShape->getMimeType()); + self::assertTrue($oShape->getShadow()->isVisible()); + self::assertEquals(45, $oShape->getShadow()->getDirection()); + self::assertEquals(10, $oShape->getShadow()->getDistance()); // Slide 4 : Shape 2 /** @var RichText $oShape */ $oShape = $arrayShape[1]; - $this->assertInstanceOf(RichText::class, $oShape); - $this->assertEquals(100, $oShape->getHeight()); - $this->assertEquals(930, $oShape->getWidth()); - $this->assertEquals(10, $oShape->getOffsetX()); - $this->assertEquals(50, $oShape->getOffsetY()); + self::assertInstanceOf(RichText::class, $oShape); + self::assertEquals(100, $oShape->getHeight()); + self::assertEquals(930, $oShape->getWidth()); + self::assertEquals(10, $oShape->getOffsetX()); + self::assertEquals(50, $oShape->getOffsetY()); $arrayParagraphs = $oShape->getParagraphs(); - $this->assertCount(1, $arrayParagraphs); + self::assertCount(1, $arrayParagraphs); $oParagraph = $arrayParagraphs[0]; - $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); - $this->assertFalse($oParagraph->getAlignment()->isRTL()); - $this->assertEquals(0, $oParagraph->getSpacingAfter()); - $this->assertEquals(0, $oParagraph->getSpacingBefore()); - $this->assertEquals(Paragraph::LINE_SPACING_MODE_PERCENT, $oParagraph->getLineSpacingMode()); - $this->assertEquals(100, $oParagraph->getLineSpacing()); + self::assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); + self::assertFalse($oParagraph->getAlignment()->isRTL()); + self::assertEquals(0, $oParagraph->getSpacingAfter()); + self::assertEquals(0, $oParagraph->getSpacingBefore()); + self::assertEquals(Paragraph::LINE_SPACING_MODE_PERCENT, $oParagraph->getLineSpacingMode()); + self::assertEquals(100, $oParagraph->getLineSpacing()); $arrayRichText = $oParagraph->getRichTextElements(); - $this->assertCount(1, $arrayRichText); + self::assertCount(1, $arrayRichText); // Slide 4 : Shape 2 : Paragraph 1 $oRichText = $arrayRichText[0]; - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); - $this->assertEquals('Need more info?', $oRichText->getText()); - $this->assertTrue($oRichText->getFont()->isBold()); - $this->assertEquals(48, $oRichText->getFont()->getSize()); - $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); - $this->assertEquals('Calibri', $oRichText->getFont()->getName()); - $this->assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + self::assertEquals('Need more info?', $oRichText->getText()); + self::assertTrue($oRichText->getFont()->isBold()); + self::assertEquals(48, $oRichText->getFont()->getSize()); + self::assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + self::assertEquals('Calibri', $oRichText->getFont()->getName()); + self::assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); // Slide 4 : Shape 3 /** @var RichText $oShape */ $oShape = $arrayShape[2]; - $this->assertInstanceOf(RichText::class, $oShape); - $this->assertEquals(600, $oShape->getHeight()); - $this->assertEquals(930, $oShape->getWidth()); - $this->assertEquals(10, $oShape->getOffsetX()); - $this->assertEquals(130, $oShape->getOffsetY()); + self::assertInstanceOf(RichText::class, $oShape); + self::assertEquals(600, $oShape->getHeight()); + self::assertEquals(930, $oShape->getWidth()); + self::assertEquals(10, $oShape->getOffsetX()); + self::assertEquals(130, $oShape->getOffsetY()); $arrayParagraphs = $oShape->getParagraphs(); - $this->assertCount(1, $arrayParagraphs); + self::assertCount(1, $arrayParagraphs); $oParagraph = $arrayParagraphs[0]; - $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); - $this->assertFalse($oParagraph->getAlignment()->isRTL()); - $this->assertEquals(0, $oParagraph->getSpacingAfter()); - $this->assertEquals(0, $oParagraph->getSpacingBefore()); - $this->assertEquals(Paragraph::LINE_SPACING_MODE_PERCENT, $oParagraph->getLineSpacingMode()); - $this->assertEquals(100, $oParagraph->getLineSpacing()); + self::assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); + self::assertFalse($oParagraph->getAlignment()->isRTL()); + self::assertEquals(0, $oParagraph->getSpacingAfter()); + self::assertEquals(0, $oParagraph->getSpacingBefore()); + self::assertEquals(Paragraph::LINE_SPACING_MODE_PERCENT, $oParagraph->getLineSpacingMode()); + self::assertEquals(100, $oParagraph->getLineSpacing()); $arrayRichText = $oParagraph->getRichTextElements(); - $this->assertCount(3, $arrayRichText); + self::assertCount(3, $arrayRichText); // Slide 4 : Shape 3 : Paragraph 1 $oRichText = $arrayRichText[0]; - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); - $this->assertEquals('Check the project site on GitHub:', $oRichText->getText()); - $this->assertFalse($oRichText->getFont()->isBold()); - $this->assertEquals(36, $oRichText->getFont()->getSize()); - $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); - $this->assertEquals('Calibri', $oRichText->getFont()->getName()); - $this->assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + self::assertEquals('Check the project site on GitHub:', $oRichText->getText()); + self::assertFalse($oRichText->getFont()->isBold()); + self::assertEquals(36, $oRichText->getFont()->getSize()); + self::assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + self::assertEquals('Calibri', $oRichText->getFont()->getName()); + self::assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); // Slide 4 : Shape 3 : Paragraph 2 $oRichText = $arrayRichText[1]; - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\BreakElement', $oRichText); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\BreakElement', $oRichText); // Slide 4 : Shape 3 : Paragraph 3 /** @var RichText\Run $oRichText */ $oRichText = $arrayRichText[2]; - $this->assertInstanceOf(RichText\Run::class, $oRichText); - $this->assertEquals('https://github.com/PHPOffice/PHPPresentation/', $oRichText->getText()); - $this->assertFalse($oRichText->getFont()->isBold()); - $this->assertEquals(32, $oRichText->getFont()->getSize()); - $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); - $this->assertEquals('Calibri', $oRichText->getFont()->getName()); - $this->assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); - $this->assertTrue($oRichText->hasHyperlink()); - $this->assertEquals('https://github.com/PHPOffice/PHPPresentation/', $oRichText->getHyperlink()->getUrl()); + self::assertInstanceOf(RichText\Run::class, $oRichText); + self::assertEquals('https://github.com/PHPOffice/PHPPresentation/', $oRichText->getText()); + self::assertFalse($oRichText->getFont()->isBold()); + self::assertEquals(32, $oRichText->getFont()->getSize()); + self::assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + self::assertEquals('Calibri', $oRichText->getFont()->getName()); + self::assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); + self::assertTrue($oRichText->hasHyperlink()); + self::assertEquals('https://github.com/PHPOffice/PHPPresentation/', $oRichText->getHyperlink()->getUrl()); //$this->assertEquals('PHPPresentation', $oRichText->getHyperlink()->getTooltip()); } @@ -572,11 +571,11 @@ public function testSlideName(): void $file = PHPPRESENTATION_TESTS_BASE_DIR . '/resources/files/ODP_Slide_Name.odp'; $object = new ODPresentation(); $oPhpPresentation = $object->load($file); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\PhpPresentation', $oPhpPresentation); - $this->assertIsArray($oPhpPresentation->getDocumentProperties()->getCustomProperties()); - $this->assertCount(0, $oPhpPresentation->getDocumentProperties()->getCustomProperties()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\PhpPresentation', $oPhpPresentation); + self::assertIsArray($oPhpPresentation->getDocumentProperties()->getCustomProperties()); + self::assertCount(0, $oPhpPresentation->getDocumentProperties()->getCustomProperties()); - $this->assertEquals('MaDiapo', $oPhpPresentation->getSlide(0)->getName()); + self::assertEquals('MaDiapo', $oPhpPresentation->getSlide(0)->getName()); } public function testIssue00141(): void @@ -584,28 +583,28 @@ public function testIssue00141(): void $file = PHPPRESENTATION_TESTS_BASE_DIR . '/resources/files/Issue_00141.odp'; $object = new ODPresentation(); $oPhpPresentation = $object->load($file); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\PhpPresentation', $oPhpPresentation); - $this->assertIsArray($oPhpPresentation->getDocumentProperties()->getCustomProperties()); - $this->assertCount(0, $oPhpPresentation->getDocumentProperties()->getCustomProperties()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\PhpPresentation', $oPhpPresentation); + self::assertIsArray($oPhpPresentation->getDocumentProperties()->getCustomProperties()); + self::assertCount(0, $oPhpPresentation->getDocumentProperties()->getCustomProperties()); - $this->assertCount(3, $oPhpPresentation->getAllSlides()); + self::assertCount(3, $oPhpPresentation->getAllSlides()); // Slide 1 $oSlide = $oPhpPresentation->getSlide(1); $arrayShape = (array) $oSlide->getShapeCollection(); - $this->assertCount(2, $arrayShape); + self::assertCount(2, $arrayShape); // Slide 1 : Shape 1 /** @var RichText $oShape */ $oShape = reset($arrayShape); - $this->assertInstanceOf(RichText::class, $oShape); + self::assertInstanceOf(RichText::class, $oShape); // Slide 1 : Shape 1 : Paragraph 1 $oParagraph = $oShape->getParagraph(); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Paragraph', $oParagraph); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Paragraph', $oParagraph); // Slide 1 : Shape 1 : Paragraph 1 : RichText Elements $arrayElements = $oParagraph->getRichTextElements(); - $this->assertCount(1, $arrayElements); + self::assertCount(1, $arrayElements); $oElement = reset($arrayElements); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\TextElement', $oElement); - $this->assertEquals('TEST IMAGE', $oElement->getText()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\TextElement', $oElement); + self::assertEquals('TEST IMAGE', $oElement->getText()); } } diff --git a/tests/PhpPresentation/Tests/Reader/PowerPoint2007Test.php b/tests/PhpPresentation/Tests/Reader/PowerPoint2007Test.php index dea2f7537..f90b7e788 100644 --- a/tests/PhpPresentation/Tests/Reader/PowerPoint2007Test.php +++ b/tests/PhpPresentation/Tests/Reader/PowerPoint2007Test.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -48,13 +47,13 @@ public function testCanRead(): void $object = new PowerPoint2007(); $file = PHPPRESENTATION_TESTS_BASE_DIR . '/resources/files/Sample_00_01.ppt'; - $this->assertFalse($object->canRead($file)); + self::assertFalse($object->canRead($file)); $file = PHPPRESENTATION_TESTS_BASE_DIR . '/resources/files/serialized.phppt'; - $this->assertFalse($object->canRead($file)); + self::assertFalse($object->canRead($file)); $file = PHPPRESENTATION_TESTS_BASE_DIR . '/resources/files/Sample_12.pptx'; - $this->assertTrue($object->canRead($file)); + self::assertTrue($object->canRead($file)); } public function testLoadFileNotExists(): void @@ -93,484 +92,484 @@ public function testLoadFile01(): void $file = PHPPRESENTATION_TESTS_BASE_DIR . '/resources/files/Sample_12.pptx'; $object = new PowerPoint2007(); $oPhpPresentation = $object->load($file); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\PhpPresentation', $oPhpPresentation); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\PhpPresentation', $oPhpPresentation); // Document Properties - $this->assertEquals('PHPOffice', $oPhpPresentation->getDocumentProperties()->getCreator()); - $this->assertEquals('PHPPresentation Team', $oPhpPresentation->getDocumentProperties()->getLastModifiedBy()); - $this->assertEquals('Sample 02 Title', $oPhpPresentation->getDocumentProperties()->getTitle()); - $this->assertEquals('Sample 02 Subject', $oPhpPresentation->getDocumentProperties()->getSubject()); - $this->assertEquals('Sample 02 Description', $oPhpPresentation->getDocumentProperties()->getDescription()); - $this->assertEquals('office 2007 openxml libreoffice odt php', $oPhpPresentation->getDocumentProperties()->getKeywords()); - $this->assertEquals('Sample Category', $oPhpPresentation->getDocumentProperties()->getCategory()); - $this->assertIsArray($oPhpPresentation->getDocumentProperties()->getCustomProperties()); - $this->assertCount(0, $oPhpPresentation->getDocumentProperties()->getCustomProperties()); + self::assertEquals('PHPOffice', $oPhpPresentation->getDocumentProperties()->getCreator()); + self::assertEquals('PHPPresentation Team', $oPhpPresentation->getDocumentProperties()->getLastModifiedBy()); + self::assertEquals('Sample 02 Title', $oPhpPresentation->getDocumentProperties()->getTitle()); + self::assertEquals('Sample 02 Subject', $oPhpPresentation->getDocumentProperties()->getSubject()); + self::assertEquals('Sample 02 Description', $oPhpPresentation->getDocumentProperties()->getDescription()); + self::assertEquals('office 2007 openxml libreoffice odt php', $oPhpPresentation->getDocumentProperties()->getKeywords()); + self::assertEquals('Sample Category', $oPhpPresentation->getDocumentProperties()->getCategory()); + self::assertIsArray($oPhpPresentation->getDocumentProperties()->getCustomProperties()); + self::assertCount(0, $oPhpPresentation->getDocumentProperties()->getCustomProperties()); // Presentation Properties - $this->assertEquals(PresentationProperties::SLIDESHOW_TYPE_PRESENT, $oPhpPresentation->getPresentationProperties()->getSlideshowType()); + self::assertEquals(PresentationProperties::SLIDESHOW_TYPE_PRESENT, $oPhpPresentation->getPresentationProperties()->getSlideshowType()); // Document Layout - $this->assertEquals(DocumentLayout::LAYOUT_SCREEN_4X3, $oPhpPresentation->getLayout()->getDocumentLayout()); - $this->assertEquals(254, $oPhpPresentation->getLayout()->getCX(DocumentLayout::UNIT_MILLIMETER)); - $this->assertEquals(190.5, $oPhpPresentation->getLayout()->getCY(DocumentLayout::UNIT_MILLIMETER)); + self::assertEquals(DocumentLayout::LAYOUT_SCREEN_4X3, $oPhpPresentation->getLayout()->getDocumentLayout()); + self::assertEquals(254, $oPhpPresentation->getLayout()->getCX(DocumentLayout::UNIT_MILLIMETER)); + self::assertEquals(190.5, $oPhpPresentation->getLayout()->getCY(DocumentLayout::UNIT_MILLIMETER)); // Slides - $this->assertCount(4, $oPhpPresentation->getAllSlides()); + self::assertCount(4, $oPhpPresentation->getAllSlides()); // Slide 1 $oSlide1 = $oPhpPresentation->getSlide(0); $arrayShape = (array) $oSlide1->getShapeCollection(); - $this->assertCount(2, $arrayShape); + self::assertCount(2, $arrayShape); // Slide 1 : Shape 1 /** @var Gd $oShape */ $oShape = $arrayShape[0]; - $this->assertInstanceOf(Gd::class, $oShape); - $this->assertEquals('PHPPresentation logo', $oShape->getName()); - $this->assertEquals('PHPPresentation logo', $oShape->getDescription()); - $this->assertEquals(36, $oShape->getHeight()); - $this->assertEquals(10, $oShape->getOffsetX()); - $this->assertEquals(10, $oShape->getOffsetY()); - $this->assertEquals('image/gif', $oShape->getMimeType()); - $this->assertTrue($oShape->getShadow()->isVisible()); - $this->assertEquals(45, $oShape->getShadow()->getDirection()); - $this->assertEquals(10, $oShape->getShadow()->getDistance()); + self::assertInstanceOf(Gd::class, $oShape); + self::assertEquals('PHPPresentation logo', $oShape->getName()); + self::assertEquals('PHPPresentation logo', $oShape->getDescription()); + self::assertEquals(36, $oShape->getHeight()); + self::assertEquals(10, $oShape->getOffsetX()); + self::assertEquals(10, $oShape->getOffsetY()); + self::assertEquals('image/gif', $oShape->getMimeType()); + self::assertTrue($oShape->getShadow()->isVisible()); + self::assertEquals(45, $oShape->getShadow()->getDirection()); + self::assertEquals(10, $oShape->getShadow()->getDistance()); // Slide 1 : Shape 2 /** @var RichText $oShape */ $oShape = $arrayShape[1]; - $this->assertInstanceOf(RichText::class, $oShape); - $this->assertEquals(200, $oShape->getHeight()); - $this->assertEquals(600, $oShape->getWidth()); - $this->assertEquals(10, $oShape->getOffsetX()); - $this->assertEquals(400, $oShape->getOffsetY()); + self::assertInstanceOf(RichText::class, $oShape); + self::assertEquals(200, $oShape->getHeight()); + self::assertEquals(600, $oShape->getWidth()); + self::assertEquals(10, $oShape->getOffsetX()); + self::assertEquals(400, $oShape->getOffsetY()); $arrayParagraphs = $oShape->getParagraphs(); - $this->assertCount(1, $arrayParagraphs); + self::assertCount(1, $arrayParagraphs); $oParagraph = $arrayParagraphs[0]; - $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); - $this->assertFalse($oParagraph->getAlignment()->isRTL()); - $this->assertEquals(0, $oParagraph->getSpacingAfter()); - $this->assertEquals(0, $oParagraph->getSpacingBefore()); - $this->assertEquals(Paragraph::LINE_SPACING_MODE_PERCENT, $oParagraph->getLineSpacingMode()); - $this->assertEquals(100, $oParagraph->getLineSpacing()); + self::assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); + self::assertFalse($oParagraph->getAlignment()->isRTL()); + self::assertEquals(0, $oParagraph->getSpacingAfter()); + self::assertEquals(0, $oParagraph->getSpacingBefore()); + self::assertEquals(Paragraph::LINE_SPACING_MODE_PERCENT, $oParagraph->getLineSpacingMode()); + self::assertEquals(100, $oParagraph->getLineSpacing()); $arrayRichText = $oParagraph->getRichTextElements(); - $this->assertCount(3, $arrayRichText); + self::assertCount(3, $arrayRichText); // Slide 1 : Shape 2 : Paragraph 1 $oRichText = $arrayRichText[0]; - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); - $this->assertEquals('Introduction to', $oRichText->getText()); - $this->assertTrue($oRichText->getFont()->isBold()); - $this->assertEquals(28, $oRichText->getFont()->getSize()); - $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); - $this->assertEquals('Calibri', $oRichText->getFont()->getName()); - $this->assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + self::assertEquals('Introduction to', $oRichText->getText()); + self::assertTrue($oRichText->getFont()->isBold()); + self::assertEquals(28, $oRichText->getFont()->getSize()); + self::assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + self::assertEquals('Calibri', $oRichText->getFont()->getName()); + self::assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); // Slide 1 : Shape 2 : Paragraph 2 $oRichText = $arrayRichText[1]; - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\BreakElement', $oRichText); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\BreakElement', $oRichText); // Slide 1 : Shape 2 : Paragraph 3 $oRichText = $arrayRichText[2]; - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); - $this->assertEquals('PHPPresentation', $oRichText->getText()); - $this->assertTrue($oRichText->getFont()->isBold()); - $this->assertEquals(60, $oRichText->getFont()->getSize()); - $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); - $this->assertEquals('Calibri', $oRichText->getFont()->getName()); - $this->assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + self::assertEquals('PHPPresentation', $oRichText->getText()); + self::assertTrue($oRichText->getFont()->isBold()); + self::assertEquals(60, $oRichText->getFont()->getSize()); + self::assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + self::assertEquals('Calibri', $oRichText->getFont()->getName()); + self::assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); // Slide 2 $oSlide2 = $oPhpPresentation->getSlide(1); $arrayShape = (array) $oSlide2->getShapeCollection(); - $this->assertCount(3, $arrayShape); + self::assertCount(3, $arrayShape); // Slide 2 : Shape 1 /** @var Gd $oShape */ $oShape = $arrayShape[0]; - $this->assertInstanceOf(Gd::class, $oShape); - $this->assertEquals('PHPPresentation logo', $oShape->getName()); - $this->assertEquals('PHPPresentation logo', $oShape->getDescription()); - $this->assertEquals(36, $oShape->getHeight()); - $this->assertEquals(10, $oShape->getOffsetX()); - $this->assertEquals(10, $oShape->getOffsetY()); - $this->assertEquals('image/gif', $oShape->getMimeType()); - $this->assertTrue($oShape->getShadow()->isVisible()); - $this->assertEquals(45, $oShape->getShadow()->getDirection()); - $this->assertEquals(10, $oShape->getShadow()->getDistance()); + self::assertInstanceOf(Gd::class, $oShape); + self::assertEquals('PHPPresentation logo', $oShape->getName()); + self::assertEquals('PHPPresentation logo', $oShape->getDescription()); + self::assertEquals(36, $oShape->getHeight()); + self::assertEquals(10, $oShape->getOffsetX()); + self::assertEquals(10, $oShape->getOffsetY()); + self::assertEquals('image/gif', $oShape->getMimeType()); + self::assertTrue($oShape->getShadow()->isVisible()); + self::assertEquals(45, $oShape->getShadow()->getDirection()); + self::assertEquals(10, $oShape->getShadow()->getDistance()); // Slide 2 : Shape 2 /** @var RichText $oShape */ $oShape = $arrayShape[1]; - $this->assertInstanceOf(RichText::class, $oShape); - $this->assertEquals(100, $oShape->getHeight()); - $this->assertEquals(930, $oShape->getWidth()); - $this->assertEquals(10, $oShape->getOffsetX()); - $this->assertEquals(50, $oShape->getOffsetY()); + self::assertInstanceOf(RichText::class, $oShape); + self::assertEquals(100, $oShape->getHeight()); + self::assertEquals(930, $oShape->getWidth()); + self::assertEquals(10, $oShape->getOffsetX()); + self::assertEquals(50, $oShape->getOffsetY()); $arrayParagraphs = $oShape->getParagraphs(); - $this->assertCount(1, $arrayParagraphs); + self::assertCount(1, $arrayParagraphs); $oParagraph = $arrayParagraphs[0]; - $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); - $this->assertFalse($oParagraph->getAlignment()->isRTL()); + self::assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); + self::assertFalse($oParagraph->getAlignment()->isRTL()); $arrayRichText = $oParagraph->getRichTextElements(); - $this->assertCount(1, $arrayRichText); + self::assertCount(1, $arrayRichText); // Slide 2 : Shape 2 : Paragraph 1 $oRichText = $arrayRichText[0]; - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); - $this->assertEquals('What is PHPPresentation?', $oRichText->getText()); - $this->assertTrue($oRichText->getFont()->isBold()); - $this->assertEquals(48, $oRichText->getFont()->getSize()); - $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); - $this->assertEquals('Calibri', $oRichText->getFont()->getName()); - $this->assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + self::assertEquals('What is PHPPresentation?', $oRichText->getText()); + self::assertTrue($oRichText->getFont()->isBold()); + self::assertEquals(48, $oRichText->getFont()->getSize()); + self::assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + self::assertEquals('Calibri', $oRichText->getFont()->getName()); + self::assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); // Slide 2 : Shape 3 /** @var RichText $oShape */ $oShape = $arrayShape[2]; - $this->assertInstanceOf(RichText::class, $oShape); - $this->assertEquals(600, $oShape->getHeight()); - $this->assertEquals(930, $oShape->getWidth()); - $this->assertEquals(10, $oShape->getOffsetX()); - $this->assertEquals(130, $oShape->getOffsetY()); + self::assertInstanceOf(RichText::class, $oShape); + self::assertEquals(600, $oShape->getHeight()); + self::assertEquals(930, $oShape->getWidth()); + self::assertEquals(10, $oShape->getOffsetX()); + self::assertEquals(130, $oShape->getOffsetY()); $arrayParagraphs = $oShape->getParagraphs(); - $this->assertCount(4, $arrayParagraphs); + self::assertCount(4, $arrayParagraphs); // Slide 2 : Shape 3 : Paragraph 1 $oParagraph = $arrayParagraphs[0]; - $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); - $this->assertEquals(25, $oParagraph->getAlignment()->getMarginLeft()); - $this->assertEquals(-25, $oParagraph->getAlignment()->getIndent()); - $this->assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); - $this->assertFalse($oParagraph->getAlignment()->isRTL()); + self::assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); + self::assertEquals(25, $oParagraph->getAlignment()->getMarginLeft()); + self::assertEquals(-25, $oParagraph->getAlignment()->getIndent()); + self::assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); + self::assertFalse($oParagraph->getAlignment()->isRTL()); $arrayRichText = $oParagraph->getRichTextElements(); - $this->assertCount(1, $arrayRichText); + self::assertCount(1, $arrayRichText); $oRichText = $arrayRichText[0]; - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); - $this->assertEquals('A class library', $oRichText->getText()); - $this->assertEquals(36, $oRichText->getFont()->getSize()); - $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); - $this->assertEquals('Calibri', $oRichText->getFont()->getName()); - $this->assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + self::assertEquals('A class library', $oRichText->getText()); + self::assertEquals(36, $oRichText->getFont()->getSize()); + self::assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + self::assertEquals('Calibri', $oRichText->getFont()->getName()); + self::assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); // Slide 2 : Shape 3 : Paragraph 2 $oParagraph = $arrayParagraphs[1]; - $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); - $this->assertEquals(25, $oParagraph->getAlignment()->getMarginLeft()); - $this->assertEquals(-25, $oParagraph->getAlignment()->getIndent()); - $this->assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); - $this->assertFalse($oParagraph->getAlignment()->isRTL()); + self::assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); + self::assertEquals(25, $oParagraph->getAlignment()->getMarginLeft()); + self::assertEquals(-25, $oParagraph->getAlignment()->getIndent()); + self::assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); + self::assertFalse($oParagraph->getAlignment()->isRTL()); $arrayRichText = $oParagraph->getRichTextElements(); - $this->assertCount(1, $arrayRichText); + self::assertCount(1, $arrayRichText); $oRichText = $arrayRichText[0]; - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); - $this->assertEquals('Written in PHP', $oRichText->getText()); - $this->assertEquals(36, $oRichText->getFont()->getSize()); - $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); - $this->assertEquals('Calibri', $oRichText->getFont()->getName()); - $this->assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + self::assertEquals('Written in PHP', $oRichText->getText()); + self::assertEquals(36, $oRichText->getFont()->getSize()); + self::assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + self::assertEquals('Calibri', $oRichText->getFont()->getName()); + self::assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); // Slide 2 : Shape 3 : Paragraph 3 $oParagraph = $arrayParagraphs[2]; - $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); - $this->assertEquals(25, $oParagraph->getAlignment()->getMarginLeft()); - $this->assertEquals(-25, $oParagraph->getAlignment()->getIndent()); - $this->assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); - $this->assertFalse($oParagraph->getAlignment()->isRTL()); + self::assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); + self::assertEquals(25, $oParagraph->getAlignment()->getMarginLeft()); + self::assertEquals(-25, $oParagraph->getAlignment()->getIndent()); + self::assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); + self::assertFalse($oParagraph->getAlignment()->isRTL()); $arrayRichText = $oParagraph->getRichTextElements(); - $this->assertCount(1, $arrayRichText); + self::assertCount(1, $arrayRichText); $oRichText = $arrayRichText[0]; - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); - $this->assertEquals('Representing a presentation', $oRichText->getText()); - $this->assertEquals(36, $oRichText->getFont()->getSize()); - $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); - $this->assertEquals('Calibri', $oRichText->getFont()->getName()); - $this->assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + self::assertEquals('Representing a presentation', $oRichText->getText()); + self::assertEquals(36, $oRichText->getFont()->getSize()); + self::assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + self::assertEquals('Calibri', $oRichText->getFont()->getName()); + self::assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); // Slide 2 : Shape 3 : Paragraph 4 $oParagraph = $arrayParagraphs[3]; - $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); - $this->assertEquals(25, $oParagraph->getAlignment()->getMarginLeft()); - $this->assertEquals(-25, $oParagraph->getAlignment()->getIndent()); - $this->assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); - $this->assertFalse($oParagraph->getAlignment()->isRTL()); + self::assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); + self::assertEquals(25, $oParagraph->getAlignment()->getMarginLeft()); + self::assertEquals(-25, $oParagraph->getAlignment()->getIndent()); + self::assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); + self::assertFalse($oParagraph->getAlignment()->isRTL()); $arrayRichText = $oParagraph->getRichTextElements(); - $this->assertCount(1, $arrayRichText); + self::assertCount(1, $arrayRichText); $oRichText = $arrayRichText[0]; - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); - $this->assertEquals('Supports writing to different file formats', $oRichText->getText()); - $this->assertEquals(36, $oRichText->getFont()->getSize()); - $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); - $this->assertEquals('Calibri', $oRichText->getFont()->getName()); - $this->assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + self::assertEquals('Supports writing to different file formats', $oRichText->getText()); + self::assertEquals(36, $oRichText->getFont()->getSize()); + self::assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + self::assertEquals('Calibri', $oRichText->getFont()->getName()); + self::assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); // Slide 3 $oSlide2 = $oPhpPresentation->getSlide(2); $arrayShape = (array) $oSlide2->getShapeCollection(); - $this->assertCount(3, $arrayShape); + self::assertCount(3, $arrayShape); // Slide 3 : Shape 1 /** @var Gd $oShape */ $oShape = $arrayShape[0]; - $this->assertInstanceOf(Gd::class, $oShape); - $this->assertEquals('PHPPresentation logo', $oShape->getName()); - $this->assertEquals('PHPPresentation logo', $oShape->getDescription()); - $this->assertEquals(36, $oShape->getHeight()); - $this->assertEquals(10, $oShape->getOffsetX()); - $this->assertEquals(10, $oShape->getOffsetY()); - $this->assertEquals('image/gif', $oShape->getMimeType()); - $this->assertTrue($oShape->getShadow()->isVisible()); - $this->assertEquals(45, $oShape->getShadow()->getDirection()); - $this->assertEquals(10, $oShape->getShadow()->getDistance()); + self::assertInstanceOf(Gd::class, $oShape); + self::assertEquals('PHPPresentation logo', $oShape->getName()); + self::assertEquals('PHPPresentation logo', $oShape->getDescription()); + self::assertEquals(36, $oShape->getHeight()); + self::assertEquals(10, $oShape->getOffsetX()); + self::assertEquals(10, $oShape->getOffsetY()); + self::assertEquals('image/gif', $oShape->getMimeType()); + self::assertTrue($oShape->getShadow()->isVisible()); + self::assertEquals(45, $oShape->getShadow()->getDirection()); + self::assertEquals(10, $oShape->getShadow()->getDistance()); // Slide 3 : Shape 2 /** @var RichText $oShape */ $oShape = $arrayShape[1]; - $this->assertInstanceOf(RichText::class, $oShape); - $this->assertEquals(100, $oShape->getHeight()); - $this->assertEquals(930, $oShape->getWidth()); - $this->assertEquals(10, $oShape->getOffsetX()); - $this->assertEquals(50, $oShape->getOffsetY()); + self::assertInstanceOf(RichText::class, $oShape); + self::assertEquals(100, $oShape->getHeight()); + self::assertEquals(930, $oShape->getWidth()); + self::assertEquals(10, $oShape->getOffsetX()); + self::assertEquals(50, $oShape->getOffsetY()); $arrayParagraphs = $oShape->getParagraphs(); - $this->assertCount(1, $arrayParagraphs); + self::assertCount(1, $arrayParagraphs); $oParagraph = $arrayParagraphs[0]; - $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); - $this->assertFalse($oParagraph->getAlignment()->isRTL()); - $this->assertEquals(0, $oParagraph->getSpacingAfter()); - $this->assertEquals(0, $oParagraph->getSpacingBefore()); - $this->assertEquals(Paragraph::LINE_SPACING_MODE_PERCENT, $oParagraph->getLineSpacingMode()); - $this->assertEquals(100, $oParagraph->getLineSpacing()); + self::assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); + self::assertFalse($oParagraph->getAlignment()->isRTL()); + self::assertEquals(0, $oParagraph->getSpacingAfter()); + self::assertEquals(0, $oParagraph->getSpacingBefore()); + self::assertEquals(Paragraph::LINE_SPACING_MODE_PERCENT, $oParagraph->getLineSpacingMode()); + self::assertEquals(100, $oParagraph->getLineSpacing()); $arrayRichText = $oParagraph->getRichTextElements(); - $this->assertCount(1, $arrayRichText); + self::assertCount(1, $arrayRichText); // Slide 3 : Shape 2 : Paragraph 1 $oRichText = $arrayRichText[0]; - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); - $this->assertEquals('What\'s the point?', $oRichText->getText()); - $this->assertTrue($oRichText->getFont()->isBold()); - $this->assertEquals(48, $oRichText->getFont()->getSize()); - $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); - $this->assertEquals('Calibri', $oRichText->getFont()->getName()); - $this->assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + self::assertEquals('What\'s the point?', $oRichText->getText()); + self::assertTrue($oRichText->getFont()->isBold()); + self::assertEquals(48, $oRichText->getFont()->getSize()); + self::assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + self::assertEquals('Calibri', $oRichText->getFont()->getName()); + self::assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); // Slide 3 : Shape 2 /** @var RichText $oShape */ $oShape = $arrayShape[2]; - $this->assertInstanceOf(RichText::class, $oShape); - $this->assertEquals(600, $oShape->getHeight()); - $this->assertEquals(930, $oShape->getWidth()); - $this->assertEquals(10, $oShape->getOffsetX()); - $this->assertEquals(130, $oShape->getOffsetY()); + self::assertInstanceOf(RichText::class, $oShape); + self::assertEquals(600, $oShape->getHeight()); + self::assertEquals(930, $oShape->getWidth()); + self::assertEquals(10, $oShape->getOffsetX()); + self::assertEquals(130, $oShape->getOffsetY()); $arrayParagraphs = $oShape->getParagraphs(); - $this->assertCount(8, $arrayParagraphs); + self::assertCount(8, $arrayParagraphs); // Slide 3 : Shape 3 : Paragraph 1 $oParagraph = $arrayParagraphs[0]; - $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); - $this->assertEquals(25, $oParagraph->getAlignment()->getMarginLeft()); - $this->assertEquals(-25, $oParagraph->getAlignment()->getIndent()); - $this->assertEquals(0, $oParagraph->getAlignment()->getLevel()); - $this->assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); - $this->assertFalse($oParagraph->getAlignment()->isRTL()); + self::assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); + self::assertEquals(25, $oParagraph->getAlignment()->getMarginLeft()); + self::assertEquals(-25, $oParagraph->getAlignment()->getIndent()); + self::assertEquals(0, $oParagraph->getAlignment()->getLevel()); + self::assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); + self::assertFalse($oParagraph->getAlignment()->isRTL()); $arrayRichText = $oParagraph->getRichTextElements(); - $this->assertCount(1, $arrayRichText); + self::assertCount(1, $arrayRichText); $oRichText = $arrayRichText[0]; - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); - $this->assertEquals('Generate slide decks', $oRichText->getText()); - $this->assertEquals(36, $oRichText->getFont()->getSize()); - $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); - $this->assertEquals('Calibri', $oRichText->getFont()->getName()); - $this->assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + self::assertEquals('Generate slide decks', $oRichText->getText()); + self::assertEquals(36, $oRichText->getFont()->getSize()); + self::assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + self::assertEquals('Calibri', $oRichText->getFont()->getName()); + self::assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); // Slide 3 : Shape 3 : Paragraph 2 $oParagraph = $arrayParagraphs[1]; - $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); - $this->assertEquals(75, $oParagraph->getAlignment()->getMarginLeft()); - $this->assertEquals(-25, $oParagraph->getAlignment()->getIndent()); - $this->assertEquals(1, $oParagraph->getAlignment()->getLevel()); - $this->assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); - $this->assertFalse($oParagraph->getAlignment()->isRTL()); + self::assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); + self::assertEquals(75, $oParagraph->getAlignment()->getMarginLeft()); + self::assertEquals(-25, $oParagraph->getAlignment()->getIndent()); + self::assertEquals(1, $oParagraph->getAlignment()->getLevel()); + self::assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); + self::assertFalse($oParagraph->getAlignment()->isRTL()); $arrayRichText = $oParagraph->getRichTextElements(); - $this->assertCount(1, $arrayRichText); + self::assertCount(1, $arrayRichText); $oRichText = $arrayRichText[0]; - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); - $this->assertEquals('Represent business data', $oRichText->getText()); - $this->assertEquals(36, $oRichText->getFont()->getSize()); - $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); - $this->assertEquals('Calibri', $oRichText->getFont()->getName()); - $this->assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + self::assertEquals('Represent business data', $oRichText->getText()); + self::assertEquals(36, $oRichText->getFont()->getSize()); + self::assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + self::assertEquals('Calibri', $oRichText->getFont()->getName()); + self::assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); // Slide 3 : Shape 3 : Paragraph 3 $oParagraph = $arrayParagraphs[2]; - $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); - $this->assertEquals(75, $oParagraph->getAlignment()->getMarginLeft()); - $this->assertEquals(-25, $oParagraph->getAlignment()->getIndent()); - $this->assertEquals(1, $oParagraph->getAlignment()->getLevel()); - $this->assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); - $this->assertFalse($oParagraph->getAlignment()->isRTL()); + self::assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); + self::assertEquals(75, $oParagraph->getAlignment()->getMarginLeft()); + self::assertEquals(-25, $oParagraph->getAlignment()->getIndent()); + self::assertEquals(1, $oParagraph->getAlignment()->getLevel()); + self::assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); + self::assertFalse($oParagraph->getAlignment()->isRTL()); $arrayRichText = $oParagraph->getRichTextElements(); - $this->assertCount(1, $arrayRichText); + self::assertCount(1, $arrayRichText); $oRichText = $arrayRichText[0]; - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); - $this->assertEquals('Show a family slide show', $oRichText->getText()); - $this->assertEquals(36, $oRichText->getFont()->getSize()); - $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); - $this->assertEquals('Calibri', $oRichText->getFont()->getName()); - $this->assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + self::assertEquals('Show a family slide show', $oRichText->getText()); + self::assertEquals(36, $oRichText->getFont()->getSize()); + self::assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + self::assertEquals('Calibri', $oRichText->getFont()->getName()); + self::assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); // Slide 3 : Shape 3 : Paragraph 4 $oParagraph = $arrayParagraphs[3]; - $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); - $this->assertEquals(75, $oParagraph->getAlignment()->getMarginLeft()); - $this->assertEquals(-25, $oParagraph->getAlignment()->getIndent()); - $this->assertEquals(1, $oParagraph->getAlignment()->getLevel()); - $this->assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); - $this->assertFalse($oParagraph->getAlignment()->isRTL()); + self::assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); + self::assertEquals(75, $oParagraph->getAlignment()->getMarginLeft()); + self::assertEquals(-25, $oParagraph->getAlignment()->getIndent()); + self::assertEquals(1, $oParagraph->getAlignment()->getLevel()); + self::assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); + self::assertFalse($oParagraph->getAlignment()->isRTL()); $arrayRichText = $oParagraph->getRichTextElements(); - $this->assertCount(1, $arrayRichText); + self::assertCount(1, $arrayRichText); $oRichText = $arrayRichText[0]; - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); - $this->assertEquals('...', $oRichText->getText()); - $this->assertEquals(36, $oRichText->getFont()->getSize()); - $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); - $this->assertEquals('Calibri', $oRichText->getFont()->getName()); - $this->assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + self::assertEquals('...', $oRichText->getText()); + self::assertEquals(36, $oRichText->getFont()->getSize()); + self::assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + self::assertEquals('Calibri', $oRichText->getFont()->getName()); + self::assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); // Slide 3 : Shape 3 : Paragraph 5 $oParagraph = $arrayParagraphs[4]; - $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); - $this->assertEquals(25, $oParagraph->getAlignment()->getMarginLeft()); - $this->assertEquals(-25, $oParagraph->getAlignment()->getIndent()); - $this->assertEquals(0, $oParagraph->getAlignment()->getLevel()); - $this->assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); - $this->assertFalse($oParagraph->getAlignment()->isRTL()); + self::assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); + self::assertEquals(25, $oParagraph->getAlignment()->getMarginLeft()); + self::assertEquals(-25, $oParagraph->getAlignment()->getIndent()); + self::assertEquals(0, $oParagraph->getAlignment()->getLevel()); + self::assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); + self::assertFalse($oParagraph->getAlignment()->isRTL()); $arrayRichText = $oParagraph->getRichTextElements(); - $this->assertCount(1, $arrayRichText); + self::assertCount(1, $arrayRichText); $oRichText = $arrayRichText[0]; - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); - $this->assertEquals('Export these to different formats', $oRichText->getText()); - $this->assertEquals(36, $oRichText->getFont()->getSize()); - $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); - $this->assertEquals('Calibri', $oRichText->getFont()->getName()); - $this->assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + self::assertEquals('Export these to different formats', $oRichText->getText()); + self::assertEquals(36, $oRichText->getFont()->getSize()); + self::assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + self::assertEquals('Calibri', $oRichText->getFont()->getName()); + self::assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); // Slide 3 : Shape 3 : Paragraph 6 $oParagraph = $arrayParagraphs[5]; - $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); - $this->assertEquals(75, $oParagraph->getAlignment()->getMarginLeft()); - $this->assertEquals(-25, $oParagraph->getAlignment()->getIndent()); - $this->assertEquals(1, $oParagraph->getAlignment()->getLevel()); - $this->assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); - $this->assertFalse($oParagraph->getAlignment()->isRTL()); + self::assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); + self::assertEquals(75, $oParagraph->getAlignment()->getMarginLeft()); + self::assertEquals(-25, $oParagraph->getAlignment()->getIndent()); + self::assertEquals(1, $oParagraph->getAlignment()->getLevel()); + self::assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); + self::assertFalse($oParagraph->getAlignment()->isRTL()); $arrayRichText = $oParagraph->getRichTextElements(); - $this->assertCount(1, $arrayRichText); + self::assertCount(1, $arrayRichText); $oRichText = $arrayRichText[0]; - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); - $this->assertEquals('PHPPresentation 2007', $oRichText->getText()); - $this->assertEquals(36, $oRichText->getFont()->getSize()); - $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); - $this->assertEquals('Calibri', $oRichText->getFont()->getName()); - $this->assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + self::assertEquals('PHPPresentation 2007', $oRichText->getText()); + self::assertEquals(36, $oRichText->getFont()->getSize()); + self::assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + self::assertEquals('Calibri', $oRichText->getFont()->getName()); + self::assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); // Slide 3 : Shape 3 : Paragraph 7 $oParagraph = $arrayParagraphs[6]; - $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); - $this->assertEquals(75, $oParagraph->getAlignment()->getMarginLeft()); - $this->assertEquals(-25, $oParagraph->getAlignment()->getIndent()); - $this->assertEquals(1, $oParagraph->getAlignment()->getLevel()); - $this->assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); - $this->assertFalse($oParagraph->getAlignment()->isRTL()); + self::assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); + self::assertEquals(75, $oParagraph->getAlignment()->getMarginLeft()); + self::assertEquals(-25, $oParagraph->getAlignment()->getIndent()); + self::assertEquals(1, $oParagraph->getAlignment()->getLevel()); + self::assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); + self::assertFalse($oParagraph->getAlignment()->isRTL()); $arrayRichText = $oParagraph->getRichTextElements(); - $this->assertCount(1, $arrayRichText); + self::assertCount(1, $arrayRichText); $oRichText = $arrayRichText[0]; - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); - $this->assertEquals('Serialized', $oRichText->getText()); - $this->assertEquals(36, $oRichText->getFont()->getSize()); - $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); - $this->assertEquals('Calibri', $oRichText->getFont()->getName()); - $this->assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + self::assertEquals('Serialized', $oRichText->getText()); + self::assertEquals(36, $oRichText->getFont()->getSize()); + self::assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + self::assertEquals('Calibri', $oRichText->getFont()->getName()); + self::assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); // Slide 3 : Shape 3 : Paragraph 8 $oParagraph = $arrayParagraphs[7]; - $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); - $this->assertEquals(75, $oParagraph->getAlignment()->getMarginLeft()); - $this->assertEquals(-25, $oParagraph->getAlignment()->getIndent()); - $this->assertEquals(1, $oParagraph->getAlignment()->getLevel()); - $this->assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); - $this->assertFalse($oParagraph->getAlignment()->isRTL()); + self::assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); + self::assertEquals(75, $oParagraph->getAlignment()->getMarginLeft()); + self::assertEquals(-25, $oParagraph->getAlignment()->getIndent()); + self::assertEquals(1, $oParagraph->getAlignment()->getLevel()); + self::assertEquals(Bullet::TYPE_BULLET, $oParagraph->getBulletStyle()->getBulletType()); + self::assertFalse($oParagraph->getAlignment()->isRTL()); $arrayRichText = $oParagraph->getRichTextElements(); - $this->assertCount(1, $arrayRichText); + self::assertCount(1, $arrayRichText); $oRichText = $arrayRichText[0]; - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); - $this->assertEquals('... (more to come) ...', $oRichText->getText()); - $this->assertEquals(36, $oRichText->getFont()->getSize()); - $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); - $this->assertEquals('Calibri', $oRichText->getFont()->getName()); - $this->assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + self::assertEquals('... (more to come) ...', $oRichText->getText()); + self::assertEquals(36, $oRichText->getFont()->getSize()); + self::assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + self::assertEquals('Calibri', $oRichText->getFont()->getName()); + self::assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); // Slide 4 $oSlide3 = $oPhpPresentation->getSlide(3); $arrayShape = (array) $oSlide3->getShapeCollection(); - $this->assertCount(3, $arrayShape); + self::assertCount(3, $arrayShape); // Slide 4 : Shape 1 /** @var Gd $oShape */ $oShape = $arrayShape[0]; - $this->assertInstanceOf(Gd::class, $oShape); - $this->assertEquals('PHPPresentation logo', $oShape->getName()); - $this->assertEquals('PHPPresentation logo', $oShape->getDescription()); - $this->assertEquals(36, $oShape->getHeight()); - $this->assertEquals(10, $oShape->getOffsetX()); - $this->assertEquals(10, $oShape->getOffsetY()); - $this->assertEquals('image/gif', $oShape->getMimeType()); - $this->assertTrue($oShape->getShadow()->isVisible()); - $this->assertEquals(45, $oShape->getShadow()->getDirection()); - $this->assertEquals(10, $oShape->getShadow()->getDistance()); + self::assertInstanceOf(Gd::class, $oShape); + self::assertEquals('PHPPresentation logo', $oShape->getName()); + self::assertEquals('PHPPresentation logo', $oShape->getDescription()); + self::assertEquals(36, $oShape->getHeight()); + self::assertEquals(10, $oShape->getOffsetX()); + self::assertEquals(10, $oShape->getOffsetY()); + self::assertEquals('image/gif', $oShape->getMimeType()); + self::assertTrue($oShape->getShadow()->isVisible()); + self::assertEquals(45, $oShape->getShadow()->getDirection()); + self::assertEquals(10, $oShape->getShadow()->getDistance()); // Slide 4 : Shape 2 /** @var RichText $oShape */ $oShape = $arrayShape[1]; - $this->assertInstanceOf(RichText::class, $oShape); - $this->assertEquals(100, $oShape->getHeight()); - $this->assertEquals(930, $oShape->getWidth()); - $this->assertEquals(10, $oShape->getOffsetX()); - $this->assertEquals(50, $oShape->getOffsetY()); + self::assertInstanceOf(RichText::class, $oShape); + self::assertEquals(100, $oShape->getHeight()); + self::assertEquals(930, $oShape->getWidth()); + self::assertEquals(10, $oShape->getOffsetX()); + self::assertEquals(50, $oShape->getOffsetY()); $arrayParagraphs = $oShape->getParagraphs(); - $this->assertCount(1, $arrayParagraphs); + self::assertCount(1, $arrayParagraphs); $oParagraph = $arrayParagraphs[0]; - $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); - $this->assertFalse($oParagraph->getAlignment()->isRTL()); - $this->assertEquals(0, $oParagraph->getSpacingAfter()); - $this->assertEquals(0, $oParagraph->getSpacingBefore()); - $this->assertEquals(Paragraph::LINE_SPACING_MODE_PERCENT, $oParagraph->getLineSpacingMode()); - $this->assertEquals(100, $oParagraph->getLineSpacing()); + self::assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); + self::assertFalse($oParagraph->getAlignment()->isRTL()); + self::assertEquals(0, $oParagraph->getSpacingAfter()); + self::assertEquals(0, $oParagraph->getSpacingBefore()); + self::assertEquals(Paragraph::LINE_SPACING_MODE_PERCENT, $oParagraph->getLineSpacingMode()); + self::assertEquals(100, $oParagraph->getLineSpacing()); $arrayRichText = $oParagraph->getRichTextElements(); - $this->assertCount(1, $arrayRichText); + self::assertCount(1, $arrayRichText); // Slide 4 : Shape 2 : Paragraph 1 $oRichText = $arrayRichText[0]; - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); - $this->assertEquals('Need more info?', $oRichText->getText()); - $this->assertTrue($oRichText->getFont()->isBold()); - $this->assertEquals(48, $oRichText->getFont()->getSize()); - $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); - $this->assertEquals('Calibri', $oRichText->getFont()->getName()); - $this->assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + self::assertEquals('Need more info?', $oRichText->getText()); + self::assertTrue($oRichText->getFont()->isBold()); + self::assertEquals(48, $oRichText->getFont()->getSize()); + self::assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + self::assertEquals('Calibri', $oRichText->getFont()->getName()); + self::assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); // Slide 4 : Shape 3 /** @var RichText $oShape */ $oShape = $arrayShape[2]; - $this->assertInstanceOf(RichText::class, $oShape); - $this->assertEquals(600, $oShape->getHeight()); - $this->assertEquals(930, $oShape->getWidth()); - $this->assertEquals(10, $oShape->getOffsetX()); - $this->assertEquals(130, $oShape->getOffsetY()); + self::assertInstanceOf(RichText::class, $oShape); + self::assertEquals(600, $oShape->getHeight()); + self::assertEquals(930, $oShape->getWidth()); + self::assertEquals(10, $oShape->getOffsetX()); + self::assertEquals(130, $oShape->getOffsetY()); $arrayParagraphs = $oShape->getParagraphs(); - $this->assertCount(1, $arrayParagraphs); + self::assertCount(1, $arrayParagraphs); $oParagraph = $arrayParagraphs[0]; - $this->assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); - $this->assertFalse($oParagraph->getAlignment()->isRTL()); - $this->assertEquals(0, $oParagraph->getSpacingAfter()); - $this->assertEquals(0, $oParagraph->getSpacingBefore()); - $this->assertEquals(Paragraph::LINE_SPACING_MODE_PERCENT, $oParagraph->getLineSpacingMode()); - $this->assertEquals(100, $oParagraph->getLineSpacing()); + self::assertEquals(Alignment::HORIZONTAL_LEFT, $oParagraph->getAlignment()->getHorizontal()); + self::assertFalse($oParagraph->getAlignment()->isRTL()); + self::assertEquals(0, $oParagraph->getSpacingAfter()); + self::assertEquals(0, $oParagraph->getSpacingBefore()); + self::assertEquals(Paragraph::LINE_SPACING_MODE_PERCENT, $oParagraph->getLineSpacingMode()); + self::assertEquals(100, $oParagraph->getLineSpacing()); $arrayRichText = $oParagraph->getRichTextElements(); - $this->assertCount(3, $arrayRichText); + self::assertCount(3, $arrayRichText); // Slide 4 : Shape 3 : Paragraph 1 $oRichText = $arrayRichText[0]; - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); - $this->assertEquals('Check the project site on GitHub:', $oRichText->getText()); - $this->assertFalse($oRichText->getFont()->isBold()); - $this->assertEquals(36, $oRichText->getFont()->getSize()); - $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); - $this->assertEquals('Calibri', $oRichText->getFont()->getName()); - $this->assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $oRichText); + self::assertEquals('Check the project site on GitHub:', $oRichText->getText()); + self::assertFalse($oRichText->getFont()->isBold()); + self::assertEquals(36, $oRichText->getFont()->getSize()); + self::assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + self::assertEquals('Calibri', $oRichText->getFont()->getName()); + self::assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); // Slide 4 : Shape 3 : Paragraph 2 $oRichText = $arrayRichText[1]; - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\BreakElement', $oRichText); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\BreakElement', $oRichText); // Slide 4 : Shape 3 : Paragraph 3 /** @var RichText\Run $oRichText */ $oRichText = $arrayRichText[2]; - $this->assertInstanceOf(RichText\Run::class, $oRichText); - $this->assertEquals('https://github.com/PHPOffice/PHPPresentation/', $oRichText->getText()); - $this->assertFalse($oRichText->getFont()->isBold()); - $this->assertEquals(32, $oRichText->getFont()->getSize()); - $this->assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); - $this->assertTrue($oRichText->hasHyperlink()); - $this->assertEquals('https://github.com/PHPOffice/PHPPresentation/', $oRichText->getHyperlink()->getUrl()); - $this->assertEquals('PHPPresentation', $oRichText->getHyperlink()->getTooltip()); - $this->assertFalse($oRichText->getHyperlink()->isTextColorUsed()); - $this->assertEquals('Calibri', $oRichText->getFont()->getName()); - $this->assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); + self::assertInstanceOf(RichText\Run::class, $oRichText); + self::assertEquals('https://github.com/PHPOffice/PHPPresentation/', $oRichText->getText()); + self::assertFalse($oRichText->getFont()->isBold()); + self::assertEquals(32, $oRichText->getFont()->getSize()); + self::assertEquals('FF000000', $oRichText->getFont()->getColor()->getARGB()); + self::assertTrue($oRichText->hasHyperlink()); + self::assertEquals('https://github.com/PHPOffice/PHPPresentation/', $oRichText->getHyperlink()->getUrl()); + self::assertEquals('PHPPresentation', $oRichText->getHyperlink()->getTooltip()); + self::assertFalse($oRichText->getHyperlink()->isTextColorUsed()); + self::assertEquals('Calibri', $oRichText->getFont()->getName()); + self::assertEquals(Font::FORMAT_LATIN, $oRichText->getFont()->getFormat()); } public function testMarkAsFinal(): void @@ -578,14 +577,14 @@ public function testMarkAsFinal(): void $file = PHPPRESENTATION_TESTS_BASE_DIR . '/resources/files/Sample_12.pptx'; $object = new PowerPoint2007(); $oPhpPresentation = $object->load($file); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\PhpPresentation', $oPhpPresentation); - $this->assertFalse($oPhpPresentation->getPresentationProperties()->isMarkedAsFinal()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\PhpPresentation', $oPhpPresentation); + self::assertFalse($oPhpPresentation->getPresentationProperties()->isMarkedAsFinal()); $file = PHPPRESENTATION_TESTS_BASE_DIR . '/resources/files/PPTX_MarkAsFinal.pptx'; $object = new PowerPoint2007(); $oPhpPresentation = $object->load($file); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\PhpPresentation', $oPhpPresentation); - $this->assertTrue($oPhpPresentation->getPresentationProperties()->isMarkedAsFinal()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\PhpPresentation', $oPhpPresentation); + self::assertTrue($oPhpPresentation->getPresentationProperties()->isMarkedAsFinal()); } public function testZoom(): void @@ -593,14 +592,14 @@ public function testZoom(): void $file = PHPPRESENTATION_TESTS_BASE_DIR . '/resources/files/Sample_12.pptx'; $object = new PowerPoint2007(); $oPhpPresentation = $object->load($file); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\PhpPresentation', $oPhpPresentation); - $this->assertEquals(1, $oPhpPresentation->getPresentationProperties()->getZoom()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\PhpPresentation', $oPhpPresentation); + self::assertEquals(1, $oPhpPresentation->getPresentationProperties()->getZoom()); $file = PHPPRESENTATION_TESTS_BASE_DIR . '/resources/files/PPTX_Zoom.pptx'; $object = new PowerPoint2007(); $oPhpPresentation = $object->load($file); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\PhpPresentation', $oPhpPresentation); - $this->assertEquals(2.68, $oPhpPresentation->getPresentationProperties()->getZoom()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\PhpPresentation', $oPhpPresentation); + self::assertEquals(2.68, $oPhpPresentation->getPresentationProperties()->getZoom()); } public function testSlideLayout(): void @@ -608,12 +607,12 @@ public function testSlideLayout(): void $file = PHPPRESENTATION_TESTS_BASE_DIR . '/resources/files/Issue_00150.pptx'; $object = new PowerPoint2007(); $oPhpPresentation = $object->load($file); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\PhpPresentation', $oPhpPresentation); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\PhpPresentation', $oPhpPresentation); $masterSlides = $oPhpPresentation->getAllMasterSlides(); - $this->assertCount(3, $masterSlides); - $this->assertCount(11, $masterSlides[0]->getAllSlideLayouts()); - $this->assertCount(11, $masterSlides[1]->getAllSlideLayouts()); - $this->assertCount(11, $masterSlides[2]->getAllSlideLayouts()); + self::assertCount(3, $masterSlides); + self::assertCount(11, $masterSlides[0]->getAllSlideLayouts()); + self::assertCount(11, $masterSlides[1]->getAllSlideLayouts()); + self::assertCount(11, $masterSlides[2]->getAllSlideLayouts()); } } diff --git a/tests/PhpPresentation/Tests/Reader/PowerPoint97Test.php b/tests/PhpPresentation/Tests/Reader/PowerPoint97Test.php index 73cfb5ab6..7b54ecf17 100644 --- a/tests/PhpPresentation/Tests/Reader/PowerPoint97Test.php +++ b/tests/PhpPresentation/Tests/Reader/PowerPoint97Test.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -40,7 +39,7 @@ public function testCanRead(): void $file = PHPPRESENTATION_TESTS_BASE_DIR . '/resources/files/Sample_00_01.ppt'; $object = new PowerPoint97(); - $this->assertTrue($object->canRead($file)); + self::assertTrue($object->canRead($file)); } /** @@ -51,7 +50,7 @@ public function testCantRead(): void $file = PHPPRESENTATION_TESTS_BASE_DIR . '/resources/files/serialized.phppt'; $object = new PowerPoint97(); - $this->assertFalse($object->canRead($file)); + self::assertFalse($object->canRead($file)); } public function testLoadFileNotExists(): void @@ -90,11 +89,11 @@ public function testLoadFile01(): void $file = PHPPRESENTATION_TESTS_BASE_DIR . '/resources/files/Sample_00_01.ppt'; $object = new PowerPoint97(); $oPhpPresentation = $object->load($file); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\PhpPresentation', $oPhpPresentation); - $this->assertEquals(1, $oPhpPresentation->getSlideCount()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\PhpPresentation', $oPhpPresentation); + self::assertEquals(1, $oPhpPresentation->getSlideCount()); $oSlide = $oPhpPresentation->getSlide(0); - $this->assertCount(2, $oSlide->getShapeCollection()); + self::assertCount(2, $oSlide->getShapeCollection()); } public function testLoadFile02(): void @@ -102,20 +101,20 @@ public function testLoadFile02(): void $file = PHPPRESENTATION_TESTS_BASE_DIR . '/resources/files/Sample_00_02.ppt'; $object = new PowerPoint97(); $oPhpPresentation = $object->load($file); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\PhpPresentation', $oPhpPresentation); - $this->assertEquals(4, $oPhpPresentation->getSlideCount()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\PhpPresentation', $oPhpPresentation); + self::assertEquals(4, $oPhpPresentation->getSlideCount()); $oSlide = $oPhpPresentation->getSlide(0); - $this->assertCount(2, $oSlide->getShapeCollection()); + self::assertCount(2, $oSlide->getShapeCollection()); $oSlide = $oPhpPresentation->getSlide(1); - $this->assertCount(3, $oSlide->getShapeCollection()); + self::assertCount(3, $oSlide->getShapeCollection()); $oSlide = $oPhpPresentation->getSlide(2); - $this->assertCount(3, $oSlide->getShapeCollection()); + self::assertCount(3, $oSlide->getShapeCollection()); $oSlide = $oPhpPresentation->getSlide(3); - $this->assertCount(3, $oSlide->getShapeCollection()); + self::assertCount(3, $oSlide->getShapeCollection()); } public function testLoadFile03(): void @@ -123,11 +122,11 @@ public function testLoadFile03(): void $file = PHPPRESENTATION_TESTS_BASE_DIR . '/resources/files/Sample_00_03.ppt'; $object = new PowerPoint97(); $oPhpPresentation = $object->load($file); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\PhpPresentation', $oPhpPresentation); - $this->assertEquals(1, $oPhpPresentation->getSlideCount()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\PhpPresentation', $oPhpPresentation); + self::assertEquals(1, $oPhpPresentation->getSlideCount()); $oSlide = $oPhpPresentation->getSlide(0); - $this->assertCount(1, $oSlide->getShapeCollection()); + self::assertCount(1, $oSlide->getShapeCollection()); } public function testLoadFile04(): void @@ -135,10 +134,10 @@ public function testLoadFile04(): void $file = PHPPRESENTATION_TESTS_BASE_DIR . '/resources/files/Sample_00_04.ppt'; $object = new PowerPoint97(); $oPhpPresentation = $object->load($file); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\PhpPresentation', $oPhpPresentation); - $this->assertEquals(1, $oPhpPresentation->getSlideCount()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\PhpPresentation', $oPhpPresentation); + self::assertEquals(1, $oPhpPresentation->getSlideCount()); $oSlide = $oPhpPresentation->getSlide(0); - $this->assertCount(4, $oSlide->getShapeCollection()); + self::assertCount(4, $oSlide->getShapeCollection()); } } diff --git a/tests/PhpPresentation/Tests/Reader/SerializedTest.php b/tests/PhpPresentation/Tests/Reader/SerializedTest.php index a4d79d0a7..bc4824c3f 100644 --- a/tests/PhpPresentation/Tests/Reader/SerializedTest.php +++ b/tests/PhpPresentation/Tests/Reader/SerializedTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -41,7 +40,7 @@ public function testCanRead(): void $file = PHPPRESENTATION_TESTS_BASE_DIR . '/resources/files/serialized.phppt'; $object = new Serialized(); - $this->assertTrue($object->canRead($file)); + self::assertTrue($object->canRead($file)); } public function testLoadFileNotExists(): void diff --git a/tests/PhpPresentation/Tests/Shape/AbstractGraphicTest.php b/tests/PhpPresentation/Tests/Shape/AbstractGraphicTest.php index 54d6cf41e..997aac77e 100644 --- a/tests/PhpPresentation/Tests/Shape/AbstractGraphicTest.php +++ b/tests/PhpPresentation/Tests/Shape/AbstractGraphicTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -36,31 +35,31 @@ public function testWidthAndHeight(): void $max = 20; /** @var AbstractGraphic $stub */ $stub = $this->getMockForAbstractClass('PhpOffice\\PhpPresentation\\Shape\\AbstractGraphic'); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\AbstractGraphic', $stub->setResizeProportional(false)); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\AbstractGraphic', $stub->setWidth($min)); - $this->assertEquals($min, $stub->getWidth()); - $this->assertEquals(0, $stub->getHeight()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\AbstractGraphic', $stub->setHeight($max)); - $this->assertEquals($min, $stub->getWidth()); - $this->assertEquals($max, $stub->getHeight()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\AbstractGraphic', $stub->setWidthAndHeight($min, $max)); - $this->assertEquals($min, $stub->getWidth()); - $this->assertEquals($max, $stub->getHeight()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\AbstractGraphic', $stub->setResizeProportional(false)); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\AbstractGraphic', $stub->setWidth($min)); + self::assertEquals($min, $stub->getWidth()); + self::assertEquals(0, $stub->getHeight()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\AbstractGraphic', $stub->setHeight($max)); + self::assertEquals($min, $stub->getWidth()); + self::assertEquals($max, $stub->getHeight()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\AbstractGraphic', $stub->setWidthAndHeight($min, $max)); + self::assertEquals($min, $stub->getWidth()); + self::assertEquals($max, $stub->getHeight()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\AbstractGraphic', $stub->setResizeProportional(true)); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\AbstractGraphic', $stub->setWidth($max)); - $this->assertEquals($max, $stub->getWidth()); - $this->assertEquals($max * ($max / $min), $stub->getHeight()); - $this->assertEquals($max, $stub->getWidth()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\AbstractGraphic', $stub->setHeight($min)); - $this->assertEquals($min * ($max / ($max * ($max / $min))), $stub->getWidth()); - $this->assertEquals($min, $stub->getHeight()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\AbstractGraphic', $stub->setWidthAndHeight($min, $max)); - $this->assertEquals($min, $stub->getWidth()); - $this->assertEquals($max, $stub->getHeight()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\AbstractGraphic', $stub->setWidthAndHeight($max, $min)); - $this->assertEquals($min * ($min / $max), $stub->getWidth()); - $this->assertEquals($min, $stub->getHeight()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\AbstractGraphic', $stub->setResizeProportional(true)); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\AbstractGraphic', $stub->setWidth($max)); + self::assertEquals($max, $stub->getWidth()); + self::assertEquals($max * ($max / $min), $stub->getHeight()); + self::assertEquals($max, $stub->getWidth()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\AbstractGraphic', $stub->setHeight($min)); + self::assertEquals($min * ($max / ($max * ($max / $min))), $stub->getWidth()); + self::assertEquals($min, $stub->getHeight()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\AbstractGraphic', $stub->setWidthAndHeight($min, $max)); + self::assertEquals($min, $stub->getWidth()); + self::assertEquals($max, $stub->getHeight()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\AbstractGraphic', $stub->setWidthAndHeight($max, $min)); + self::assertEquals($min * ($min / $max), $stub->getWidth()); + self::assertEquals($min, $stub->getHeight()); } public function testWidthAndHeight2(): void @@ -69,24 +68,24 @@ public function testWidthAndHeight2(): void $max = 20; /** @var AbstractGraphic $stub */ $stub = $this->getMockForAbstractClass('PhpOffice\\PhpPresentation\\Shape\\AbstractGraphic'); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\AbstractGraphic', $stub->setResizeProportional(false)); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\AbstractGraphic', $stub->setWidth($max)); - $this->assertEquals($max, $stub->getWidth()); - $this->assertEquals(0, $stub->getHeight()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\AbstractGraphic', $stub->setHeight($min)); - $this->assertEquals($max, $stub->getWidth()); - $this->assertEquals($min, $stub->getHeight()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\AbstractGraphic', $stub->setResizeProportional(false)); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\AbstractGraphic', $stub->setWidth($max)); + self::assertEquals($max, $stub->getWidth()); + self::assertEquals(0, $stub->getHeight()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\AbstractGraphic', $stub->setHeight($min)); + self::assertEquals($max, $stub->getWidth()); + self::assertEquals($min, $stub->getHeight()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\AbstractGraphic', $stub->setResizeProportional(true)); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\AbstractGraphic', $stub->setWidth($max)); - $this->assertEquals($max, $stub->getWidth()); - $this->assertEquals($max * ($min / $max), $stub->getHeight()); - $this->assertEquals($max, $stub->getWidth()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\AbstractGraphic', $stub->setHeight($min)); - $this->assertEquals($max * ($min / ($max * ($min / $max))), $stub->getWidth()); - $this->assertEquals($min, $stub->getHeight()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\AbstractGraphic', $stub->setWidthAndHeight($min, $max)); - $this->assertEquals($min, $stub->getWidth()); - $this->assertEquals($min * ($min / ($max * ($min / ($max * ($min / $max))))), $stub->getHeight()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\AbstractGraphic', $stub->setResizeProportional(true)); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\AbstractGraphic', $stub->setWidth($max)); + self::assertEquals($max, $stub->getWidth()); + self::assertEquals($max * ($min / $max), $stub->getHeight()); + self::assertEquals($max, $stub->getWidth()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\AbstractGraphic', $stub->setHeight($min)); + self::assertEquals($max * ($min / ($max * ($min / $max))), $stub->getWidth()); + self::assertEquals($min, $stub->getHeight()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\AbstractGraphic', $stub->setWidthAndHeight($min, $max)); + self::assertEquals($min, $stub->getWidth()); + self::assertEquals($min * ($min / ($max * ($min / ($max * ($min / $max))))), $stub->getHeight()); } } diff --git a/tests/PhpPresentation/Tests/Shape/AutoShapeTest.php b/tests/PhpPresentation/Tests/Shape/AutoShapeTest.php index 9e235e2df..bc7d5636a 100644 --- a/tests/PhpPresentation/Tests/Shape/AutoShapeTest.php +++ b/tests/PhpPresentation/Tests/Shape/AutoShapeTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -30,10 +29,10 @@ public function testConstruct(): void { $object = new AutoShape(); - $this->assertEquals(AutoShape::TYPE_HEART, $object->getType()); - $this->assertEquals('', $object->getText()); - $this->assertInstanceOf(Outline::class, $object->getOutline()); - $this->assertIsString($object->getHashCode()); + self::assertEquals(AutoShape::TYPE_HEART, $object->getType()); + self::assertEquals('', $object->getText()); + self::assertInstanceOf(Outline::class, $object->getOutline()); + self::assertIsString($object->getHashCode()); } public function testOutline(): void @@ -42,26 +41,26 @@ public function testOutline(): void $mock = $this->getMockBuilder(Outline::class)->getMock(); $object = new AutoShape(); - $this->assertInstanceOf(Outline::class, $object->getOutline()); - $this->assertInstanceOf(AutoShape::class, $object->setOutline($mock)); - $this->assertInstanceOf(Outline::class, $object->getOutline()); + self::assertInstanceOf(Outline::class, $object->getOutline()); + self::assertInstanceOf(AutoShape::class, $object->setOutline($mock)); + self::assertInstanceOf(Outline::class, $object->getOutline()); } public function testText(): void { $object = new AutoShape(); - $this->assertEquals('', $object->getText()); - $this->assertInstanceOf(AutoShape::class, $object->setText('Text')); - $this->assertEquals('Text', $object->getText()); + self::assertEquals('', $object->getText()); + self::assertInstanceOf(AutoShape::class, $object->setText('Text')); + self::assertEquals('Text', $object->getText()); } public function testType(): void { $object = new AutoShape(); - $this->assertEquals(AutoShape::TYPE_HEART, $object->getType()); - $this->assertInstanceOf(AutoShape::class, $object->setType(AutoShape::TYPE_HEXAGON)); - $this->assertEquals(AutoShape::TYPE_HEXAGON, $object->getType()); + self::assertEquals(AutoShape::TYPE_HEART, $object->getType()); + self::assertInstanceOf(AutoShape::class, $object->setType(AutoShape::TYPE_HEXAGON)); + self::assertEquals(AutoShape::TYPE_HEXAGON, $object->getType()); } } diff --git a/tests/PhpPresentation/Tests/Shape/Chart/AxisTest.php b/tests/PhpPresentation/Tests/Shape/Chart/AxisTest.php index 0deac2665..7cf9ee391 100644 --- a/tests/PhpPresentation/Tests/Shape/Chart/AxisTest.php +++ b/tests/PhpPresentation/Tests/Shape/Chart/AxisTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -37,10 +36,10 @@ public function testConstruct(): void { $object = new Axis(); - $this->assertEquals('Axis Title', $object->getTitle()); - $this->assertInstanceOf(Font::class, $object->getFont()); - $this->assertNull($object->getMinorGridlines()); - $this->assertNull($object->getMajorGridlines()); + self::assertEquals('Axis Title', $object->getTitle()); + self::assertInstanceOf(Font::class, $object->getFont()); + self::assertNull($object->getMinorGridlines()); + self::assertNull($object->getMajorGridlines()); } public function testBounds(): void @@ -48,55 +47,55 @@ public function testBounds(): void $value = mt_rand(0, 100); $object = new Axis(); - $this->assertNull($object->getMinBounds()); - $this->assertInstanceOf(Axis::class, $object->setMinBounds($value)); - $this->assertEquals($value, $object->getMinBounds()); - $this->assertInstanceOf(Axis::class, $object->setMinBounds()); - $this->assertNull($object->getMinBounds()); - - $this->assertNull($object->getMaxBounds()); - $this->assertInstanceOf(Axis::class, $object->setMaxBounds($value)); - $this->assertEquals($value, $object->getMaxBounds()); - $this->assertInstanceOf(Axis::class, $object->setMaxBounds()); - $this->assertNull($object->getMaxBounds()); + self::assertNull($object->getMinBounds()); + self::assertInstanceOf(Axis::class, $object->setMinBounds($value)); + self::assertEquals($value, $object->getMinBounds()); + self::assertInstanceOf(Axis::class, $object->setMinBounds()); + self::assertNull($object->getMinBounds()); + + self::assertNull($object->getMaxBounds()); + self::assertInstanceOf(Axis::class, $object->setMaxBounds($value)); + self::assertEquals($value, $object->getMaxBounds()); + self::assertInstanceOf(Axis::class, $object->setMaxBounds()); + self::assertNull($object->getMaxBounds()); } public function testCrossesAt(): void { $object = new Axis(); - $this->assertEquals(Axis::CROSSES_AUTO, $object->getCrossesAt()); - $this->assertInstanceOf(Axis::class, $object->setCrossesAt(Axis::CROSSES_MAX)); - $this->assertEquals(Axis::CROSSES_MAX, $object->getCrossesAt()); + self::assertEquals(Axis::CROSSES_AUTO, $object->getCrossesAt()); + self::assertInstanceOf(Axis::class, $object->setCrossesAt(Axis::CROSSES_MAX)); + self::assertEquals(Axis::CROSSES_MAX, $object->getCrossesAt()); } public function testIsReversedOrder(): void { $object = new Axis(); - $this->assertFalse($object->isReversedOrder()); - $this->assertInstanceOf(Axis::class, $object->setIsReversedOrder(true)); - $this->assertTrue($object->isReversedOrder()); - $this->assertInstanceOf(Axis::class, $object->setIsReversedOrder(false)); - $this->assertFalse($object->isReversedOrder()); + self::assertFalse($object->isReversedOrder()); + self::assertInstanceOf(Axis::class, $object->setIsReversedOrder(true)); + self::assertTrue($object->isReversedOrder()); + self::assertInstanceOf(Axis::class, $object->setIsReversedOrder(false)); + self::assertFalse($object->isReversedOrder()); } public function testFont(): void { $object = new Axis(); - $this->assertInstanceOf(Axis::class, $object->setFont()); - $this->assertNull($object->getFont()); - $this->assertInstanceOf(Axis::class, $object->setFont(new Font())); - $this->assertInstanceOf(Font::class, $object->getFont()); + self::assertInstanceOf(Axis::class, $object->setFont()); + self::assertNull($object->getFont()); + self::assertInstanceOf(Axis::class, $object->setFont(new Font())); + self::assertInstanceOf(Font::class, $object->getFont()); } public function testFormatCode(): void { $object = new Axis(); - $this->assertInstanceOf(Axis::class, $object->setFormatCode()); - $this->assertEquals('', $object->getFormatCode()); - $this->assertInstanceOf(Axis::class, $object->setFormatCode('AAAA')); - $this->assertEquals('AAAA', $object->getFormatCode()); + self::assertInstanceOf(Axis::class, $object->setFormatCode()); + self::assertEquals('', $object->getFormatCode()); + self::assertInstanceOf(Axis::class, $object->setFormatCode('AAAA')); + self::assertEquals('AAAA', $object->getFormatCode()); } public function testGridLines(): void @@ -106,10 +105,10 @@ public function testGridLines(): void /** @var Gridlines $oMock */ $oMock = $this->getMockBuilder(Gridlines::class)->getMock(); - $this->assertInstanceOf(Axis::class, $object->setMajorGridlines($oMock)); - $this->assertInstanceOf(Gridlines::class, $object->getMajorGridlines()); - $this->assertInstanceOf(Axis::class, $object->setMinorGridlines($oMock)); - $this->assertInstanceOf(Gridlines::class, $object->getMinorGridlines()); + self::assertInstanceOf(Axis::class, $object->setMajorGridlines($oMock)); + self::assertInstanceOf(Gridlines::class, $object->getMajorGridlines()); + self::assertInstanceOf(Axis::class, $object->setMinorGridlines($oMock)); + self::assertInstanceOf(Gridlines::class, $object->getMinorGridlines()); } public function testHashIndex(): void @@ -117,32 +116,32 @@ public function testHashIndex(): void $object = new Axis(); $value = mt_rand(1, 100); - $this->assertEmpty($object->getHashIndex()); - $this->assertInstanceOf(Axis::class, $object->setHashIndex($value)); - $this->assertEquals($value, $object->getHashIndex()); + self::assertEmpty($object->getHashIndex()); + self::assertInstanceOf(Axis::class, $object->setHashIndex($value)); + self::assertEquals($value, $object->getHashIndex()); } public function testIsVisible(): void { $object = new Axis(); - $this->assertTrue($object->isVisible()); - $this->assertInstanceOf(Axis::class, $object->setIsVisible(false)); - $this->assertFalse($object->isVisible()); - $this->assertInstanceOf(Axis::class, $object->setIsVisible(true)); - $this->assertTrue($object->isVisible()); + self::assertTrue($object->isVisible()); + self::assertInstanceOf(Axis::class, $object->setIsVisible(false)); + self::assertFalse($object->isVisible()); + self::assertInstanceOf(Axis::class, $object->setIsVisible(true)); + self::assertTrue($object->isVisible()); } public function testLabelRotation(): void { $object = new Axis(); - $this->assertEquals(0, $object->getTitleRotation()); - $this->assertInstanceOf(Axis::class, $object->setTitleRotation(-1)); - $this->assertEquals(0, $object->getTitleRotation()); - $this->assertInstanceOf(Axis::class, $object->setTitleRotation(361)); - $this->assertEquals(360, $object->getTitleRotation()); - $value = rand(0, 360); - $this->assertInstanceOf(Axis::class, $object->setTitleRotation($value)); - $this->assertEquals($value, $object->getTitleRotation()); + self::assertEquals(0, $object->getTitleRotation()); + self::assertInstanceOf(Axis::class, $object->setTitleRotation(-1)); + self::assertEquals(0, $object->getTitleRotation()); + self::assertInstanceOf(Axis::class, $object->setTitleRotation(361)); + self::assertEquals(360, $object->getTitleRotation()); + $value = mt_rand(0, 360); + self::assertInstanceOf(Axis::class, $object->setTitleRotation($value)); + self::assertEquals($value, $object->getTitleRotation()); } public function testOutline(): void @@ -151,24 +150,24 @@ public function testOutline(): void $oMock = $this->getMockBuilder(Outline::class)->getMock(); $object = new Axis(); - $this->assertInstanceOf(Outline::class, $object->getOutline()); - $this->assertInstanceOf(Axis::class, $object->setOutline($oMock)); - $this->assertInstanceOf(Outline::class, $object->getOutline()); + self::assertInstanceOf(Outline::class, $object->getOutline()); + self::assertInstanceOf(Axis::class, $object->setOutline($oMock)); + self::assertInstanceOf(Outline::class, $object->getOutline()); } public function testTickLabelPosition(): void { $object = new Axis(); - $this->assertEquals(Axis::TICK_LABEL_POSITION_NEXT_TO, $object->getTickLabelPosition()); - $this->assertInstanceOf(Axis::class, $object->setTickLabelPosition(Axis::TICK_LABEL_POSITION_HIGH)); - $this->assertEquals(Axis::TICK_LABEL_POSITION_HIGH, $object->getTickLabelPosition()); - $this->assertInstanceOf(Axis::class, $object->setTickLabelPosition(Axis::TICK_LABEL_POSITION_NEXT_TO)); - $this->assertEquals(Axis::TICK_LABEL_POSITION_NEXT_TO, $object->getTickLabelPosition()); - $this->assertInstanceOf(Axis::class, $object->setTickLabelPosition(Axis::TICK_LABEL_POSITION_LOW)); - $this->assertEquals(Axis::TICK_LABEL_POSITION_LOW, $object->getTickLabelPosition()); - $this->assertInstanceOf(Axis::class, $object->setTickLabelPosition('Unauthorized')); - $this->assertEquals(Axis::TICK_LABEL_POSITION_LOW, $object->getTickLabelPosition()); + self::assertEquals(Axis::TICK_LABEL_POSITION_NEXT_TO, $object->getTickLabelPosition()); + self::assertInstanceOf(Axis::class, $object->setTickLabelPosition(Axis::TICK_LABEL_POSITION_HIGH)); + self::assertEquals(Axis::TICK_LABEL_POSITION_HIGH, $object->getTickLabelPosition()); + self::assertInstanceOf(Axis::class, $object->setTickLabelPosition(Axis::TICK_LABEL_POSITION_NEXT_TO)); + self::assertEquals(Axis::TICK_LABEL_POSITION_NEXT_TO, $object->getTickLabelPosition()); + self::assertInstanceOf(Axis::class, $object->setTickLabelPosition(Axis::TICK_LABEL_POSITION_LOW)); + self::assertEquals(Axis::TICK_LABEL_POSITION_LOW, $object->getTickLabelPosition()); + self::assertInstanceOf(Axis::class, $object->setTickLabelPosition('Unauthorized')); + self::assertEquals(Axis::TICK_LABEL_POSITION_LOW, $object->getTickLabelPosition()); } public function testTickMark(): void @@ -176,25 +175,25 @@ public function testTickMark(): void $value = Axis::TICK_MARK_INSIDE; $object = new Axis(); - $this->assertEquals(Axis::TICK_MARK_NONE, $object->getMinorTickMark()); - $this->assertInstanceOf(Axis::class, $object->setMinorTickMark($value)); - $this->assertEquals($value, $object->getMinorTickMark()); - $this->assertInstanceOf(Axis::class, $object->setMinorTickMark()); - $this->assertEquals(Axis::TICK_MARK_NONE, $object->getMinorTickMark()); - - $this->assertEquals(Axis::TICK_MARK_NONE, $object->getMajorTickMark()); - $this->assertInstanceOf(Axis::class, $object->setMajorTickMark($value)); - $this->assertEquals($value, $object->getMajorTickMark()); - $this->assertInstanceOf(Axis::class, $object->setMajorTickMark()); - $this->assertEquals(Axis::TICK_MARK_NONE, $object->getMajorTickMark()); + self::assertEquals(Axis::TICK_MARK_NONE, $object->getMinorTickMark()); + self::assertInstanceOf(Axis::class, $object->setMinorTickMark($value)); + self::assertEquals($value, $object->getMinorTickMark()); + self::assertInstanceOf(Axis::class, $object->setMinorTickMark()); + self::assertEquals(Axis::TICK_MARK_NONE, $object->getMinorTickMark()); + + self::assertEquals(Axis::TICK_MARK_NONE, $object->getMajorTickMark()); + self::assertInstanceOf(Axis::class, $object->setMajorTickMark($value)); + self::assertEquals($value, $object->getMajorTickMark()); + self::assertInstanceOf(Axis::class, $object->setMajorTickMark()); + self::assertEquals(Axis::TICK_MARK_NONE, $object->getMajorTickMark()); } public function testTitle(): void { $object = new Axis(); - $this->assertEquals('Axis Title', $object->getTitle()); - $this->assertInstanceOf(Axis::class, $object->setTitle('AAAA')); - $this->assertEquals('AAAA', $object->getTitle()); + self::assertEquals('Axis Title', $object->getTitle()); + self::assertInstanceOf(Axis::class, $object->setTitle('AAAA')); + self::assertEquals('AAAA', $object->getTitle()); } public function testUnit(): void @@ -202,16 +201,16 @@ public function testUnit(): void $value = mt_rand(0, 100); $object = new Axis(); - $this->assertNull($object->getMinorUnit()); - $this->assertInstanceOf(Axis::class, $object->setMinorUnit($value)); - $this->assertEquals($value, $object->getMinorUnit()); - $this->assertInstanceOf(Axis::class, $object->setMinorUnit()); - $this->assertNull($object->getMinorUnit()); - - $this->assertNull($object->getMajorUnit()); - $this->assertInstanceOf(Axis::class, $object->setMajorUnit($value)); - $this->assertEquals($value, $object->getMajorUnit()); - $this->assertInstanceOf(Axis::class, $object->setMajorUnit()); - $this->assertNull($object->getMajorUnit()); + self::assertNull($object->getMinorUnit()); + self::assertInstanceOf(Axis::class, $object->setMinorUnit($value)); + self::assertEquals($value, $object->getMinorUnit()); + self::assertInstanceOf(Axis::class, $object->setMinorUnit()); + self::assertNull($object->getMinorUnit()); + + self::assertNull($object->getMajorUnit()); + self::assertInstanceOf(Axis::class, $object->setMajorUnit($value)); + self::assertEquals($value, $object->getMajorUnit()); + self::assertInstanceOf(Axis::class, $object->setMajorUnit()); + self::assertNull($object->getMajorUnit()); } } diff --git a/tests/PhpPresentation/Tests/Shape/Chart/GridlinesTest.php b/tests/PhpPresentation/Tests/Shape/Chart/GridlinesTest.php index fe0e96451..3b7e37fd2 100644 --- a/tests/PhpPresentation/Tests/Shape/Chart/GridlinesTest.php +++ b/tests/PhpPresentation/Tests/Shape/Chart/GridlinesTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -30,7 +29,7 @@ public function testConstruct(): void { $object = new Gridlines(); - $this->assertInstanceOf(Outline::class, $object->getOutline()); + self::assertInstanceOf(Outline::class, $object->getOutline()); } public function testGetSetOutline(): void @@ -40,8 +39,8 @@ public function testGetSetOutline(): void /** @var Outline $oStub */ $oStub = $this->getMockBuilder(Outline::class)->getMock(); - $this->assertInstanceOf(Outline::class, $object->getOutline()); - $this->assertInstanceOf('PhpOffice\PhpPresentation\Shape\Chart\Gridlines', $object->setOutline($oStub)); - $this->assertInstanceOf(Outline::class, $object->getOutline()); + self::assertInstanceOf(Outline::class, $object->getOutline()); + self::assertInstanceOf('PhpOffice\PhpPresentation\Shape\Chart\Gridlines', $object->setOutline($oStub)); + self::assertInstanceOf(Outline::class, $object->getOutline()); } } diff --git a/tests/PhpPresentation/Tests/Shape/Chart/LegendTest.php b/tests/PhpPresentation/Tests/Shape/Chart/LegendTest.php index 3b57adbb2..6ee4ce60d 100644 --- a/tests/PhpPresentation/Tests/Shape/Chart/LegendTest.php +++ b/tests/PhpPresentation/Tests/Shape/Chart/LegendTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -38,46 +37,46 @@ public function testConstruct(): void { $object = new Legend(); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Font', $object->getFont()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Border', $object->getBorder()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Fill', $object->getFill()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Alignment', $object->getAlignment()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Font', $object->getFont()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Border', $object->getBorder()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Fill', $object->getFill()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Alignment', $object->getAlignment()); } public function testAlignment(): void { $object = new Legend(); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setAlignment(new Alignment())); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Alignment', $object->getAlignment()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setAlignment(new Alignment())); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Alignment', $object->getAlignment()); } public function testBorder(): void { $object = new Legend(); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Border', $object->getBorder()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setBorder(new Border())); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Border', $object->getBorder()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Border', $object->getBorder()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setBorder(new Border())); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Border', $object->getBorder()); } public function testFill(): void { $object = new Legend(); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Fill', $object->getFill()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setFill(new Fill())); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Fill', $object->getFill()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Fill', $object->getFill()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setFill(new Fill())); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Fill', $object->getFill()); } public function testFont(): void { $object = new Legend(); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setFont()); - $this->assertNull($object->getFont()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setFont(new Font())); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Font', $object->getFont()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setFont()); + self::assertNull($object->getFont()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setFont(new Font())); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Font', $object->getFont()); } public function testHashIndex(): void @@ -85,9 +84,9 @@ public function testHashIndex(): void $object = new Legend(); $value = mt_rand(1, 100); - $this->assertEmpty($object->getHashIndex()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setHashIndex($value)); - $this->assertEquals($value, $object->getHashIndex()); + self::assertEmpty($object->getHashIndex()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setHashIndex($value)); + self::assertEquals($value, $object->getHashIndex()); } public function testHeight(): void @@ -95,10 +94,10 @@ public function testHeight(): void $object = new Legend(); $value = mt_rand(0, 100); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setHeight()); - $this->assertEquals(0, $object->getHeight()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setHeight($value)); - $this->assertEquals($value, $object->getHeight()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setHeight()); + self::assertEquals(0, $object->getHeight()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setHeight($value)); + self::assertEquals($value, $object->getHeight()); } public function testOffsetX(): void @@ -106,10 +105,10 @@ public function testOffsetX(): void $object = new Legend(); $value = mt_rand(0, 100); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setOffsetX()); - $this->assertEquals(0, $object->getOffsetX()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setOffsetX($value)); - $this->assertEquals($value, $object->getOffsetX()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setOffsetX()); + self::assertEquals(0, $object->getOffsetX()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setOffsetX($value)); + self::assertEquals($value, $object->getOffsetX()); } public function testOffsetY(): void @@ -117,32 +116,32 @@ public function testOffsetY(): void $object = new Legend(); $value = mt_rand(0, 100); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setOffsetY()); - $this->assertEquals(0, $object->getOffsetY()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setOffsetY($value)); - $this->assertEquals($value, $object->getOffsetY()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setOffsetY()); + self::assertEquals(0, $object->getOffsetY()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setOffsetY($value)); + self::assertEquals($value, $object->getOffsetY()); } public function testPosition(): void { $object = new Legend(); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setPosition()); - $this->assertEquals(Legend::POSITION_RIGHT, $object->getPosition()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setPosition(Legend::POSITION_BOTTOM)); - $this->assertEquals(Legend::POSITION_BOTTOM, $object->getPosition()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setPosition()); + self::assertEquals(Legend::POSITION_RIGHT, $object->getPosition()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setPosition(Legend::POSITION_BOTTOM)); + self::assertEquals(Legend::POSITION_BOTTOM, $object->getPosition()); } public function testVisible(): void { $object = new Legend(); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setVisible()); - $this->assertTrue($object->isVisible()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setVisible(true)); - $this->assertTrue($object->isVisible()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setVisible(false)); - $this->assertFalse($object->isVisible()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setVisible()); + self::assertTrue($object->isVisible()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setVisible(true)); + self::assertTrue($object->isVisible()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setVisible(false)); + self::assertFalse($object->isVisible()); } public function testWidth(): void @@ -150,9 +149,9 @@ public function testWidth(): void $object = new Legend(); $value = mt_rand(0, 100); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setWidth()); - $this->assertEquals(0, $object->getWidth()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setWidth($value)); - $this->assertEquals($value, $object->getWidth()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setWidth()); + self::assertEquals(0, $object->getWidth()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setWidth($value)); + self::assertEquals($value, $object->getWidth()); } } diff --git a/tests/PhpPresentation/Tests/Shape/Chart/MarkerTest.php b/tests/PhpPresentation/Tests/Shape/Chart/MarkerTest.php index 9904ea660..5ecf537f2 100644 --- a/tests/PhpPresentation/Tests/Shape/Chart/MarkerTest.php +++ b/tests/PhpPresentation/Tests/Shape/Chart/MarkerTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -36,24 +35,24 @@ public function testConstruct(): void { $object = new Marker(); - $this->assertEquals(Marker::SYMBOL_NONE, $object->getSymbol()); - $this->assertEquals(5, $object->getSize()); + self::assertEquals(Marker::SYMBOL_NONE, $object->getSymbol()); + self::assertEquals(5, $object->getSize()); } public function testBorder(): void { $object = new Marker(); - $this->assertInstanceOf(Border::class, $object->getBorder()); - $this->assertInstanceOf(Marker::class, $object->setBorder(new Border())); + self::assertInstanceOf(Border::class, $object->getBorder()); + self::assertInstanceOf(Marker::class, $object->setBorder(new Border())); } public function testFill(): void { $object = new Marker(); - $this->assertInstanceOf(Fill::class, $object->getFill()); - $this->assertInstanceOf(Marker::class, $object->setFill(new Fill())); + self::assertInstanceOf(Fill::class, $object->getFill()); + self::assertInstanceOf(Marker::class, $object->setFill(new Fill())); } public function testSize(): void @@ -61,8 +60,8 @@ public function testSize(): void $object = new Marker(); $value = mt_rand(1, 100); - $this->assertInstanceOf(Marker::class, $object->setSize($value)); - $this->assertEquals($value, $object->getSize()); + self::assertInstanceOf(Marker::class, $object->setSize($value)); + self::assertEquals($value, $object->getSize()); } public function testSymbol(): void @@ -71,7 +70,7 @@ public function testSymbol(): void $expected = Marker::$arraySymbol[array_rand(Marker::$arraySymbol)]; - $this->assertInstanceOf(Marker::class, $object->setSymbol($expected)); - $this->assertEquals($expected, $object->getSymbol()); + self::assertInstanceOf(Marker::class, $object->setSymbol($expected)); + self::assertEquals($expected, $object->getSymbol()); } } diff --git a/tests/PhpPresentation/Tests/Shape/Chart/PlotAreaTest.php b/tests/PhpPresentation/Tests/Shape/Chart/PlotAreaTest.php index 42c6a193b..eb2fac276 100644 --- a/tests/PhpPresentation/Tests/Shape/Chart/PlotAreaTest.php +++ b/tests/PhpPresentation/Tests/Shape/Chart/PlotAreaTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -38,8 +37,8 @@ public function testConstruct(): void { $object = new PlotArea(); - $this->assertInstanceOf(Axis::class, $object->getAxisX()); - $this->assertInstanceOf(Axis::class, $object->getAxisY()); + self::assertInstanceOf(Axis::class, $object->getAxisX()); + self::assertInstanceOf(Axis::class, $object->getAxisY()); } public function testHashIndex(): void @@ -47,9 +46,9 @@ public function testHashIndex(): void $object = new PlotArea(); $value = mt_rand(1, 100); - $this->assertEmpty($object->getHashIndex()); - $this->assertInstanceOf(PlotArea::class, $object->setHashIndex($value)); - $this->assertEquals($value, $object->getHashIndex()); + self::assertEmpty($object->getHashIndex()); + self::assertInstanceOf(PlotArea::class, $object->setHashIndex($value)); + self::assertEquals($value, $object->getHashIndex()); } public function testHeight(): void @@ -57,10 +56,10 @@ public function testHeight(): void $object = new PlotArea(); $value = mt_rand(0, 100); - $this->assertInstanceOf(PlotArea::class, $object->setHeight()); - $this->assertEquals(0, $object->getHeight()); - $this->assertInstanceOf(PlotArea::class, $object->setHeight($value)); - $this->assertEquals($value, $object->getHeight()); + self::assertInstanceOf(PlotArea::class, $object->setHeight()); + self::assertEquals(0, $object->getHeight()); + self::assertInstanceOf(PlotArea::class, $object->setHeight($value)); + self::assertEquals($value, $object->getHeight()); } public function testOffsetX(): void @@ -68,10 +67,10 @@ public function testOffsetX(): void $object = new PlotArea(); $value = mt_rand(0, 100); - $this->assertInstanceOf(PlotArea::class, $object->setOffsetX()); - $this->assertEquals(0, $object->getOffsetX()); - $this->assertInstanceOf(PlotArea::class, $object->setOffsetX($value)); - $this->assertEquals($value, $object->getOffsetX()); + self::assertInstanceOf(PlotArea::class, $object->setOffsetX()); + self::assertEquals(0, $object->getOffsetX()); + self::assertInstanceOf(PlotArea::class, $object->setOffsetX($value)); + self::assertEquals($value, $object->getOffsetX()); } public function testOffsetY(): void @@ -79,18 +78,18 @@ public function testOffsetY(): void $object = new PlotArea(); $value = mt_rand(0, 100); - $this->assertInstanceOf(PlotArea::class, $object->setOffsetY()); - $this->assertEquals(0, $object->getOffsetY()); - $this->assertInstanceOf(PlotArea::class, $object->setOffsetY($value)); - $this->assertEquals($value, $object->getOffsetY()); + self::assertInstanceOf(PlotArea::class, $object->setOffsetY()); + self::assertEquals(0, $object->getOffsetY()); + self::assertInstanceOf(PlotArea::class, $object->setOffsetY($value)); + self::assertEquals($value, $object->getOffsetY()); } public function testType(): void { $object = new PlotArea(); - $this->assertInstanceOf(PlotArea::class, $object->setType(new Bar3D())); - $this->assertInstanceOf(AbstractType::class, $object->getType()); + self::assertInstanceOf(PlotArea::class, $object->setType(new Bar3D())); + self::assertInstanceOf(AbstractType::class, $object->getType()); } public function testTypeException(): void @@ -107,9 +106,9 @@ public function testWidth(): void $object = new PlotArea(); $value = mt_rand(0, 100); - $this->assertInstanceOf(PlotArea::class, $object->setWidth()); - $this->assertEquals(0, $object->getWidth()); - $this->assertInstanceOf(PlotArea::class, $object->setWidth($value)); - $this->assertEquals($value, $object->getWidth()); + self::assertInstanceOf(PlotArea::class, $object->setWidth()); + self::assertEquals(0, $object->getWidth()); + self::assertInstanceOf(PlotArea::class, $object->setWidth($value)); + self::assertEquals($value, $object->getWidth()); } } diff --git a/tests/PhpPresentation/Tests/Shape/Chart/SeriesTest.php b/tests/PhpPresentation/Tests/Shape/Chart/SeriesTest.php index f3cc6b7b1..fb613676e 100644 --- a/tests/PhpPresentation/Tests/Shape/Chart/SeriesTest.php +++ b/tests/PhpPresentation/Tests/Shape/Chart/SeriesTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -38,64 +37,64 @@ public function testConstruct(): void { $object = new Series(); - $this->assertInstanceOf(Fill::class, $object->getFill()); - $this->assertInstanceOf(Font::class, $object->getFont()); - $this->assertEquals('Calibri', $object->getFont()->getName()); - $this->assertEquals(9, $object->getFont()->getSize()); - $this->assertEquals('Series Title', $object->getTitle()); - $this->assertIsArray($object->getValues()); - $this->assertEmpty($object->getValues()); - $this->assertInstanceOf(Marker::class, $object->getMarker()); - $this->assertNull($object->getOutline()); - $this->assertFalse($object->hasShowLegendKey()); + self::assertInstanceOf(Fill::class, $object->getFill()); + self::assertInstanceOf(Font::class, $object->getFont()); + self::assertEquals('Calibri', $object->getFont()->getName()); + self::assertEquals(9, $object->getFont()->getSize()); + self::assertEquals('Series Title', $object->getTitle()); + self::assertIsArray($object->getValues()); + self::assertEmpty($object->getValues()); + self::assertInstanceOf(Marker::class, $object->getMarker()); + self::assertNull($object->getOutline()); + self::assertFalse($object->hasShowLegendKey()); } public function testDataLabelNumFormat(): void { $object = new Series(); - $this->assertEmpty($object->getDlblNumFormat()); - $this->assertFalse($object->hasDlblNumFormat()); + self::assertEmpty($object->getDlblNumFormat()); + self::assertFalse($object->hasDlblNumFormat()); - $this->assertInstanceOf(Series::class, $object->setDlblNumFormat('#%')); + self::assertInstanceOf(Series::class, $object->setDlblNumFormat('#%')); - $this->assertEquals('#%', $object->getDlblNumFormat()); - $this->assertTrue($object->hasDlblNumFormat()); + self::assertEquals('#%', $object->getDlblNumFormat()); + self::assertTrue($object->hasDlblNumFormat()); - $this->assertInstanceOf(Series::class, $object->setDlblNumFormat()); + self::assertInstanceOf(Series::class, $object->setDlblNumFormat()); - $this->assertEmpty($object->getDlblNumFormat()); - $this->assertFalse($object->hasDlblNumFormat()); + self::assertEmpty($object->getDlblNumFormat()); + self::assertFalse($object->hasDlblNumFormat()); } public function testDataPointFills(): void { $object = new Series(); - $this->assertIsArray($object->getDataPointFills()); - $this->assertEmpty($object->getDataPointFills()); + self::assertIsArray($object->getDataPointFills()); + self::assertEmpty($object->getDataPointFills()); - $this->assertInstanceOf(Fill::class, $object->getDataPointFill(0)); + self::assertInstanceOf(Fill::class, $object->getDataPointFill(0)); } public function testFill(): void { $object = new Series(); - $this->assertInstanceOf(Series::class, $object->setFill()); - $this->assertNull($object->getFill()); - $this->assertInstanceOf(Series::class, $object->setFill(new Fill())); - $this->assertInstanceOf(Fill::class, $object->getFill()); + self::assertInstanceOf(Series::class, $object->setFill()); + self::assertNull($object->getFill()); + self::assertInstanceOf(Series::class, $object->setFill(new Fill())); + self::assertInstanceOf(Fill::class, $object->getFill()); } public function testFont(): void { $object = new Series(); - $this->assertInstanceOf(Series::class, $object->setFont()); - $this->assertNull($object->getFont()); - $this->assertInstanceOf(Series::class, $object->setFont(new Font())); - $this->assertInstanceOf(Font::class, $object->getFont()); + self::assertInstanceOf(Series::class, $object->setFont()); + self::assertNull($object->getFont()); + self::assertInstanceOf(Series::class, $object->setFont(new Font())); + self::assertInstanceOf(Font::class, $object->getFont()); } public function testHashIndex(): void @@ -103,82 +102,82 @@ public function testHashIndex(): void $object = new Series(); $value = mt_rand(1, 100); - $this->assertEmpty($object->getHashIndex()); - $this->assertInstanceOf(Series::class, $object->setHashIndex($value)); - $this->assertEquals($value, $object->getHashIndex()); + self::assertEmpty($object->getHashIndex()); + self::assertInstanceOf(Series::class, $object->setHashIndex($value)); + self::assertEquals($value, $object->getHashIndex()); } public function testHashCode(): void { $object = new Series(); - $this->assertEquals(md5($object->getFill()->getHashCode() . $object->getFont()->getHashCode() . var_export($object->getValues(), true) . var_export($object, true) . get_class($object)), $object->getHashCode()); + self::assertEquals(md5($object->getFill()->getHashCode() . $object->getFont()->getHashCode() . var_export($object->getValues(), true) . var_export($object, true) . get_class($object)), $object->getHashCode()); } public function testLabelPosition(): void { $object = new Series(); - $this->assertEmpty($object->getHashIndex()); - $this->assertInstanceOf(Series::class, $object->setLabelPosition(Series::LABEL_INSIDEBASE)); - $this->assertEquals(Series::LABEL_INSIDEBASE, $object->getLabelPosition()); + self::assertEmpty($object->getHashIndex()); + self::assertInstanceOf(Series::class, $object->setLabelPosition(Series::LABEL_INSIDEBASE)); + self::assertEquals(Series::LABEL_INSIDEBASE, $object->getLabelPosition()); } public function testMarker(): void { $object = new Series(); - $this->assertInstanceOf(Series::class, $object->setMarker(new Marker())); - $this->assertInstanceOf(Marker::class, $object->getMarker()); + self::assertInstanceOf(Series::class, $object->setMarker(new Marker())); + self::assertInstanceOf(Marker::class, $object->getMarker()); } public function testOutline(): void { $object = new Series(); - $this->assertInstanceOf(Series::class, $object->setOutline(new Outline())); - $this->assertInstanceOf(Outline::class, $object->getOutline()); + self::assertInstanceOf(Series::class, $object->setOutline(new Outline())); + self::assertInstanceOf(Outline::class, $object->getOutline()); } public function testShowCategoryName(): void { $object = new Series(); - $this->assertInstanceOf(Series::class, $object->setShowCategoryName(true)); - $this->assertTrue($object->hasShowCategoryName()); - $this->assertInstanceOf(Series::class, $object->setShowCategoryName(false)); - $this->assertFalse($object->hasShowCategoryName()); + self::assertInstanceOf(Series::class, $object->setShowCategoryName(true)); + self::assertTrue($object->hasShowCategoryName()); + self::assertInstanceOf(Series::class, $object->setShowCategoryName(false)); + self::assertFalse($object->hasShowCategoryName()); } public function testShowLeaderLines(): void { $object = new Series(); - $this->assertInstanceOf(Series::class, $object->setShowLeaderLines(true)); - $this->assertTrue($object->hasShowLeaderLines()); - $this->assertInstanceOf(Series::class, $object->setShowLeaderLines(false)); - $this->assertFalse($object->hasShowLeaderLines()); + self::assertInstanceOf(Series::class, $object->setShowLeaderLines(true)); + self::assertTrue($object->hasShowLeaderLines()); + self::assertInstanceOf(Series::class, $object->setShowLeaderLines(false)); + self::assertFalse($object->hasShowLeaderLines()); } public function testShowLegendKey(): void { $object = new Series(); - $this->assertFalse($object->hasShowLegendKey()); - $this->assertInstanceOf(Series::class, $object->setShowLegendKey(true)); - $this->assertTrue($object->hasShowLegendKey()); - $this->assertInstanceOf(Series::class, $object->setShowLegendKey(false)); - $this->assertFalse($object->hasShowLegendKey()); + self::assertFalse($object->hasShowLegendKey()); + self::assertInstanceOf(Series::class, $object->setShowLegendKey(true)); + self::assertTrue($object->hasShowLegendKey()); + self::assertInstanceOf(Series::class, $object->setShowLegendKey(false)); + self::assertFalse($object->hasShowLegendKey()); } public function testShowPercentage(): void { $object = new Series(); - $this->assertInstanceOf(Series::class, $object->setShowPercentage(true)); - $this->assertTrue($object->hasShowPercentage()); - $this->assertInstanceOf(Series::class, $object->setShowPercentage(false)); - $this->assertFalse($object->hasShowPercentage()); + self::assertInstanceOf(Series::class, $object->setShowPercentage(true)); + self::assertTrue($object->hasShowPercentage()); + self::assertInstanceOf(Series::class, $object->setShowPercentage(false)); + self::assertFalse($object->hasShowPercentage()); } public function testShowSeparator(): void @@ -186,42 +185,42 @@ public function testShowSeparator(): void $value = ';'; $object = new Series(); - $this->assertFalse($object->hasShowSeparator()); - $this->assertInstanceOf(Series::class, $object->setSeparator($value)); - $this->assertEquals($value, $object->getSeparator()); - $this->assertTrue($object->hasShowSeparator()); - $this->assertInstanceOf(Series::class, $object->setSeparator('')); - $this->assertFalse($object->hasShowPercentage()); + self::assertFalse($object->hasShowSeparator()); + self::assertInstanceOf(Series::class, $object->setSeparator($value)); + self::assertEquals($value, $object->getSeparator()); + self::assertTrue($object->hasShowSeparator()); + self::assertInstanceOf(Series::class, $object->setSeparator('')); + self::assertFalse($object->hasShowPercentage()); } public function testShowSeriesName(): void { $object = new Series(); - $this->assertInstanceOf(Series::class, $object->setShowSeriesName(true)); - $this->assertTrue($object->hasShowSeriesName()); - $this->assertInstanceOf(Series::class, $object->setShowSeriesName(false)); - $this->assertFalse($object->hasShowSeriesName()); + self::assertInstanceOf(Series::class, $object->setShowSeriesName(true)); + self::assertTrue($object->hasShowSeriesName()); + self::assertInstanceOf(Series::class, $object->setShowSeriesName(false)); + self::assertFalse($object->hasShowSeriesName()); } public function testShowValue(): void { $object = new Series(); - $this->assertInstanceOf(Series::class, $object->setShowValue(true)); - $this->assertTrue($object->hasShowValue()); - $this->assertInstanceOf(Series::class, $object->setShowValue(false)); - $this->assertFalse($object->hasShowValue()); + self::assertInstanceOf(Series::class, $object->setShowValue(true)); + self::assertTrue($object->hasShowValue()); + self::assertInstanceOf(Series::class, $object->setShowValue(false)); + self::assertFalse($object->hasShowValue()); } public function testTitle(): void { $object = new Series(); - $this->assertInstanceOf(Series::class, $object->setTitle()); - $this->assertEquals('Series Title', $object->getTitle()); - $this->assertInstanceOf(Series::class, $object->setTitle('AAAA')); - $this->assertEquals('AAAA', $object->getTitle()); + self::assertInstanceOf(Series::class, $object->setTitle()); + self::assertEquals('Series Title', $object->getTitle()); + self::assertInstanceOf(Series::class, $object->setTitle('AAAA')); + self::assertEquals('AAAA', $object->getTitle()); } public function testValue(): void @@ -236,14 +235,14 @@ public function testValue(): void '3' => 'd', ]; - $this->assertIsArray($object->getValues()); - $this->assertEmpty($object->getValues()); - $this->assertInstanceOf(Series::class, $object->setValues()); - $this->assertEmpty($object->getValues()); - $this->assertInstanceOf(Series::class, $object->setValues($array)); - $this->assertCount(count($array), $object->getValues()); - $this->assertInstanceOf(Series::class, $object->addValue('4', 'e')); - $this->assertCount(count($array) + 1, $object->getValues()); + self::assertIsArray($object->getValues()); + self::assertEmpty($object->getValues()); + self::assertInstanceOf(Series::class, $object->setValues()); + self::assertEmpty($object->getValues()); + self::assertInstanceOf(Series::class, $object->setValues($array)); + self::assertCount(count($array), $object->getValues()); + self::assertInstanceOf(Series::class, $object->addValue('4', 'e')); + self::assertCount(count($array) + 1, $object->getValues()); } public function testClone(): void @@ -252,7 +251,7 @@ public function testClone(): void $object->setOutline(new Outline()); $clone = clone $object; - $this->assertInstanceOf(Series::class, $clone); - $this->assertInstanceOf(Outline::class, $clone->getOutline()); + self::assertInstanceOf(Series::class, $clone); + self::assertInstanceOf(Outline::class, $clone->getOutline()); } } diff --git a/tests/PhpPresentation/Tests/Shape/Chart/TitleTest.php b/tests/PhpPresentation/Tests/Shape/Chart/TitleTest.php index a2e076451..886718625 100644 --- a/tests/PhpPresentation/Tests/Shape/Chart/TitleTest.php +++ b/tests/PhpPresentation/Tests/Shape/Chart/TitleTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -36,28 +35,28 @@ public function testConstruct(): void { $object = new Title(); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Alignment', $object->getAlignment()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Font', $object->getFont()); - $this->assertEquals('Calibri', $object->getFont()->getName()); - $this->assertEquals(18, $object->getFont()->getSize()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Alignment', $object->getAlignment()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Font', $object->getFont()); + self::assertEquals('Calibri', $object->getFont()->getName()); + self::assertEquals(18, $object->getFont()->getSize()); } public function testAlignment(): void { $object = new Title(); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Title', $object->setAlignment(new Alignment())); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Alignment', $object->getAlignment()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Title', $object->setAlignment(new Alignment())); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Alignment', $object->getAlignment()); } public function testFont(): void { $object = new Title(); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Title', $object->setFont()); - $this->assertNull($object->getFont()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Title', $object->setFont(new Font())); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Font', $object->getFont()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Title', $object->setFont()); + self::assertNull($object->getFont()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Title', $object->setFont(new Font())); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Font', $object->getFont()); } public function testHashIndex(): void @@ -65,9 +64,9 @@ public function testHashIndex(): void $object = new Title(); $value = mt_rand(1, 100); - $this->assertEmpty($object->getHashIndex()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Title', $object->setHashIndex($value)); - $this->assertEquals($value, $object->getHashIndex()); + self::assertEmpty($object->getHashIndex()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Title', $object->setHashIndex($value)); + self::assertEquals($value, $object->getHashIndex()); } public function testHeight(): void @@ -75,10 +74,10 @@ public function testHeight(): void $object = new Title(); $value = mt_rand(0, 100); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Title', $object->setHeight()); - $this->assertEquals(0, $object->getHeight()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Title', $object->setHeight($value)); - $this->assertEquals($value, $object->getHeight()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Title', $object->setHeight()); + self::assertEquals(0, $object->getHeight()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Title', $object->setHeight($value)); + self::assertEquals($value, $object->getHeight()); } public function testOffsetX(): void @@ -86,10 +85,10 @@ public function testOffsetX(): void $object = new Title(); $value = mt_rand(0, 100); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Title', $object->setOffsetX()); - $this->assertEquals(0.01, $object->getOffsetX()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Title', $object->setOffsetX($value)); - $this->assertEquals($value, $object->getOffsetX()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Title', $object->setOffsetX()); + self::assertEquals(0.01, $object->getOffsetX()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Title', $object->setOffsetX($value)); + self::assertEquals($value, $object->getOffsetX()); } public function testOffsetY(): void @@ -97,32 +96,32 @@ public function testOffsetY(): void $object = new Title(); $value = mt_rand(0, 100); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Title', $object->setOffsetY()); - $this->assertEquals(0.01, $object->getOffsetY()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Title', $object->setOffsetY($value)); - $this->assertEquals($value, $object->getOffsetY()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Title', $object->setOffsetY()); + self::assertEquals(0.01, $object->getOffsetY()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Title', $object->setOffsetY($value)); + self::assertEquals($value, $object->getOffsetY()); } public function testText(): void { $object = new Title(); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Title', $object->setText()); - $this->assertNull($object->getText()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Title', $object->setText('AAAA')); - $this->assertEquals('AAAA', $object->getText()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Title', $object->setText()); + self::assertNull($object->getText()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Title', $object->setText('AAAA')); + self::assertEquals('AAAA', $object->getText()); } public function testVisible(): void { $object = new Title(); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Title', $object->setVisible()); - $this->assertTrue($object->isVisible()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Title', $object->setVisible(true)); - $this->assertTrue($object->isVisible()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Title', $object->setVisible(false)); - $this->assertFalse($object->isVisible()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Title', $object->setVisible()); + self::assertTrue($object->isVisible()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Title', $object->setVisible(true)); + self::assertTrue($object->isVisible()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Title', $object->setVisible(false)); + self::assertFalse($object->isVisible()); } public function testWidth(): void @@ -130,9 +129,9 @@ public function testWidth(): void $object = new Title(); $value = mt_rand(0, 100); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Title', $object->setWidth()); - $this->assertEquals(0, $object->getWidth()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Title', $object->setWidth($value)); - $this->assertEquals($value, $object->getWidth()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Title', $object->setWidth()); + self::assertEquals(0, $object->getWidth()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Title', $object->setWidth($value)); + self::assertEquals($value, $object->getWidth()); } } diff --git a/tests/PhpPresentation/Tests/Shape/Chart/Type/AbstractTest.php b/tests/PhpPresentation/Tests/Shape/Chart/Type/AbstractTest.php index d19327eba..0addee599 100644 --- a/tests/PhpPresentation/Tests/Shape/Chart/Type/AbstractTest.php +++ b/tests/PhpPresentation/Tests/Shape/Chart/Type/AbstractTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -36,8 +35,8 @@ public function testAxis(): void { $object = new Scatter(); - $this->assertTrue($object->hasAxisX()); - $this->assertTrue($object->hasAxisY()); + self::assertTrue($object->hasAxisX()); + self::assertTrue($object->hasAxisY()); } public function testHashIndex(): void @@ -45,25 +44,25 @@ public function testHashIndex(): void $object = new Scatter(); $value = mt_rand(1, 100); - $this->assertEmpty($object->getHashIndex()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Scatter', $object->setHashIndex($value)); - $this->assertEquals($value, $object->getHashIndex()); + self::assertEmpty($object->getHashIndex()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Scatter', $object->setHashIndex($value)); + self::assertEquals($value, $object->getHashIndex()); } public function testSeries(): void { /** @var AbstractType $stub */ $stub = $this->getMockForAbstractClass(AbstractType::class); - $this->assertEmpty($stub->getSeries()); - $this->assertIsArray($stub->getSeries()); + self::assertEmpty($stub->getSeries()); + self::assertIsArray($stub->getSeries()); $arraySeries = [ new Series(), new Series(), ]; - $this->assertInstanceOf(AbstractType::class, $stub->setSeries($arraySeries)); - $this->assertIsArray($stub->getSeries()); - $this->assertCount(count($arraySeries), $stub->getSeries()); + self::assertInstanceOf(AbstractType::class, $stub->setSeries($arraySeries)); + self::assertIsArray($stub->getSeries()); + self::assertCount(count($arraySeries), $stub->getSeries()); } public function testClone(): void @@ -80,8 +79,8 @@ public function testClone(): void $stub->setSeries($arraySeries); $clone = clone $stub; - $this->assertInstanceOf(AbstractType::class, $clone); - $this->assertIsArray($stub->getSeries()); - $this->assertCount(count($arraySeries), $stub->getSeries()); + self::assertInstanceOf(AbstractType::class, $clone); + self::assertIsArray($stub->getSeries()); + self::assertCount(count($arraySeries), $stub->getSeries()); } } diff --git a/tests/PhpPresentation/Tests/Shape/Chart/Type/AreaTest.php b/tests/PhpPresentation/Tests/Shape/Chart/Type/AreaTest.php index e1eba28f6..af93fa19c 100644 --- a/tests/PhpPresentation/Tests/Shape/Chart/Type/AreaTest.php +++ b/tests/PhpPresentation/Tests/Shape/Chart/Type/AreaTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -35,26 +34,26 @@ public function testData(): void { $object = new Area(); - $this->assertIsArray($object->getSeries()); - $this->assertEmpty($object->getSeries()); + self::assertIsArray($object->getSeries()); + self::assertEmpty($object->getSeries()); $array = [ new Series(), new Series(), ]; - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Area', $object->setSeries()); - $this->assertEmpty($object->getSeries()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Area', $object->setSeries($array)); - $this->assertCount(count($array), $object->getSeries()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Area', $object->setSeries()); + self::assertEmpty($object->getSeries()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Area', $object->setSeries($array)); + self::assertCount(count($array), $object->getSeries()); } public function testSeries(): void { $object = new Area(); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Area', $object->addSeries(new Series())); - $this->assertCount(1, $object->getSeries()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Area', $object->addSeries(new Series())); + self::assertCount(1, $object->getSeries()); } public function testHashCode(): void @@ -64,6 +63,6 @@ public function testHashCode(): void $object = new Area(); $object->addSeries($oSeries); - $this->assertEquals(md5($oSeries->getHashCode() . get_class($object)), $object->getHashCode()); + self::assertEquals(md5($oSeries->getHashCode() . get_class($object)), $object->getHashCode()); } } diff --git a/tests/PhpPresentation/Tests/Shape/Chart/Type/Bar3DTest.php b/tests/PhpPresentation/Tests/Shape/Chart/Type/Bar3DTest.php index 68df16e1f..137d57729 100644 --- a/tests/PhpPresentation/Tests/Shape/Chart/Type/Bar3DTest.php +++ b/tests/PhpPresentation/Tests/Shape/Chart/Type/Bar3DTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -35,61 +34,61 @@ public function testData(): void { $object = new Bar3D(); - $this->assertIsArray($object->getSeries()); - $this->assertEmpty($object->getSeries()); + self::assertIsArray($object->getSeries()); + self::assertEmpty($object->getSeries()); $array = [ new Series(), new Series(), ]; - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Bar3D', $object->setSeries()); - $this->assertEmpty($object->getSeries()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Bar3D', $object->setSeries($array)); - $this->assertCount(count($array), $object->getSeries()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Bar3D', $object->setSeries()); + self::assertEmpty($object->getSeries()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Bar3D', $object->setSeries($array)); + self::assertCount(count($array), $object->getSeries()); } public function testSeries(): void { $object = new Bar3D(); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Bar3D', $object->addSeries(new Series())); - $this->assertCount(1, $object->getSeries()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Bar3D', $object->addSeries(new Series())); + self::assertCount(1, $object->getSeries()); } public function testBarDirection(): void { $object = new Bar3D(); - $this->assertEquals(Bar3D::DIRECTION_VERTICAL, $object->getBarDirection()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Bar3D', $object->setBarDirection(Bar3D::DIRECTION_HORIZONTAL)); - $this->assertEquals(Bar3D::DIRECTION_HORIZONTAL, $object->getBarDirection()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Bar3D', $object->setBarDirection(Bar3D::DIRECTION_VERTICAL)); - $this->assertEquals(Bar3D::DIRECTION_VERTICAL, $object->getBarDirection()); + self::assertEquals(Bar3D::DIRECTION_VERTICAL, $object->getBarDirection()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Bar3D', $object->setBarDirection(Bar3D::DIRECTION_HORIZONTAL)); + self::assertEquals(Bar3D::DIRECTION_HORIZONTAL, $object->getBarDirection()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Bar3D', $object->setBarDirection(Bar3D::DIRECTION_VERTICAL)); + self::assertEquals(Bar3D::DIRECTION_VERTICAL, $object->getBarDirection()); } public function testBarGrouping(): void { $object = new Bar3D(); - $this->assertEquals(Bar3D::GROUPING_CLUSTERED, $object->getBarGrouping()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Bar3D', $object->setBarGrouping(Bar3D::GROUPING_CLUSTERED)); - $this->assertEquals(Bar3D::GROUPING_CLUSTERED, $object->getBarGrouping()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Bar3D', $object->setBarGrouping(Bar3D::GROUPING_STACKED)); - $this->assertEquals(Bar3D::GROUPING_STACKED, $object->getBarGrouping()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Bar3D', $object->setBarGrouping(Bar3D::GROUPING_PERCENTSTACKED)); - $this->assertEquals(Bar3D::GROUPING_PERCENTSTACKED, $object->getBarGrouping()); + self::assertEquals(Bar3D::GROUPING_CLUSTERED, $object->getBarGrouping()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Bar3D', $object->setBarGrouping(Bar3D::GROUPING_CLUSTERED)); + self::assertEquals(Bar3D::GROUPING_CLUSTERED, $object->getBarGrouping()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Bar3D', $object->setBarGrouping(Bar3D::GROUPING_STACKED)); + self::assertEquals(Bar3D::GROUPING_STACKED, $object->getBarGrouping()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Bar3D', $object->setBarGrouping(Bar3D::GROUPING_PERCENTSTACKED)); + self::assertEquals(Bar3D::GROUPING_PERCENTSTACKED, $object->getBarGrouping()); } public function testGapWidthPercent(): void { $value = mt_rand(0, 500); $object = new Bar3D(); - $this->assertEquals(150, $object->getGapWidthPercent()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Bar3D', $object->setGapWidthPercent($value)); - $this->assertEquals($value, $object->getGapWidthPercent()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Bar3D', $object->setGapWidthPercent(-1)); - $this->assertEquals(0, $object->getGapWidthPercent()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Bar3D', $object->setGapWidthPercent(501)); - $this->assertEquals(500, $object->getGapWidthPercent()); + self::assertEquals(150, $object->getGapWidthPercent()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Bar3D', $object->setGapWidthPercent($value)); + self::assertEquals($value, $object->getGapWidthPercent()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Bar3D', $object->setGapWidthPercent(-1)); + self::assertEquals(0, $object->getGapWidthPercent()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Bar3D', $object->setGapWidthPercent(501)); + self::assertEquals(500, $object->getGapWidthPercent()); } public function testHashCode(): void @@ -99,6 +98,6 @@ public function testHashCode(): void $object = new Bar3D(); $object->addSeries($oSeries); - $this->assertEquals(md5($oSeries->getHashCode() . get_class($object)), $object->getHashCode()); + self::assertEquals(md5($oSeries->getHashCode() . get_class($object)), $object->getHashCode()); } } diff --git a/tests/PhpPresentation/Tests/Shape/Chart/Type/BarTest.php b/tests/PhpPresentation/Tests/Shape/Chart/Type/BarTest.php index 8b7dbd7dc..88dd6dab8 100644 --- a/tests/PhpPresentation/Tests/Shape/Chart/Type/BarTest.php +++ b/tests/PhpPresentation/Tests/Shape/Chart/Type/BarTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -35,87 +34,87 @@ public function testData(): void { $object = new Bar(); - $this->assertIsArray($object->getSeries()); - $this->assertEmpty($object->getSeries()); + self::assertIsArray($object->getSeries()); + self::assertEmpty($object->getSeries()); $array = [ new Series(), new Series(), ]; - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Bar', $object->setSeries()); - $this->assertEmpty($object->getSeries()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Bar', $object->setSeries($array)); - $this->assertCount(count($array), $object->getSeries()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Bar', $object->setSeries()); + self::assertEmpty($object->getSeries()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Bar', $object->setSeries($array)); + self::assertCount(count($array), $object->getSeries()); } public function testSeries(): void { $object = new Bar(); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Bar', $object->addSeries(new Series())); - $this->assertCount(1, $object->getSeries()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Bar', $object->addSeries(new Series())); + self::assertCount(1, $object->getSeries()); } public function testBarDirection(): void { $object = new Bar(); - $this->assertEquals(Bar::DIRECTION_VERTICAL, $object->getBarDirection()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Bar', $object->setBarDirection(Bar::DIRECTION_HORIZONTAL)); - $this->assertEquals(Bar::DIRECTION_HORIZONTAL, $object->getBarDirection()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Bar', $object->setBarDirection(Bar::DIRECTION_VERTICAL)); - $this->assertEquals(Bar::DIRECTION_VERTICAL, $object->getBarDirection()); + self::assertEquals(Bar::DIRECTION_VERTICAL, $object->getBarDirection()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Bar', $object->setBarDirection(Bar::DIRECTION_HORIZONTAL)); + self::assertEquals(Bar::DIRECTION_HORIZONTAL, $object->getBarDirection()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Bar', $object->setBarDirection(Bar::DIRECTION_VERTICAL)); + self::assertEquals(Bar::DIRECTION_VERTICAL, $object->getBarDirection()); } public function testBarGrouping(): void { $object = new Bar(); - $this->assertEquals(Bar::GROUPING_CLUSTERED, $object->getBarGrouping()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Bar', $object->setBarGrouping(Bar::GROUPING_CLUSTERED)); - $this->assertEquals(Bar::GROUPING_CLUSTERED, $object->getBarGrouping()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Bar', $object->setBarGrouping(Bar::GROUPING_STACKED)); - $this->assertEquals(Bar::GROUPING_STACKED, $object->getBarGrouping()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Bar', $object->setBarGrouping(Bar::GROUPING_PERCENTSTACKED)); - $this->assertEquals(Bar::GROUPING_PERCENTSTACKED, $object->getBarGrouping()); + self::assertEquals(Bar::GROUPING_CLUSTERED, $object->getBarGrouping()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Bar', $object->setBarGrouping(Bar::GROUPING_CLUSTERED)); + self::assertEquals(Bar::GROUPING_CLUSTERED, $object->getBarGrouping()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Bar', $object->setBarGrouping(Bar::GROUPING_STACKED)); + self::assertEquals(Bar::GROUPING_STACKED, $object->getBarGrouping()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Bar', $object->setBarGrouping(Bar::GROUPING_PERCENTSTACKED)); + self::assertEquals(Bar::GROUPING_PERCENTSTACKED, $object->getBarGrouping()); } public function testGapWidthPercent(): void { $value = mt_rand(0, 500); $object = new Bar(); - $this->assertEquals(150, $object->getGapWidthPercent()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Bar', $object->setGapWidthPercent($value)); - $this->assertEquals($value, $object->getGapWidthPercent()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Bar', $object->setGapWidthPercent(-1)); - $this->assertEquals(0, $object->getGapWidthPercent()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Bar', $object->setGapWidthPercent(501)); - $this->assertEquals(500, $object->getGapWidthPercent()); + self::assertEquals(150, $object->getGapWidthPercent()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Bar', $object->setGapWidthPercent($value)); + self::assertEquals($value, $object->getGapWidthPercent()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Bar', $object->setGapWidthPercent(-1)); + self::assertEquals(0, $object->getGapWidthPercent()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Bar', $object->setGapWidthPercent(501)); + self::assertEquals(500, $object->getGapWidthPercent()); } public function testOverlapWidthPercentDefaults(): void { $object = new Bar(); - $this->assertEquals(0, $object->getOverlapWidthPercent()); + self::assertEquals(0, $object->getOverlapWidthPercent()); $object->setBarGrouping(Bar::GROUPING_STACKED); - $this->assertEquals(100, $object->getOverlapWidthPercent()); + self::assertEquals(100, $object->getOverlapWidthPercent()); $object->setBarGrouping(Bar::GROUPING_CLUSTERED); - $this->assertEquals(0, $object->getOverlapWidthPercent()); + self::assertEquals(0, $object->getOverlapWidthPercent()); $object->setBarGrouping(Bar::GROUPING_PERCENTSTACKED); - $this->assertEquals(100, $object->getOverlapWidthPercent()); + self::assertEquals(100, $object->getOverlapWidthPercent()); } public function testOverlapWidthPercent(): void { $value = mt_rand(-100, 100); $object = new Bar(); - $this->assertEquals(0, $object->getOverlapWidthPercent()); - $this->assertInstanceOf(Bar::class, $object->setOverlapWidthPercent($value)); - $this->assertEquals($value, $object->getOverlapWidthPercent()); - $this->assertInstanceOf(Bar::class, $object->setOverlapWidthPercent(101)); - $this->assertEquals(100, $object->getOverlapWidthPercent()); - $this->assertInstanceOf(Bar::class, $object->setOverlapWidthPercent(-101)); - $this->assertEquals(-100, $object->getOverlapWidthPercent()); + self::assertEquals(0, $object->getOverlapWidthPercent()); + self::assertInstanceOf(Bar::class, $object->setOverlapWidthPercent($value)); + self::assertEquals($value, $object->getOverlapWidthPercent()); + self::assertInstanceOf(Bar::class, $object->setOverlapWidthPercent(101)); + self::assertEquals(100, $object->getOverlapWidthPercent()); + self::assertInstanceOf(Bar::class, $object->setOverlapWidthPercent(-101)); + self::assertEquals(-100, $object->getOverlapWidthPercent()); } public function testHashCode(): void @@ -125,6 +124,6 @@ public function testHashCode(): void $object = new Bar(); $object->addSeries($oSeries); - $this->assertEquals(md5($oSeries->getHashCode() . get_class($object)), $object->getHashCode()); + self::assertEquals(md5($oSeries->getHashCode() . get_class($object)), $object->getHashCode()); } } diff --git a/tests/PhpPresentation/Tests/Shape/Chart/Type/DoughnutTest.php b/tests/PhpPresentation/Tests/Shape/Chart/Type/DoughnutTest.php index a6c8a2204..8b13b5043 100644 --- a/tests/PhpPresentation/Tests/Shape/Chart/Type/DoughnutTest.php +++ b/tests/PhpPresentation/Tests/Shape/Chart/Type/DoughnutTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -35,18 +34,18 @@ public function testData(): void { $object = new Doughnut(); - $this->assertIsArray($object->getSeries()); - $this->assertEmpty($object->getSeries()); + self::assertIsArray($object->getSeries()); + self::assertEmpty($object->getSeries()); $array = [ new Series(), new Series(), ]; - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Doughnut', $object->setSeries()); - $this->assertEmpty($object->getSeries()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Doughnut', $object->setSeries($array)); - $this->assertCount(count($array), $object->getSeries()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Doughnut', $object->setSeries()); + self::assertEmpty($object->getSeries()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Doughnut', $object->setSeries($array)); + self::assertCount(count($array), $object->getSeries()); } public function testHoleSize(): void @@ -54,23 +53,23 @@ public function testHoleSize(): void $rand = mt_rand(10, 90); $object = new Doughnut(); - $this->assertEquals(50, $object->getHoleSize()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Doughnut', $object->setHoleSize(9)); - $this->assertEquals(10, $object->getHoleSize()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Doughnut', $object->setHoleSize(91)); - $this->assertEquals(90, $object->getHoleSize()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Doughnut', $object->setHoleSize($rand)); - $this->assertEquals($rand, $object->getHoleSize()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Doughnut', $object->setHoleSize()); - $this->assertEquals(50, $object->getHoleSize()); + self::assertEquals(50, $object->getHoleSize()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Doughnut', $object->setHoleSize(9)); + self::assertEquals(10, $object->getHoleSize()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Doughnut', $object->setHoleSize(91)); + self::assertEquals(90, $object->getHoleSize()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Doughnut', $object->setHoleSize($rand)); + self::assertEquals($rand, $object->getHoleSize()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Doughnut', $object->setHoleSize()); + self::assertEquals(50, $object->getHoleSize()); } public function testSeries(): void { $object = new Doughnut(); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Doughnut', $object->addSeries(new Series())); - $this->assertCount(1, $object->getSeries()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Doughnut', $object->addSeries(new Series())); + self::assertCount(1, $object->getSeries()); } public function testHashCode(): void @@ -80,6 +79,6 @@ public function testHashCode(): void $object = new Doughnut(); $object->addSeries($oSeries); - $this->assertEquals(md5($oSeries->getHashCode() . get_class($object)), $object->getHashCode()); + self::assertEquals(md5($oSeries->getHashCode() . get_class($object)), $object->getHashCode()); } } diff --git a/tests/PhpPresentation/Tests/Shape/Chart/Type/LineTest.php b/tests/PhpPresentation/Tests/Shape/Chart/Type/LineTest.php index 05b6cb6f3..2a077b2ed 100644 --- a/tests/PhpPresentation/Tests/Shape/Chart/Type/LineTest.php +++ b/tests/PhpPresentation/Tests/Shape/Chart/Type/LineTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -35,35 +34,35 @@ public function testData(): void { $object = new Line(); - $this->assertIsArray($object->getSeries()); - $this->assertEmpty($object->getSeries()); + self::assertIsArray($object->getSeries()); + self::assertEmpty($object->getSeries()); $array = [ new Series(), new Series(), ]; - $this->assertInstanceOf(Line::class, $object->setSeries()); - $this->assertEmpty($object->getSeries()); - $this->assertInstanceOf(Line::class, $object->setSeries($array)); - $this->assertCount(count($array), $object->getSeries()); + self::assertInstanceOf(Line::class, $object->setSeries()); + self::assertEmpty($object->getSeries()); + self::assertInstanceOf(Line::class, $object->setSeries($array)); + self::assertCount(count($array), $object->getSeries()); } public function testSeries(): void { $object = new Line(); - $this->assertInstanceOf(Line::class, $object->addSeries(new Series())); - $this->assertCount(1, $object->getSeries()); + self::assertInstanceOf(Line::class, $object->addSeries(new Series())); + self::assertCount(1, $object->getSeries()); } public function testSmooth(): void { $object = new Line(); - $this->assertFalse($object->isSmooth()); - $this->assertInstanceOf(Line::class, $object->setIsSmooth(true)); - $this->assertTrue($object->isSmooth()); + self::assertFalse($object->isSmooth()); + self::assertInstanceOf(Line::class, $object->setIsSmooth(true)); + self::assertTrue($object->isSmooth()); } public function testHashCode(): void @@ -73,7 +72,7 @@ public function testHashCode(): void $object = new Line(); $object->addSeries($series); - $this->assertEquals( + self::assertEquals( md5(md5($object->isSmooth() ? '1' : '0') . $series->getHashCode() . get_class($object)), $object->getHashCode() ); diff --git a/tests/PhpPresentation/Tests/Shape/Chart/Type/Pie3DTest.php b/tests/PhpPresentation/Tests/Shape/Chart/Type/Pie3DTest.php index 33f825c17..dd259108b 100644 --- a/tests/PhpPresentation/Tests/Shape/Chart/Type/Pie3DTest.php +++ b/tests/PhpPresentation/Tests/Shape/Chart/Type/Pie3DTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -35,26 +34,26 @@ public function testData(): void { $object = new Pie3D(); - $this->assertIsArray($object->getSeries()); - $this->assertEmpty($object->getSeries()); + self::assertIsArray($object->getSeries()); + self::assertEmpty($object->getSeries()); $array = [ new Series(), new Series(), ]; - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Pie3D', $object->setSeries()); - $this->assertEmpty($object->getSeries()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Pie3D', $object->setSeries($array)); - $this->assertCount(count($array), $object->getSeries()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Pie3D', $object->setSeries()); + self::assertEmpty($object->getSeries()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Pie3D', $object->setSeries($array)); + self::assertCount(count($array), $object->getSeries()); } public function testSeries(): void { $object = new Pie3D(); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Pie3D', $object->addSeries(new Series())); - $this->assertCount(1, $object->getSeries()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Pie3D', $object->addSeries(new Series())); + self::assertCount(1, $object->getSeries()); } public function testExplosion(): void @@ -62,9 +61,9 @@ public function testExplosion(): void $value = mt_rand(0, 100); $object = new Pie3D(); - $this->assertEquals(0, $object->getExplosion()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Pie3D', $object->setExplosion($value)); - $this->assertEquals($value, $object->getExplosion()); + self::assertEquals(0, $object->getExplosion()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Pie3D', $object->setExplosion($value)); + self::assertEquals($value, $object->getExplosion()); } public function testHashCode(): void @@ -74,6 +73,6 @@ public function testHashCode(): void $object = new Pie3D(); $object->addSeries($oSeries); - $this->assertEquals(md5($oSeries->getHashCode() . get_class($object)), $object->getHashCode()); + self::assertEquals(md5($oSeries->getHashCode() . get_class($object)), $object->getHashCode()); } } diff --git a/tests/PhpPresentation/Tests/Shape/Chart/Type/PieTest.php b/tests/PhpPresentation/Tests/Shape/Chart/Type/PieTest.php index 42f5b5d6a..0ba4387a2 100644 --- a/tests/PhpPresentation/Tests/Shape/Chart/Type/PieTest.php +++ b/tests/PhpPresentation/Tests/Shape/Chart/Type/PieTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -35,26 +34,26 @@ public function testData(): void { $object = new Pie(); - $this->assertIsArray($object->getSeries()); - $this->assertEmpty($object->getSeries()); + self::assertIsArray($object->getSeries()); + self::assertEmpty($object->getSeries()); $array = [ new Series(), new Series(), ]; - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Pie', $object->setSeries()); - $this->assertEmpty($object->getSeries()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Pie', $object->setSeries($array)); - $this->assertCount(count($array), $object->getSeries()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Pie', $object->setSeries()); + self::assertEmpty($object->getSeries()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Pie', $object->setSeries($array)); + self::assertCount(count($array), $object->getSeries()); } public function testSeries(): void { $object = new Pie(); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Pie', $object->addSeries(new Series())); - $this->assertCount(1, $object->getSeries()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Type\\Pie', $object->addSeries(new Series())); + self::assertCount(1, $object->getSeries()); } public function testHashCode(): void @@ -64,6 +63,6 @@ public function testHashCode(): void $object = new Pie(); $object->addSeries($oSeries); - $this->assertEquals(md5($oSeries->getHashCode() . get_class($object)), $object->getHashCode()); + self::assertEquals(md5($oSeries->getHashCode() . get_class($object)), $object->getHashCode()); } } diff --git a/tests/PhpPresentation/Tests/Shape/Chart/Type/RadarTest.php b/tests/PhpPresentation/Tests/Shape/Chart/Type/RadarTest.php index 07a3cb2f9..e64621861 100644 --- a/tests/PhpPresentation/Tests/Shape/Chart/Type/RadarTest.php +++ b/tests/PhpPresentation/Tests/Shape/Chart/Type/RadarTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -33,6 +32,6 @@ public function testHashCode(): void $object = new Radar(); $object->addSeries($series); - $this->assertEquals(md5($series->getHashCode() . get_class($object)), $object->getHashCode()); + self::assertEquals(md5($series->getHashCode() . get_class($object)), $object->getHashCode()); } } diff --git a/tests/PhpPresentation/Tests/Shape/Chart/Type/ScatterTest.php b/tests/PhpPresentation/Tests/Shape/Chart/Type/ScatterTest.php index ca8134be7..36727ddbf 100644 --- a/tests/PhpPresentation/Tests/Shape/Chart/Type/ScatterTest.php +++ b/tests/PhpPresentation/Tests/Shape/Chart/Type/ScatterTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -35,35 +34,35 @@ public function testData(): void { $object = new Scatter(); - $this->assertIsArray($object->getSeries()); - $this->assertEmpty($object->getSeries()); + self::assertIsArray($object->getSeries()); + self::assertEmpty($object->getSeries()); $array = [ new Series(), new Series(), ]; - $this->assertInstanceOf(Scatter::class, $object->setSeries()); - $this->assertEmpty($object->getSeries()); - $this->assertInstanceOf(Scatter::class, $object->setSeries($array)); - $this->assertCount(count($array), $object->getSeries()); + self::assertInstanceOf(Scatter::class, $object->setSeries()); + self::assertEmpty($object->getSeries()); + self::assertInstanceOf(Scatter::class, $object->setSeries($array)); + self::assertCount(count($array), $object->getSeries()); } public function testSeries(): void { $object = new Scatter(); - $this->assertInstanceOf(Scatter::class, $object->addSeries(new Series())); - $this->assertCount(1, $object->getSeries()); + self::assertInstanceOf(Scatter::class, $object->addSeries(new Series())); + self::assertCount(1, $object->getSeries()); } public function testSmooth(): void { $object = new Scatter(); - $this->assertFalse($object->isSmooth()); - $this->assertInstanceOf(Scatter::class, $object->setIsSmooth(true)); - $this->assertTrue($object->isSmooth()); + self::assertFalse($object->isSmooth()); + self::assertInstanceOf(Scatter::class, $object->setIsSmooth(true)); + self::assertTrue($object->isSmooth()); } public function testHashCode(): void @@ -73,7 +72,7 @@ public function testHashCode(): void $object = new Scatter(); $object->addSeries($series); - $this->assertEquals( + self::assertEquals( md5(md5($object->isSmooth() ? '1' : '0') . $series->getHashCode() . get_class($object)), $object->getHashCode() ); diff --git a/tests/PhpPresentation/Tests/Shape/Chart/View3DTest.php b/tests/PhpPresentation/Tests/Shape/Chart/View3DTest.php index f86d39fb1..cbe311aa9 100644 --- a/tests/PhpPresentation/Tests/Shape/Chart/View3DTest.php +++ b/tests/PhpPresentation/Tests/Shape/Chart/View3DTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -35,10 +34,10 @@ public function testDepthPercent(): void $object = new View3D(); $value = mt_rand(20, 20000); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\View3D', $object->setDepthPercent()); - $this->assertEquals(100, $object->getDepthPercent()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\View3D', $object->setDepthPercent($value)); - $this->assertEquals($value, $object->getDepthPercent()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\View3D', $object->setDepthPercent()); + self::assertEquals(100, $object->getDepthPercent()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\View3D', $object->setDepthPercent($value)); + self::assertEquals($value, $object->getDepthPercent()); } public function testHashIndex(): void @@ -46,9 +45,9 @@ public function testHashIndex(): void $object = new View3D(); $value = mt_rand(1, 100); - $this->assertEmpty($object->getHashIndex()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\View3D', $object->setHashIndex($value)); - $this->assertEquals($value, $object->getHashIndex()); + self::assertEmpty($object->getHashIndex()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\View3D', $object->setHashIndex($value)); + self::assertEquals($value, $object->getHashIndex()); } public function testHeightPercent(): void @@ -56,10 +55,10 @@ public function testHeightPercent(): void $object = new View3D(); $value = mt_rand(5, 500); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\View3D', $object->setHeightPercent()); - $this->assertEquals(100, $object->getHeightPercent()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\View3D', $object->setHeightPercent($value)); - $this->assertEquals($value, $object->getHeightPercent()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\View3D', $object->setHeightPercent()); + self::assertEquals(100, $object->getHeightPercent()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\View3D', $object->setHeightPercent($value)); + self::assertEquals($value, $object->getHeightPercent()); } public function testPerspective(): void @@ -67,22 +66,22 @@ public function testPerspective(): void $object = new View3D(); $value = mt_rand(0, 100); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\View3D', $object->setPerspective()); - $this->assertEquals(30, $object->getPerspective()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\View3D', $object->setPerspective($value)); - $this->assertEquals($value, $object->getPerspective()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\View3D', $object->setPerspective()); + self::assertEquals(30, $object->getPerspective()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\View3D', $object->setPerspective($value)); + self::assertEquals($value, $object->getPerspective()); } public function testRightAngleAxes(): void { $object = new View3D(); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\View3D', $object->setRightAngleAxes()); - $this->assertTrue($object->hasRightAngleAxes()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\View3D', $object->setRightAngleAxes(true)); - $this->assertTrue($object->hasRightAngleAxes()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\View3D', $object->setRightAngleAxes(false)); - $this->assertFalse($object->hasRightAngleAxes()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\View3D', $object->setRightAngleAxes()); + self::assertTrue($object->hasRightAngleAxes()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\View3D', $object->setRightAngleAxes(true)); + self::assertTrue($object->hasRightAngleAxes()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\View3D', $object->setRightAngleAxes(false)); + self::assertFalse($object->hasRightAngleAxes()); } public function testRotationX(): void @@ -90,10 +89,10 @@ public function testRotationX(): void $object = new View3D(); $value = mt_rand(-90, 90); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\View3D', $object->setRotationX()); - $this->assertEquals(0, $object->getRotationX()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\View3D', $object->setRotationX($value)); - $this->assertEquals($value, $object->getRotationX()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\View3D', $object->setRotationX()); + self::assertEquals(0, $object->getRotationX()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\View3D', $object->setRotationX($value)); + self::assertEquals($value, $object->getRotationX()); } public function testRotationY(): void @@ -101,9 +100,9 @@ public function testRotationY(): void $object = new View3D(); $value = mt_rand(-90, 90); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\View3D', $object->setRotationY()); - $this->assertEquals(0, $object->getRotationY()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\View3D', $object->setRotationY($value)); - $this->assertEquals($value, $object->getRotationY()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\View3D', $object->setRotationY()); + self::assertEquals(0, $object->getRotationY()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\View3D', $object->setRotationY($value)); + self::assertEquals($value, $object->getRotationY()); } } diff --git a/tests/PhpPresentation/Tests/Shape/ChartTest.php b/tests/PhpPresentation/Tests/Shape/ChartTest.php index b51d85775..2322df83f 100644 --- a/tests/PhpPresentation/Tests/Shape/ChartTest.php +++ b/tests/PhpPresentation/Tests/Shape/ChartTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -34,10 +33,10 @@ public function testConstruct(): void { $object = new Chart(); - $this->assertInstanceOf(Chart\Title::class, $object->getTitle()); - $this->assertInstanceOf(Chart\Legend::class, $object->getLegend()); - $this->assertInstanceOf(Chart\PlotArea::class, $object->getPlotArea()); - $this->assertInstanceOf(Chart\View3D::class, $object->getView3D()); + self::assertInstanceOf(Chart\Title::class, $object->getTitle()); + self::assertInstanceOf(Chart\Legend::class, $object->getLegend()); + self::assertInstanceOf(Chart\PlotArea::class, $object->getPlotArea()); + self::assertInstanceOf(Chart\View3D::class, $object->getView3D()); } public function testClone(): void @@ -46,38 +45,38 @@ public function testClone(): void $oClone = clone $object; - $this->assertInstanceOf(Chart::class, $oClone); - $this->assertInstanceOf(Chart\Title::class, $oClone->getTitle()); - $this->assertInstanceOf(Chart\Legend::class, $oClone->getLegend()); - $this->assertInstanceOf(Chart\PlotArea::class, $oClone->getPlotArea()); - $this->assertInstanceOf(Chart\View3D::class, $oClone->getView3D()); + self::assertInstanceOf(Chart::class, $oClone); + self::assertInstanceOf(Chart\Title::class, $oClone->getTitle()); + self::assertInstanceOf(Chart\Legend::class, $oClone->getLegend()); + self::assertInstanceOf(Chart\PlotArea::class, $oClone->getPlotArea()); + self::assertInstanceOf(Chart\View3D::class, $oClone->getView3D()); } public function testDisplayBlankAs(): void { $object = new Chart(); - $this->assertEquals(Chart::BLANKAS_ZERO, $object->getDisplayBlankAs()); - $this->assertInstanceOf(Chart::class, $object->setDisplayBlankAs(Chart::BLANKAS_GAP)); - $this->assertEquals(Chart::BLANKAS_GAP, $object->getDisplayBlankAs()); - $this->assertInstanceOf(Chart::class, $object->setDisplayBlankAs(Chart::BLANKAS_ZERO)); - $this->assertEquals(Chart::BLANKAS_ZERO, $object->getDisplayBlankAs()); - $this->assertInstanceOf(Chart::class, $object->setDisplayBlankAs(Chart::BLANKAS_SPAN)); - $this->assertEquals(Chart::BLANKAS_SPAN, $object->getDisplayBlankAs()); - $this->assertInstanceOf(Chart::class, $object->setDisplayBlankAs('Unauthorized value')); - $this->assertEquals(Chart::BLANKAS_SPAN, $object->getDisplayBlankAs()); + self::assertEquals(Chart::BLANKAS_ZERO, $object->getDisplayBlankAs()); + self::assertInstanceOf(Chart::class, $object->setDisplayBlankAs(Chart::BLANKAS_GAP)); + self::assertEquals(Chart::BLANKAS_GAP, $object->getDisplayBlankAs()); + self::assertInstanceOf(Chart::class, $object->setDisplayBlankAs(Chart::BLANKAS_ZERO)); + self::assertEquals(Chart::BLANKAS_ZERO, $object->getDisplayBlankAs()); + self::assertInstanceOf(Chart::class, $object->setDisplayBlankAs(Chart::BLANKAS_SPAN)); + self::assertEquals(Chart::BLANKAS_SPAN, $object->getDisplayBlankAs()); + self::assertInstanceOf(Chart::class, $object->setDisplayBlankAs('Unauthorized value')); + self::assertEquals(Chart::BLANKAS_SPAN, $object->getDisplayBlankAs()); } public function testIncludeSpreadsheet(): void { $object = new Chart(); - $this->assertFalse($object->hasIncludedSpreadsheet()); - $this->assertInstanceOf(Chart::class, $object->setIncludeSpreadsheet()); - $this->assertFalse($object->hasIncludedSpreadsheet()); - $this->assertInstanceOf(Chart::class, $object->setIncludeSpreadsheet(false)); - $this->assertFalse($object->hasIncludedSpreadsheet()); - $this->assertInstanceOf(Chart::class, $object->setIncludeSpreadsheet(true)); - $this->assertTrue($object->hasIncludedSpreadsheet()); + self::assertFalse($object->hasIncludedSpreadsheet()); + self::assertInstanceOf(Chart::class, $object->setIncludeSpreadsheet()); + self::assertFalse($object->hasIncludedSpreadsheet()); + self::assertInstanceOf(Chart::class, $object->setIncludeSpreadsheet(false)); + self::assertFalse($object->hasIncludedSpreadsheet()); + self::assertInstanceOf(Chart::class, $object->setIncludeSpreadsheet(true)); + self::assertTrue($object->hasIncludedSpreadsheet()); } } diff --git a/tests/PhpPresentation/Tests/Shape/Comment/AuthorTest.php b/tests/PhpPresentation/Tests/Shape/Comment/AuthorTest.php index e70554246..202275113 100644 --- a/tests/PhpPresentation/Tests/Shape/Comment/AuthorTest.php +++ b/tests/PhpPresentation/Tests/Shape/Comment/AuthorTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -34,9 +33,9 @@ public function testConstruct(): void { $object = new Author(); - $this->assertNull($object->getName()); - $this->assertNull($object->getIndex()); - $this->assertNull($object->getInitials()); + self::assertNull($object->getName()); + self::assertNull($object->getIndex()); + self::assertNull($object->getInitials()); } public function testGetSetIndex(): void @@ -44,9 +43,9 @@ public function testGetSetIndex(): void $expectedVal = mt_rand(1, 100); $object = new Author(); - $this->assertNull($object->getIndex()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Comment\\Author', $object->setIndex($expectedVal)); - $this->assertEquals($expectedVal, $object->getIndex()); + self::assertNull($object->getIndex()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Comment\\Author', $object->setIndex($expectedVal)); + self::assertEquals($expectedVal, $object->getIndex()); } public function testGetSetInitials(): void @@ -54,9 +53,9 @@ public function testGetSetInitials(): void $expectedVal = 'AABBCCDD'; $object = new Author(); - $this->assertNull($object->getInitials()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Comment\\Author', $object->setInitials($expectedVal)); - $this->assertEquals($expectedVal, $object->getInitials()); + self::assertNull($object->getInitials()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Comment\\Author', $object->setInitials($expectedVal)); + self::assertEquals($expectedVal, $object->getInitials()); } public function testGetSetName(): void @@ -64,8 +63,8 @@ public function testGetSetName(): void $expectedVal = 'AABBCCDD'; $object = new Author(); - $this->assertNull($object->getName()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Comment\\Author', $object->setName($expectedVal)); - $this->assertEquals($expectedVal, $object->getName()); + self::assertNull($object->getName()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Comment\\Author', $object->setName($expectedVal)); + self::assertEquals($expectedVal, $object->getName()); } } diff --git a/tests/PhpPresentation/Tests/Shape/CommentTest.php b/tests/PhpPresentation/Tests/Shape/CommentTest.php index b1c3490e7..37d7dd708 100644 --- a/tests/PhpPresentation/Tests/Shape/CommentTest.php +++ b/tests/PhpPresentation/Tests/Shape/CommentTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -35,11 +34,11 @@ public function testConstruct(): void { $object = new Comment(); - $this->assertNull($object->getAuthor()); - $this->assertNull($object->getText()); - $this->assertIsInt($object->getDate()); - $this->assertNull($object->getHeight()); - $this->assertNull($object->getWidth()); + self::assertNull($object->getAuthor()); + self::assertNull($object->getText()); + self::assertIsInt($object->getDate()); + self::assertNull($object->getHeight()); + self::assertNull($object->getWidth()); } public function testGetSetAuthor(): void @@ -49,9 +48,9 @@ public function testGetSetAuthor(): void /** @var Author $oStub */ $oStub = $this->getMockBuilder(Author::class)->getMock(); - $this->assertNull($object->getAuthor()); - $this->assertInstanceOf(Comment::class, $object->setAuthor($oStub)); - $this->assertInstanceOf(Author::class, $object->getAuthor()); + self::assertNull($object->getAuthor()); + self::assertInstanceOf(Comment::class, $object->setAuthor($oStub)); + self::assertInstanceOf(Author::class, $object->getAuthor()); } public function testGetSetDate(): void @@ -59,10 +58,10 @@ public function testGetSetDate(): void $expectedDate = time(); $object = new Comment(); - $this->assertIsInt($object->getDate()); - $this->assertInstanceOf(Comment::class, $object->setDate($expectedDate)); - $this->assertEquals($expectedDate, $object->getDate()); - $this->assertIsInt($object->getDate()); + self::assertIsInt($object->getDate()); + self::assertInstanceOf(Comment::class, $object->setDate($expectedDate)); + self::assertEquals($expectedDate, $object->getDate()); + self::assertIsInt($object->getDate()); } public function testGetSetText(): void @@ -70,19 +69,19 @@ public function testGetSetText(): void $expectedText = 'AABBCCDD'; $object = new Comment(); - $this->assertNull($object->getText()); - $this->assertInstanceOf(Comment::class, $object->setText($expectedText)); - $this->assertEquals($expectedText, $object->getText()); + self::assertNull($object->getText()); + self::assertInstanceOf(Comment::class, $object->setText($expectedText)); + self::assertEquals($expectedText, $object->getText()); } public function testGetSetHeightAndWidtg(): void { $object = new Comment(); - $this->assertNull($object->getHeight()); - $this->assertNull($object->getWidth()); - $this->assertInstanceOf(Comment::class, $object->setHeight(1)); - $this->assertInstanceOf(Comment::class, $object->setWidth(1)); - $this->assertNull($object->getHeight()); - $this->assertNull($object->getWidth()); + self::assertNull($object->getHeight()); + self::assertNull($object->getWidth()); + self::assertInstanceOf(Comment::class, $object->setHeight(1)); + self::assertInstanceOf(Comment::class, $object->setWidth(1)); + self::assertNull($object->getHeight()); + self::assertNull($object->getWidth()); } } diff --git a/tests/PhpPresentation/Tests/Shape/Drawing/Base64Test.php b/tests/PhpPresentation/Tests/Shape/Drawing/Base64Test.php index c73b8af44..515f4c12a 100644 --- a/tests/PhpPresentation/Tests/Shape/Drawing/Base64Test.php +++ b/tests/PhpPresentation/Tests/Shape/Drawing/Base64Test.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -50,16 +49,16 @@ public function testData(): void { $oDrawing = new Base64(); - $this->assertEmpty($oDrawing->getData()); + self::assertEmpty($oDrawing->getData()); $oDrawing->setData($this->imageDataPNG); - $this->assertNotEmpty($oDrawing->getData()); + self::assertNotEmpty($oDrawing->getData()); } public function testExtension(): void { $oDrawing = new Base64(); $oDrawing->setData($this->imageDataPNG); - $this->assertEquals('jpg', $oDrawing->getExtension()); + self::assertEquals('jpg', $oDrawing->getExtension()); } public function testExtensionException(): void @@ -78,20 +77,20 @@ public function testMimeType(): void { $oDrawing = new Base64(); $oDrawing->setData($this->imageDataPNG); - $this->assertEquals('image/jpeg', $oDrawing->getMimeType()); + self::assertEquals('image/jpeg', $oDrawing->getMimeType()); } public function testMimeTypeSVG(): void { $oDrawing = new Base64(); $oDrawing->setData($this->imageDataSVG); - $this->assertEquals('image/svg+xml', $oDrawing->getMimeType()); + self::assertEquals('image/svg+xml', $oDrawing->getMimeType()); } public function testMimeTypeFunctionNotExists(): void { $oDrawing = new Base64(); $oDrawing->setData($this->imageDataPNG); - $this->assertEquals('image/jpeg', $oDrawing->getMimeType()); + self::assertEquals('image/jpeg', $oDrawing->getMimeType()); } } diff --git a/tests/PhpPresentation/Tests/Shape/Drawing/FileTest.php b/tests/PhpPresentation/Tests/Shape/Drawing/FileTest.php index 479f64c1a..3c7a3f55e 100644 --- a/tests/PhpPresentation/Tests/Shape/Drawing/FileTest.php +++ b/tests/PhpPresentation/Tests/Shape/Drawing/FileTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -34,7 +33,7 @@ class FileTest extends TestCase public function testConstruct(): void { $object = new File(); - $this->assertEmpty($object->getPath()); + self::assertEmpty($object->getPath()); } public function testPathBasic(): void @@ -43,15 +42,15 @@ public function testPathBasic(): void $this->expectExceptionMessage('The file "" doesn\'t exist'); $object = new File(); - $this->assertInstanceOf(File::class, $object->setPath()); + self::assertInstanceOf(File::class, $object->setPath()); } public function testPathWithoutVerifyFile(): void { $object = new File(); - $this->assertInstanceOf(File::class, $object->setPath('', false)); - $this->assertEmpty($object->getPath()); + self::assertInstanceOf(File::class, $object->setPath('', false)); + self::assertEmpty($object->getPath()); } public function testPathWithRealFile(): void @@ -60,10 +59,10 @@ public function testPathWithRealFile(): void $imagePath = dirname(__DIR__, 4) . '/resources/images/PhpPresentationLogo.png'; - $this->assertInstanceOf(File::class, $object->setPath($imagePath, false)); - $this->assertEquals($imagePath, $object->getPath()); - $this->assertEquals(0, $object->getWidth()); - $this->assertEquals(0, $object->getHeight()); + self::assertInstanceOf(File::class, $object->setPath($imagePath, false)); + self::assertEquals($imagePath, $object->getPath()); + self::assertEquals(0, $object->getWidth()); + self::assertEquals(0, $object->getHeight()); } /** @@ -72,8 +71,8 @@ public function testPathWithRealFile(): void public function testMimeType(string $pathFile, string $mimeType): void { $object = new File(); - $this->assertInstanceOf(File::class, $object->setPath($pathFile)); - $this->assertEquals($mimeType, $object->getMimeType()); + self::assertInstanceOf(File::class, $object->setPath($pathFile)); + self::assertEquals($mimeType, $object->getMimeType()); } /** diff --git a/tests/PhpPresentation/Tests/Shape/Drawing/ZipFileTest.php b/tests/PhpPresentation/Tests/Shape/Drawing/ZipFileTest.php index 3a5a7fbb2..bd35ac9c7 100644 --- a/tests/PhpPresentation/Tests/Shape/Drawing/ZipFileTest.php +++ b/tests/PhpPresentation/Tests/Shape/Drawing/ZipFileTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -72,13 +71,13 @@ public function testExtension(): void { $oDrawing = new ZipFile(); $oDrawing->setPath($this->fileOk); - $this->assertEquals('gif', $oDrawing->getExtension()); + self::assertEquals('gif', $oDrawing->getExtension()); } public function testMimeType(): void { $oDrawing = new ZipFile(); $oDrawing->setPath($this->fileOk); - $this->assertEquals('image/gif', $oDrawing->getMimeType()); + self::assertEquals('image/gif', $oDrawing->getMimeType()); } } diff --git a/tests/PhpPresentation/Tests/Shape/GroupTest.php b/tests/PhpPresentation/Tests/Shape/GroupTest.php index 85cb4cd60..93cbbf7d7 100644 --- a/tests/PhpPresentation/Tests/Shape/GroupTest.php +++ b/tests/PhpPresentation/Tests/Shape/GroupTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -35,25 +34,25 @@ public function testConstruct(): void { $object = new Group(); - $this->assertEquals(0, $object->getOffsetX()); - $this->assertEquals(0, $object->getOffsetY()); - $this->assertEquals(0, $object->getExtentX()); - $this->assertEquals(0, $object->getExtentY()); - $this->assertEquals(0, $object->getShapeCollection()->count()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Group', $object->setWidth(rand(1, 100))); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Group', $object->setHeight(rand(1, 100))); + self::assertEquals(0, $object->getOffsetX()); + self::assertEquals(0, $object->getOffsetY()); + self::assertEquals(0, $object->getExtentX()); + self::assertEquals(0, $object->getExtentY()); + self::assertEquals(0, $object->getShapeCollection()->count()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Group', $object->setWidth(mt_rand(1, 100))); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Group', $object->setHeight(mt_rand(1, 100))); } public function testAdd(): void { $object = new Group(); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart', $object->createChartShape()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Drawing\\File', $object->createDrawingShape()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Line', $object->createLineShape(10, 10, 10, 10)); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText', $object->createRichTextShape()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Table', $object->createTableShape()); - $this->assertEquals(5, $object->getShapeCollection()->count()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart', $object->createChartShape()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Drawing\\File', $object->createDrawingShape()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Line', $object->createLineShape(10, 10, 10, 10)); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText', $object->createRichTextShape()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Table', $object->createTableShape()); + self::assertEquals(5, $object->getShapeCollection()->count()); } public function testExtentX(): void @@ -62,7 +61,7 @@ public function testExtentX(): void $line1 = new Line(10, 20, 30, 50); $object->addShape($line1); - $this->assertEquals(20, $object->getExtentX()); + self::assertEquals(20, $object->getExtentX()); } public function testExtentY(): void @@ -71,7 +70,7 @@ public function testExtentY(): void $line1 = new Line(10, 20, 30, 50); $object->addShape($line1); - $this->assertEquals(30, $object->getExtentY()); + self::assertEquals(30, $object->getExtentY()); } public function testOffsetX(): void @@ -80,10 +79,10 @@ public function testOffsetX(): void $line1 = new Line(10, 20, 30, 50); $object->addShape($line1); - $this->assertEquals(10, $object->getOffsetX()); + self::assertEquals(10, $object->getOffsetX()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Group', $object->setOffsetX(rand(1, 100))); - $this->assertEquals(10, $object->getOffsetX()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Group', $object->setOffsetX(mt_rand(1, 100))); + self::assertEquals(10, $object->getOffsetX()); } public function testOffsetY(): void @@ -92,10 +91,10 @@ public function testOffsetY(): void $line1 = new Line(10, 20, 30, 50); $object->addShape($line1); - $this->assertEquals(20, $object->getOffsetY()); + self::assertEquals(20, $object->getOffsetY()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Group', $object->setOffsetY(rand(1, 100))); - $this->assertEquals(20, $object->getOffsetY()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Group', $object->setOffsetY(mt_rand(1, 100))); + self::assertEquals(20, $object->getOffsetY()); } public function testExtentsAndOffsetsForOneShape(): void @@ -114,10 +113,10 @@ public function testExtentsAndOffsetsForOneShape(): void $line1 = new Line($offsetX, $offsetY, $endX, $endY); $object->addShape($line1); - $this->assertEquals($offsetX, $object->getOffsetX()); - $this->assertEquals($offsetY, $object->getOffsetY()); - $this->assertEquals($extentX, $object->getExtentX()); - $this->assertEquals($extentY, $object->getExtentY()); + self::assertEquals($offsetX, $object->getOffsetX()); + self::assertEquals($offsetY, $object->getOffsetY()); + self::assertEquals($extentX, $object->getExtentX()); + self::assertEquals($extentY, $object->getExtentY()); } public function testExtentsAndOffsetsForTwoShapes(): void @@ -147,9 +146,9 @@ public function testExtentsAndOffsetsForTwoShapes(): void $object->addShape($line1); $object->addShape($line2); - $this->assertEquals($offsetX, $object->getOffsetX()); - $this->assertEquals($offsetY, $object->getOffsetY()); - $this->assertEquals($extentX, $object->getExtentX()); - $this->assertEquals($extentY, $object->getExtentY()); + self::assertEquals($offsetX, $object->getOffsetX()); + self::assertEquals($offsetY, $object->getOffsetY()); + self::assertEquals($extentX, $object->getExtentX()); + self::assertEquals($extentY, $object->getExtentY()); } } diff --git a/tests/PhpPresentation/Tests/Shape/HyperlinkTest.php b/tests/PhpPresentation/Tests/Shape/HyperlinkTest.php index 0b027e140..1b79991c1 100644 --- a/tests/PhpPresentation/Tests/Shape/HyperlinkTest.php +++ b/tests/PhpPresentation/Tests/Shape/HyperlinkTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -36,16 +35,16 @@ class HyperlinkTest extends TestCase public function testConstruct(): void { $object = new Hyperlink(); - $this->assertEmpty($object->getUrl()); - $this->assertEmpty($object->getTooltip()); + self::assertEmpty($object->getUrl()); + self::assertEmpty($object->getTooltip()); $object = new Hyperlink('http://test.com'); - $this->assertEquals('http://test.com', $object->getUrl()); - $this->assertEmpty($object->getTooltip()); + self::assertEquals('http://test.com', $object->getUrl()); + self::assertEmpty($object->getTooltip()); $object = new Hyperlink('http://test.com', 'Test'); - $this->assertEquals('http://test.com', $object->getUrl()); - $this->assertEquals('Test', $object->getTooltip()); + self::assertEquals('http://test.com', $object->getUrl()); + self::assertEquals('Test', $object->getTooltip()); } /** @@ -54,13 +53,13 @@ public function testConstruct(): void public function testGetHashCode(): void { $object = new Hyperlink(); - $this->assertEquals(md5(get_class($object)), $object->getHashCode()); + self::assertEquals(md5(get_class($object)), $object->getHashCode()); $object = new Hyperlink('http://test.com'); - $this->assertEquals(md5('http://test.com' . get_class($object)), $object->getHashCode()); + self::assertEquals(md5('http://test.com' . get_class($object)), $object->getHashCode()); $object = new Hyperlink('http://test.com', 'Test'); - $this->assertEquals(md5('http://test.com' . 'Test' . get_class($object)), $object->getHashCode()); + self::assertEquals(md5('http://test.com' . 'Test' . get_class($object)), $object->getHashCode()); } /** @@ -71,66 +70,66 @@ public function testSetGetHashIndex(): void $object = new Hyperlink(); $value = mt_rand(1, 100); $object->setHashIndex($value); - $this->assertEquals($value, $object->getHashIndex()); + self::assertEquals($value, $object->getHashIndex()); } public function testGetSetSlideNumber(): void { $object = new Hyperlink(); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Hyperlink', $object->setSlideNumber()); - $this->assertEquals(1, $object->getSlideNumber()); - $this->assertEquals('ppaction://hlinksldjump', $object->getUrl()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Hyperlink', $object->setSlideNumber()); + self::assertEquals(1, $object->getSlideNumber()); + self::assertEquals('ppaction://hlinksldjump', $object->getUrl()); $value = mt_rand(1, 100); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Hyperlink', $object->setSlideNumber($value)); - $this->assertEquals($value, $object->getSlideNumber()); - $this->assertEquals('ppaction://hlinksldjump', $object->getUrl()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Hyperlink', $object->setSlideNumber($value)); + self::assertEquals($value, $object->getSlideNumber()); + self::assertEquals('ppaction://hlinksldjump', $object->getUrl()); } public function testGetSetTooltip(): void { $object = new Hyperlink(); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Hyperlink', $object->setTooltip()); - $this->assertEmpty($object->getTooltip()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Hyperlink', $object->setTooltip()); + self::assertEmpty($object->getTooltip()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Hyperlink', $object->setTooltip('TEST')); - $this->assertEquals('TEST', $object->getTooltip()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Hyperlink', $object->setTooltip('TEST')); + self::assertEquals('TEST', $object->getTooltip()); } public function testGetSetUrl(): void { $object = new Hyperlink(); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Hyperlink', $object->setUrl()); - $this->assertEmpty($object->getUrl()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Hyperlink', $object->setUrl()); + self::assertEmpty($object->getUrl()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Hyperlink', $object->setUrl('http://www.github.com')); - $this->assertEquals('http://www.github.com', $object->getUrl()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Hyperlink', $object->setUrl('http://www.github.com')); + self::assertEquals('http://www.github.com', $object->getUrl()); } public function testIsInternal(): void { $object = new Hyperlink(); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Hyperlink', $object->setSlideNumber()); - $this->assertTrue($object->isInternal()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Hyperlink', $object->setSlideNumber()); + self::assertTrue($object->isInternal()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Hyperlink', $object->setUrl('http://www.github.com')); - $this->assertFalse($object->isInternal()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Hyperlink', $object->setUrl('http://www.github.com')); + self::assertFalse($object->isInternal()); } public function testIsTextColorUsed(): void { $object = new Hyperlink(); - $this->assertFalse($object->isTextColorUsed()); + self::assertFalse($object->isTextColorUsed()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Hyperlink', $object->setIsTextColorUsed(true)); - $this->assertTrue($object->isTextColorUsed()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Hyperlink', $object->setIsTextColorUsed(true)); + self::assertTrue($object->isTextColorUsed()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Hyperlink', $object->setIsTextColorUsed(false)); - $this->assertFalse($object->isTextColorUsed()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Hyperlink', $object->setIsTextColorUsed(false)); + self::assertFalse($object->isTextColorUsed()); } } diff --git a/tests/PhpPresentation/Tests/Shape/LineTest.php b/tests/PhpPresentation/Tests/Shape/LineTest.php index 12ada1531..4bbfeecd9 100644 --- a/tests/PhpPresentation/Tests/Shape/LineTest.php +++ b/tests/PhpPresentation/Tests/Shape/LineTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -39,11 +38,11 @@ public function testConstruct(): void $value = mt_rand(1, 100); $object = new Line($value, $value, $value, $value); - $this->assertEquals(Border::LINE_SINGLE, $object->getBorder()->getLineStyle()); - $this->assertEquals($value, $object->getOffsetX()); - $this->assertEquals($value, $object->getOffsetY()); - $this->assertEquals(0, $object->getWidth()); - $this->assertEquals(0, $object->getHeight()); - $this->assertIsString($object->getHashCode()); + self::assertEquals(Border::LINE_SINGLE, $object->getBorder()->getLineStyle()); + self::assertEquals($value, $object->getOffsetX()); + self::assertEquals($value, $object->getOffsetY()); + self::assertEquals(0, $object->getWidth()); + self::assertEquals(0, $object->getHeight()); + self::assertIsString($object->getHashCode()); } } diff --git a/tests/PhpPresentation/Tests/Shape/MediaTest.php b/tests/PhpPresentation/Tests/Shape/MediaTest.php index 14508464c..cd6e6502b 100644 --- a/tests/PhpPresentation/Tests/Shape/MediaTest.php +++ b/tests/PhpPresentation/Tests/Shape/MediaTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -29,19 +28,19 @@ public function testInheritance(): void { $object = new Media(); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Drawing\\File', $object); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Drawing\\File', $object); } public function testMimeType(): void { $object = new Media(); $object->setPath('file.mp4', false); - $this->assertEquals('video/mp4', $object->getMimeType()); + self::assertEquals('video/mp4', $object->getMimeType()); $object->setPath('file.ogv', false); - $this->assertEquals('video/ogg', $object->getMimeType()); + self::assertEquals('video/ogg', $object->getMimeType()); $object->setPath('file.wmv', false); - $this->assertEquals('video/x-ms-wmv', $object->getMimeType()); + self::assertEquals('video/x-ms-wmv', $object->getMimeType()); $object->setPath('file.xxx', false); - $this->assertEquals('application/octet-stream', $object->getMimeType()); + self::assertEquals('application/octet-stream', $object->getMimeType()); } } diff --git a/tests/PhpPresentation/Tests/Shape/PlaceholderTest.php b/tests/PhpPresentation/Tests/Shape/PlaceholderTest.php index eb741d24f..bdc81e777 100644 --- a/tests/PhpPresentation/Tests/Shape/PlaceholderTest.php +++ b/tests/PhpPresentation/Tests/Shape/PlaceholderTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -22,6 +21,7 @@ use PhpOffice\PhpPresentation\Shape\Placeholder; use PHPUnit\Framework\TestCase; +use ReflectionClass; /** * Test class for Table element. @@ -33,8 +33,8 @@ class PlaceholderTest extends TestCase public function testConstruct(): void { $object = new Placeholder(Placeholder::PH_TYPE_BODY); - $this->assertEquals(Placeholder::PH_TYPE_BODY, $object->getType()); - $this->assertNull($object->getIdx()); + self::assertEquals(Placeholder::PH_TYPE_BODY, $object->getType()); + self::assertNull($object->getIdx()); } public function testIdx(): void @@ -42,20 +42,20 @@ public function testIdx(): void $value = mt_rand(0, 100); $object = new Placeholder(Placeholder::PH_TYPE_BODY); - $this->assertNull($object->getIdx()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Placeholder', $object->setIdx($value)); - $this->assertEquals($value, $object->getIdx()); + self::assertNull($object->getIdx()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Placeholder', $object->setIdx($value)); + self::assertEquals($value, $object->getIdx()); } public function testType(): void { - $rcPlaceholder = new \ReflectionClass('PhpOffice\PhpPresentation\Shape\Placeholder'); + $rcPlaceholder = new ReflectionClass('PhpOffice\PhpPresentation\Shape\Placeholder'); $arrayConstants = $rcPlaceholder->getConstants(); $value = array_rand($arrayConstants); $object = new Placeholder(Placeholder::PH_TYPE_BODY); - $this->assertEquals(Placeholder::PH_TYPE_BODY, $object->getType()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Placeholder', $object->setType($value)); - $this->assertEquals($value, $object->getType()); + self::assertEquals(Placeholder::PH_TYPE_BODY, $object->getType()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Placeholder', $object->setType($value)); + self::assertEquals($value, $object->getType()); } } diff --git a/tests/PhpPresentation/Tests/Shape/RichText/BreakElementTest.php b/tests/PhpPresentation/Tests/Shape/RichText/BreakElementTest.php index 512af22a9..085d7aadf 100644 --- a/tests/PhpPresentation/Tests/Shape/RichText/BreakElementTest.php +++ b/tests/PhpPresentation/Tests/Shape/RichText/BreakElementTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -36,25 +35,25 @@ class BreakElementTest extends TestCase public function testText(): void { $object = new BreakElement(); - $this->assertEquals("\r\n", $object->getText()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\BreakElement', $object->setText()); - $this->assertEquals("\r\n", $object->getText()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\BreakElement', $object->setText('AAA')); - $this->assertEquals("\r\n", $object->getText()); + self::assertEquals("\r\n", $object->getText()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\BreakElement', $object->setText()); + self::assertEquals("\r\n", $object->getText()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\BreakElement', $object->setText('AAA')); + self::assertEquals("\r\n", $object->getText()); } public function testFont(): void { $object = new BreakElement(); - $this->assertNull($object->getFont()); + self::assertNull($object->getFont()); } public function testLanguage(): void { $object = new BreakElement(); - $this->assertNull($object->getLanguage()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\BreakElement', $object->setLanguage('en-US')); - $this->assertNull($object->getLanguage()); + self::assertNull($object->getLanguage()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\BreakElement', $object->setLanguage('en-US')); + self::assertNull($object->getLanguage()); } /** @@ -63,6 +62,6 @@ public function testLanguage(): void public function testHashCode(): void { $object = new BreakElement(); - $this->assertEquals(md5(get_class($object)), $object->getHashCode()); + self::assertEquals(md5(get_class($object)), $object->getHashCode()); } } diff --git a/tests/PhpPresentation/Tests/Shape/RichText/ParagraphTest.php b/tests/PhpPresentation/Tests/Shape/RichText/ParagraphTest.php index be34b6f1c..57f9d6fc8 100644 --- a/tests/PhpPresentation/Tests/Shape/RichText/ParagraphTest.php +++ b/tests/PhpPresentation/Tests/Shape/RichText/ParagraphTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -40,17 +39,17 @@ class ParagraphTest extends TestCase public function testConstruct(): void { $object = new Paragraph(); - $this->assertEmpty($object->getRichTextElements()); - $this->assertInstanceOf(Alignment::class, $object->getAlignment()); - $this->assertInstanceOf(Font::class, $object->getFont()); - $this->assertInstanceOf(Bullet::class, $object->getBulletStyle()); + self::assertEmpty($object->getRichTextElements()); + self::assertInstanceOf(Alignment::class, $object->getAlignment()); + self::assertInstanceOf(Font::class, $object->getFont()); + self::assertInstanceOf(Bullet::class, $object->getBulletStyle()); } public function testAlignment(): void { $object = new Paragraph(); - $this->assertInstanceOf(Alignment::class, $object->getAlignment()); - $this->assertInstanceOf(Paragraph::class, $object->setAlignment(new Alignment())); + self::assertInstanceOf(Alignment::class, $object->getAlignment()); + self::assertInstanceOf(Paragraph::class, $object->setAlignment(new Alignment())); } /** @@ -59,11 +58,11 @@ public function testAlignment(): void public function testBulletStyle(): void { $object = new Paragraph(); - $this->assertInstanceOf(Bullet::class, $object->getBulletStyle()); - $this->assertInstanceOf(Paragraph::class, $object->setBulletStyle()); - $this->assertNull($object->getBulletStyle()); - $this->assertInstanceOf(Paragraph::class, $object->setBulletStyle(new Bullet())); - $this->assertInstanceOf(Bullet::class, $object->getBulletStyle()); + self::assertInstanceOf(Bullet::class, $object->getBulletStyle()); + self::assertInstanceOf(Paragraph::class, $object->setBulletStyle()); + self::assertNull($object->getBulletStyle()); + self::assertInstanceOf(Paragraph::class, $object->setBulletStyle(new Bullet())); + self::assertInstanceOf(Bullet::class, $object->getBulletStyle()); } /** @@ -72,11 +71,11 @@ public function testBulletStyle(): void public function testFont(): void { $object = new Paragraph(); - $this->assertInstanceOf(Font::class, $object->getFont()); - $this->assertInstanceOf(Paragraph::class, $object->setFont()); - $this->assertNull($object->getFont()); - $this->assertInstanceOf(Paragraph::class, $object->setFont(new Font())); - $this->assertInstanceOf(Font::class, $object->getFont()); + self::assertInstanceOf(Font::class, $object->getFont()); + self::assertInstanceOf(Paragraph::class, $object->setFont()); + self::assertNull($object->getFont()); + self::assertInstanceOf(Paragraph::class, $object->setFont(new Font())); + self::assertInstanceOf(Font::class, $object->getFont()); } /** @@ -87,7 +86,7 @@ public function testHashCode(): void $object = new Paragraph(); $oElement = new TextElement(); $object->addText($oElement); - $this->assertEquals(md5($oElement->getHashCode() . $object->getFont()->getHashCode() . get_class($object)), $object->getHashCode()); + self::assertEquals(md5($oElement->getHashCode() . $object->getFont()->getHashCode() . get_class($object)), $object->getHashCode()); } /** @@ -98,7 +97,7 @@ public function testHashIndex(): void $object = new Paragraph(); $value = mt_rand(1, 100); $object->setHashIndex($value); - $this->assertEquals($value, $object->getHashIndex()); + self::assertEquals($value, $object->getHashIndex()); } /** @@ -108,9 +107,9 @@ public function testLineSpacing(): void { $object = new Paragraph(); $valueExpected = mt_rand(1, 100); - $this->assertEquals(100, $object->getLineSpacing()); - $this->assertInstanceOf(Paragraph::class, $object->setLineSpacing($valueExpected)); - $this->assertEquals($valueExpected, $object->getLineSpacing()); + self::assertEquals(100, $object->getLineSpacing()); + self::assertInstanceOf(Paragraph::class, $object->setLineSpacing($valueExpected)); + self::assertEquals($valueExpected, $object->getLineSpacing()); } /** @@ -119,13 +118,13 @@ public function testLineSpacing(): void public function testLineSpacingMode(): void { $object = new Paragraph(); - $this->assertEquals(Paragraph::LINE_SPACING_MODE_PERCENT, $object->getLineSpacingMode()); - $this->assertInstanceOf(Paragraph::class, $object->setLineSpacingMode(Paragraph::LINE_SPACING_MODE_POINT)); - $this->assertEquals(Paragraph::LINE_SPACING_MODE_POINT, $object->getLineSpacingMode()); - $this->assertInstanceOf(Paragraph::class, $object->setLineSpacingMode(Paragraph::LINE_SPACING_MODE_PERCENT)); - $this->assertEquals(Paragraph::LINE_SPACING_MODE_PERCENT, $object->getLineSpacingMode()); - $this->assertInstanceOf(Paragraph::class, $object->setLineSpacingMode('Unauthorized')); - $this->assertEquals(Paragraph::LINE_SPACING_MODE_PERCENT, $object->getLineSpacingMode()); + self::assertEquals(Paragraph::LINE_SPACING_MODE_PERCENT, $object->getLineSpacingMode()); + self::assertInstanceOf(Paragraph::class, $object->setLineSpacingMode(Paragraph::LINE_SPACING_MODE_POINT)); + self::assertEquals(Paragraph::LINE_SPACING_MODE_POINT, $object->getLineSpacingMode()); + self::assertInstanceOf(Paragraph::class, $object->setLineSpacingMode(Paragraph::LINE_SPACING_MODE_PERCENT)); + self::assertEquals(Paragraph::LINE_SPACING_MODE_PERCENT, $object->getLineSpacingMode()); + self::assertInstanceOf(Paragraph::class, $object->setLineSpacingMode('Unauthorized')); + self::assertEquals(Paragraph::LINE_SPACING_MODE_PERCENT, $object->getLineSpacingMode()); } /** @@ -134,34 +133,34 @@ public function testLineSpacingMode(): void public function testRichTextElements(): void { $object = new Paragraph(); - $this->assertIsArray($object->getRichTextElements()); - $this->assertEmpty($object->getRichTextElements()); + self::assertIsArray($object->getRichTextElements()); + self::assertEmpty($object->getRichTextElements()); $object->createBreak(); - $this->assertCount(1, $object->getRichTextElements()); + self::assertCount(1, $object->getRichTextElements()); $array = [ new TextElement(), new TextElement(), new TextElement(), ]; - $this->assertInstanceOf(Paragraph::class, $object->setRichTextElements($array)); - $this->assertCount(3, $object->getRichTextElements()); + self::assertInstanceOf(Paragraph::class, $object->setRichTextElements($array)); + self::assertCount(3, $object->getRichTextElements()); } public function testSpacingAfter(): void { $object = new Paragraph(); - $this->assertEquals(0, $object->getSpacingAfter()); - $this->assertInstanceOf(Paragraph::class, $object->setSpacingAfter(1)); - $this->assertEquals(1, $object->getSpacingAfter()); + self::assertEquals(0, $object->getSpacingAfter()); + self::assertInstanceOf(Paragraph::class, $object->setSpacingAfter(1)); + self::assertEquals(1, $object->getSpacingAfter()); } public function testSpacingBefore(): void { $object = new Paragraph(); - $this->assertEquals(0, $object->getSpacingBefore()); - $this->assertInstanceOf(Paragraph::class, $object->setSpacingBefore(1)); - $this->assertEquals(1, $object->getSpacingBefore()); + self::assertEquals(0, $object->getSpacingBefore()); + self::assertInstanceOf(Paragraph::class, $object->setSpacingBefore(1)); + self::assertEquals(1, $object->getSpacingBefore()); } /** @@ -170,19 +169,19 @@ public function testSpacingBefore(): void public function testText(): void { $object = new Paragraph(); - $this->assertInstanceOf(Paragraph::class, $object->addText(new TextElement())); - $this->assertCount(1, $object->getRichTextElements()); - $this->assertInstanceOf(TextElement::class, $object->createText()); - $this->assertCount(2, $object->getRichTextElements()); - $this->assertInstanceOf(TextElement::class, $object->createText('AAA')); - $this->assertCount(3, $object->getRichTextElements()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\BreakElement', $object->createBreak()); - $this->assertCount(4, $object->getRichTextElements()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $object->createTextRun()); - $this->assertCount(5, $object->getRichTextElements()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $object->createTextRun('BBB')); - $this->assertCount(6, $object->getRichTextElements()); - $this->assertEquals('AAA' . "\r\n" . 'BBB', $object->getPlainText()); - $this->assertEquals('AAA' . "\r\n" . 'BBB', (string) $object); + self::assertInstanceOf(Paragraph::class, $object->addText(new TextElement())); + self::assertCount(1, $object->getRichTextElements()); + self::assertInstanceOf(TextElement::class, $object->createText()); + self::assertCount(2, $object->getRichTextElements()); + self::assertInstanceOf(TextElement::class, $object->createText('AAA')); + self::assertCount(3, $object->getRichTextElements()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\BreakElement', $object->createBreak()); + self::assertCount(4, $object->getRichTextElements()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $object->createTextRun()); + self::assertCount(5, $object->getRichTextElements()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $object->createTextRun('BBB')); + self::assertCount(6, $object->getRichTextElements()); + self::assertEquals('AAA' . "\r\n" . 'BBB', $object->getPlainText()); + self::assertEquals('AAA' . "\r\n" . 'BBB', (string) $object); } } diff --git a/tests/PhpPresentation/Tests/Shape/RichText/RunTest.php b/tests/PhpPresentation/Tests/Shape/RichText/RunTest.php index 0deb0b333..213bb2982 100644 --- a/tests/PhpPresentation/Tests/Shape/RichText/RunTest.php +++ b/tests/PhpPresentation/Tests/Shape/RichText/RunTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -37,40 +36,40 @@ class RunTest extends TestCase public function testConstruct(): void { $object = new Run(); - $this->assertEquals('', $object->getText()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Font', $object->getFont()); + self::assertEquals('', $object->getText()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Font', $object->getFont()); $object = new Run('BBB'); - $this->assertEquals('BBB', $object->getText()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Font', $object->getFont()); + self::assertEquals('BBB', $object->getText()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Font', $object->getFont()); } public function testFont(): void { $object = new Run(); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $object->setFont(new Font())); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Font', $object->getFont()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $object->setFont(new Font())); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Font', $object->getFont()); } public function testLanguage(): void { $object = new Run(); - $this->assertNull($object->getLanguage()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $object->setLanguage('en-US')); - $this->assertEquals('en-US', $object->getLanguage()); + self::assertNull($object->getLanguage()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $object->setLanguage('en-US')); + self::assertEquals('en-US', $object->getLanguage()); } public function testText(): void { $object = new Run(); - $this->assertEquals('', $object->getText()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $object->setText()); - $this->assertEquals('', $object->getText()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $object->setText('AAA')); - $this->assertEquals('AAA', $object->getText()); + self::assertEquals('', $object->getText()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $object->setText()); + self::assertEquals('', $object->getText()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $object->setText('AAA')); + self::assertEquals('AAA', $object->getText()); $object = new Run('BBB'); - $this->assertEquals('BBB', $object->getText()); + self::assertEquals('BBB', $object->getText()); } /** @@ -79,6 +78,6 @@ public function testText(): void public function testHashCode(): void { $object = new Run(); - $this->assertEquals(md5($object->getFont()->getHashCode() . get_class($object)), $object->getHashCode()); + self::assertEquals(md5($object->getFont()->getHashCode() . get_class($object)), $object->getHashCode()); } } diff --git a/tests/PhpPresentation/Tests/Shape/RichText/TextElementTest.php b/tests/PhpPresentation/Tests/Shape/RichText/TextElementTest.php index f63de69d4..0a0eb7f14 100644 --- a/tests/PhpPresentation/Tests/Shape/RichText/TextElementTest.php +++ b/tests/PhpPresentation/Tests/Shape/RichText/TextElementTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -37,47 +36,47 @@ class TextElementTest extends TestCase public function testConstruct(): void { $object = new TextElement(); - $this->assertEquals('', $object->getText()); + self::assertEquals('', $object->getText()); $object = new TextElement('AAA'); - $this->assertEquals('AAA', $object->getText()); + self::assertEquals('AAA', $object->getText()); } public function testFont(): void { $object = new TextElement(); - $this->assertNull($object->getFont()); + self::assertNull($object->getFont()); } public function testHyperlink(): void { $object = new TextElement(); - $this->assertFalse($object->hasHyperlink()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\TextElement', $object->setHyperlink()); - $this->assertFalse($object->hasHyperlink()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Hyperlink', $object->getHyperlink()); - $this->assertTrue($object->hasHyperlink()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\TextElement', $object->setHyperlink(new Hyperlink('http://www.google.fr'))); - $this->assertTrue($object->hasHyperlink()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Hyperlink', $object->getHyperlink()); + self::assertFalse($object->hasHyperlink()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\TextElement', $object->setHyperlink()); + self::assertFalse($object->hasHyperlink()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Hyperlink', $object->getHyperlink()); + self::assertTrue($object->hasHyperlink()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\TextElement', $object->setHyperlink(new Hyperlink('http://www.google.fr'))); + self::assertTrue($object->hasHyperlink()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Hyperlink', $object->getHyperlink()); } public function testLanguage(): void { $object = new TextElement(); - $this->assertNull($object->getLanguage()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\TextElement', $object->setLanguage('en-US')); - $this->assertEquals('en-US', $object->getLanguage()); + self::assertNull($object->getLanguage()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\TextElement', $object->setLanguage('en-US')); + self::assertEquals('en-US', $object->getLanguage()); } public function testText(): void { $object = new TextElement(); - $this->assertEquals('', $object->getText()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\TextElement', $object->setText()); - $this->assertEquals('', $object->getText()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\TextElement', $object->setText('AAA')); - $this->assertEquals('AAA', $object->getText()); + self::assertEquals('', $object->getText()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\TextElement', $object->setText()); + self::assertEquals('', $object->getText()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\TextElement', $object->setText('AAA')); + self::assertEquals('AAA', $object->getText()); } /** @@ -86,6 +85,6 @@ public function testText(): void public function testHashCode(): void { $object = new TextElement(); - $this->assertEquals(md5(get_class($object)), $object->getHashCode()); + self::assertEquals(md5(get_class($object)), $object->getHashCode()); } } diff --git a/tests/PhpPresentation/Tests/Shape/RichTextTest.php b/tests/PhpPresentation/Tests/Shape/RichTextTest.php index 7019fc292..4fd697574 100644 --- a/tests/PhpPresentation/Tests/Shape/RichTextTest.php +++ b/tests/PhpPresentation/Tests/Shape/RichTextTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -38,23 +37,23 @@ class RichTextTest extends TestCase public function testConstruct(): void { $object = new RichText(); - $this->assertEquals(0, $object->getActiveParagraphIndex()); - $this->assertCount(1, $object->getParagraphs()); + self::assertEquals(0, $object->getActiveParagraphIndex()); + self::assertCount(1, $object->getParagraphs()); } public function testActiveParagraph(): void { $object = new RichText(); - $this->assertEquals(0, $object->getActiveParagraphIndex()); - $this->assertInstanceOf(Paragraph::class, $object->createParagraph()); - $this->assertCount(2, $object->getParagraphs()); + self::assertEquals(0, $object->getActiveParagraphIndex()); + self::assertInstanceOf(Paragraph::class, $object->createParagraph()); + self::assertCount(2, $object->getParagraphs()); $value = mt_rand(0, 1); - $this->assertInstanceOf(Paragraph::class, $object->setActiveParagraph($value)); - $this->assertEquals($value, $object->getActiveParagraphIndex()); - $this->assertInstanceOf(Paragraph::class, $object->getActiveParagraph()); - $this->assertInstanceOf(Paragraph::class, $object->getParagraph()); + self::assertInstanceOf(Paragraph::class, $object->setActiveParagraph($value)); + self::assertEquals($value, $object->getActiveParagraphIndex()); + self::assertInstanceOf(Paragraph::class, $object->getActiveParagraph()); + self::assertInstanceOf(Paragraph::class, $object->getParagraph()); $value = mt_rand(0, 1); - $this->assertInstanceOf(Paragraph::class, $object->getParagraph($value)); + self::assertInstanceOf(Paragraph::class, $object->getParagraph($value)); } public function testActiveParagraphException(): void @@ -80,20 +79,20 @@ public function testColumns(): void $object = new RichText(); $value = mt_rand(1, 16); - $this->assertInstanceOf(RichText::class, $object->setColumns($value)); - $this->assertEquals($value, $object->getColumns()); + self::assertInstanceOf(RichText::class, $object->setColumns($value)); + self::assertEquals($value, $object->getColumns()); } public function testColumnSpacing(): void { $object = new RichText(); - $this->assertEquals(0, $object->getColumnSpacing()); + self::assertEquals(0, $object->getColumnSpacing()); $value = mt_rand(1, 16); - $this->assertInstanceOf(RichText::class, $object->setColumnSpacing($value)); - $this->assertEquals($value, $object->getColumnSpacing()); - $this->assertInstanceOf(RichText::class, $object->setColumnSpacing(-1)); - $this->assertEquals($value, $object->getColumnSpacing()); + self::assertInstanceOf(RichText::class, $object->setColumnSpacing($value)); + self::assertEquals($value, $object->getColumnSpacing()); + self::assertInstanceOf(RichText::class, $object->setColumnSpacing(-1)); + self::assertEquals($value, $object->getColumnSpacing()); } public function testColumnsException(): void @@ -115,86 +114,86 @@ public function testParagraphs(): void new Paragraph(), ]; - $this->assertInstanceOf(RichText::class, $object->setParagraphs($array)); - $this->assertCount(3, $object->getParagraphs()); - $this->assertEquals(2, $object->getActiveParagraphIndex()); + self::assertInstanceOf(RichText::class, $object->setParagraphs($array)); + self::assertCount(3, $object->getParagraphs()); + self::assertEquals(2, $object->getActiveParagraphIndex()); } public function testText(): void { $object = new RichText(); - $this->assertInstanceOf(RichText::class, $object->addText()); - $this->assertCount(1, $object->getActiveParagraph()->getRichTextElements()); - $this->assertInstanceOf(RichText::class, $object->addText(new TextElement())); - $this->assertCount(2, $object->getActiveParagraph()->getRichTextElements()); - $this->assertInstanceOf(TextElement::class, $object->createText()); - $this->assertCount(3, $object->getActiveParagraph()->getRichTextElements()); - $this->assertInstanceOf(TextElement::class, $object->createText('ALPHA')); - $this->assertCount(4, $object->getActiveParagraph()->getRichTextElements()); - $this->assertInstanceOf(BreakElement::class, $object->createBreak()); - $this->assertCount(5, $object->getActiveParagraph()->getRichTextElements()); - $this->assertInstanceOf(Run::class, $object->createTextRun()); - $this->assertCount(6, $object->getActiveParagraph()->getRichTextElements()); - $this->assertInstanceOf(Run::class, $object->createTextRun('BETA')); - $this->assertCount(7, $object->getActiveParagraph()->getRichTextElements()); - $this->assertEquals('ALPHA' . "\r\n" . 'BETA', $object->getPlainText()); - $this->assertEquals('ALPHA' . "\r\n" . 'BETA', (string) $object); + self::assertInstanceOf(RichText::class, $object->addText()); + self::assertCount(1, $object->getActiveParagraph()->getRichTextElements()); + self::assertInstanceOf(RichText::class, $object->addText(new TextElement())); + self::assertCount(2, $object->getActiveParagraph()->getRichTextElements()); + self::assertInstanceOf(TextElement::class, $object->createText()); + self::assertCount(3, $object->getActiveParagraph()->getRichTextElements()); + self::assertInstanceOf(TextElement::class, $object->createText('ALPHA')); + self::assertCount(4, $object->getActiveParagraph()->getRichTextElements()); + self::assertInstanceOf(BreakElement::class, $object->createBreak()); + self::assertCount(5, $object->getActiveParagraph()->getRichTextElements()); + self::assertInstanceOf(Run::class, $object->createTextRun()); + self::assertCount(6, $object->getActiveParagraph()->getRichTextElements()); + self::assertInstanceOf(Run::class, $object->createTextRun('BETA')); + self::assertCount(7, $object->getActiveParagraph()->getRichTextElements()); + self::assertEquals('ALPHA' . "\r\n" . 'BETA', $object->getPlainText()); + self::assertEquals('ALPHA' . "\r\n" . 'BETA', (string) $object); } public function testGetSetAutoFit(): void { $object = new RichText(); - $this->assertInstanceOf(RichText::class, $object->setAutoFit()); - $this->assertEquals(RichText::AUTOFIT_DEFAULT, $object->getAutoFit()); + self::assertInstanceOf(RichText::class, $object->setAutoFit()); + self::assertEquals(RichText::AUTOFIT_DEFAULT, $object->getAutoFit()); - $this->assertInstanceOf(RichText::class, $object->setAutoFit(RichText::AUTOFIT_NORMAL)); - $this->assertEquals(RichText::AUTOFIT_NORMAL, $object->getAutoFit()); + self::assertInstanceOf(RichText::class, $object->setAutoFit(RichText::AUTOFIT_NORMAL)); + self::assertEquals(RichText::AUTOFIT_NORMAL, $object->getAutoFit()); } public function testGetSetHAutoShrink(): void { $object = new RichText(); - $this->assertInstanceOf(RichText::class, $object->setAutoShrinkHorizontal()); - $this->assertNull($object->hasAutoShrinkHorizontal()); + self::assertInstanceOf(RichText::class, $object->setAutoShrinkHorizontal()); + self::assertNull($object->hasAutoShrinkHorizontal()); - $this->assertInstanceOf(RichText::class, $object->setAutoShrinkHorizontal(null)); - $this->assertNull($object->hasAutoShrinkHorizontal()); + self::assertInstanceOf(RichText::class, $object->setAutoShrinkHorizontal(null)); + self::assertNull($object->hasAutoShrinkHorizontal()); - $this->assertInstanceOf(RichText::class, $object->setAutoShrinkHorizontal(true)); - $this->assertTrue($object->hasAutoShrinkHorizontal()); + self::assertInstanceOf(RichText::class, $object->setAutoShrinkHorizontal(true)); + self::assertTrue($object->hasAutoShrinkHorizontal()); - $this->assertInstanceOf(RichText::class, $object->setAutoShrinkHorizontal(false)); - $this->assertFalse($object->hasAutoShrinkHorizontal()); + self::assertInstanceOf(RichText::class, $object->setAutoShrinkHorizontal(false)); + self::assertFalse($object->hasAutoShrinkHorizontal()); } public function testGetSetVAutoShrink(): void { $object = new RichText(); - $this->assertInstanceOf(RichText::class, $object->setAutoShrinkVertical()); - $this->assertNull($object->hasAutoShrinkVertical()); + self::assertInstanceOf(RichText::class, $object->setAutoShrinkVertical()); + self::assertNull($object->hasAutoShrinkVertical()); - $this->assertInstanceOf(RichText::class, $object->setAutoShrinkVertical(null)); - $this->assertNull($object->hasAutoShrinkVertical()); + self::assertInstanceOf(RichText::class, $object->setAutoShrinkVertical(null)); + self::assertNull($object->hasAutoShrinkVertical()); - $this->assertInstanceOf(RichText::class, $object->setAutoShrinkVertical(true)); - $this->assertTrue($object->hasAutoShrinkVertical()); + self::assertInstanceOf(RichText::class, $object->setAutoShrinkVertical(true)); + self::assertTrue($object->hasAutoShrinkVertical()); - $this->assertInstanceOf(RichText::class, $object->setAutoShrinkVertical(false)); - $this->assertFalse($object->hasAutoShrinkVertical()); + self::assertInstanceOf(RichText::class, $object->setAutoShrinkVertical(false)); + self::assertFalse($object->hasAutoShrinkVertical()); } public function testGetSetHOverflow(): void { $object = new RichText(); - $this->assertInstanceOf(RichText::class, $object->setHorizontalOverflow()); - $this->assertEquals(RichText::OVERFLOW_OVERFLOW, $object->getHorizontalOverflow()); + self::assertInstanceOf(RichText::class, $object->setHorizontalOverflow()); + self::assertEquals(RichText::OVERFLOW_OVERFLOW, $object->getHorizontalOverflow()); - $this->assertInstanceOf(RichText::class, $object->setHorizontalOverflow(RichText::OVERFLOW_CLIP)); - $this->assertEquals(RichText::OVERFLOW_CLIP, $object->getHorizontalOverflow()); + self::assertInstanceOf(RichText::class, $object->setHorizontalOverflow(RichText::OVERFLOW_CLIP)); + self::assertEquals(RichText::OVERFLOW_CLIP, $object->getHorizontalOverflow()); } public function testGetSetInset(): void @@ -202,75 +201,75 @@ public function testGetSetInset(): void $object = new RichText(); // Default - $this->assertInstanceOf(RichText::class, $object->setInsetBottom()); - $this->assertEquals(4.8, $object->getInsetBottom()); - $this->assertInstanceOf(RichText::class, $object->setInsetLeft()); - $this->assertEquals(9.6, $object->getInsetLeft()); - $this->assertInstanceOf(RichText::class, $object->setInsetRight()); - $this->assertEquals(9.6, $object->getInsetRight()); - $this->assertInstanceOf(RichText::class, $object->setInsetTop()); - $this->assertEquals(4.8, $object->getInsetTop()); + self::assertInstanceOf(RichText::class, $object->setInsetBottom()); + self::assertEquals(4.8, $object->getInsetBottom()); + self::assertInstanceOf(RichText::class, $object->setInsetLeft()); + self::assertEquals(9.6, $object->getInsetLeft()); + self::assertInstanceOf(RichText::class, $object->setInsetRight()); + self::assertEquals(9.6, $object->getInsetRight()); + self::assertInstanceOf(RichText::class, $object->setInsetTop()); + self::assertEquals(4.8, $object->getInsetTop()); // Value $value = mt_rand(1, 100); - $this->assertInstanceOf(RichText::class, $object->setInsetBottom($value)); - $this->assertEquals($value, $object->getInsetBottom()); - $this->assertInstanceOf(RichText::class, $object->setInsetLeft($value)); - $this->assertEquals($value, $object->getInsetLeft()); - $this->assertInstanceOf(RichText::class, $object->setInsetRight($value)); - $this->assertEquals($value, $object->getInsetRight()); - $this->assertInstanceOf(RichText::class, $object->setInsetTop($value)); - $this->assertEquals($value, $object->getInsetTop()); + self::assertInstanceOf(RichText::class, $object->setInsetBottom($value)); + self::assertEquals($value, $object->getInsetBottom()); + self::assertInstanceOf(RichText::class, $object->setInsetLeft($value)); + self::assertEquals($value, $object->getInsetLeft()); + self::assertInstanceOf(RichText::class, $object->setInsetRight($value)); + self::assertEquals($value, $object->getInsetRight()); + self::assertInstanceOf(RichText::class, $object->setInsetTop($value)); + self::assertEquals($value, $object->getInsetTop()); } public function testGetSetUpright(): void { $object = new RichText(); - $this->assertInstanceOf(RichText::class, $object->setUpright()); - $this->assertFalse($object->isUpright()); + self::assertInstanceOf(RichText::class, $object->setUpright()); + self::assertFalse($object->isUpright()); - $this->assertInstanceOf(RichText::class, $object->setUpright(true)); - $this->assertTrue($object->isUpright()); + self::assertInstanceOf(RichText::class, $object->setUpright(true)); + self::assertTrue($object->isUpright()); - $this->assertInstanceOf(RichText::class, $object->setUpright(false)); - $this->assertFalse($object->isUpright()); + self::assertInstanceOf(RichText::class, $object->setUpright(false)); + self::assertFalse($object->isUpright()); } public function testGetSetVertical(): void { $object = new RichText(); - $this->assertInstanceOf(RichText::class, $object->setVertical()); - $this->assertFalse($object->isVertical()); + self::assertInstanceOf(RichText::class, $object->setVertical()); + self::assertFalse($object->isVertical()); - $this->assertInstanceOf(RichText::class, $object->setVertical(true)); - $this->assertTrue($object->isVertical()); + self::assertInstanceOf(RichText::class, $object->setVertical(true)); + self::assertTrue($object->isVertical()); - $this->assertInstanceOf(RichText::class, $object->setVertical(false)); - $this->assertFalse($object->isVertical()); + self::assertInstanceOf(RichText::class, $object->setVertical(false)); + self::assertFalse($object->isVertical()); } public function testGetSetVOverflow(): void { $object = new RichText(); - $this->assertInstanceOf(RichText::class, $object->setVerticalOverflow()); - $this->assertEquals(RichText::OVERFLOW_OVERFLOW, $object->getVerticalOverflow()); + self::assertInstanceOf(RichText::class, $object->setVerticalOverflow()); + self::assertEquals(RichText::OVERFLOW_OVERFLOW, $object->getVerticalOverflow()); - $this->assertInstanceOf(RichText::class, $object->setVerticalOverflow(RichText::OVERFLOW_CLIP)); - $this->assertEquals(RichText::OVERFLOW_CLIP, $object->getVerticalOverflow()); + self::assertInstanceOf(RichText::class, $object->setVerticalOverflow(RichText::OVERFLOW_CLIP)); + self::assertEquals(RichText::OVERFLOW_CLIP, $object->getVerticalOverflow()); } public function testGetSetWrap(): void { $object = new RichText(); - $this->assertInstanceOf(RichText::class, $object->setWrap()); - $this->assertEquals(RichText::WRAP_SQUARE, $object->getWrap()); + self::assertInstanceOf(RichText::class, $object->setWrap()); + self::assertEquals(RichText::WRAP_SQUARE, $object->getWrap()); - $this->assertInstanceOf(RichText::class, $object->setWrap(RichText::WRAP_NONE)); - $this->assertEquals(RichText::WRAP_NONE, $object->getWrap()); + self::assertInstanceOf(RichText::class, $object->setWrap(RichText::WRAP_NONE)); + self::assertEquals(RichText::WRAP_NONE, $object->getWrap()); } public function testHashCode(): void @@ -281,6 +280,6 @@ public function testHashCode(): void $hash .= RichText::WRAP_SQUARE . RichText::AUTOFIT_DEFAULT . RichText::OVERFLOW_OVERFLOW . RichText::OVERFLOW_OVERFLOW . '00104.89.69.64.8'; $hash .= md5('00000' . $object->getFill()->getHashCode() . $object->getShadow()->getHashCode() . '' . get_parent_class($object)); $hash .= get_class($object); - $this->assertEquals(md5($hash), $object->getHashCode()); + self::assertEquals(md5($hash), $object->getHashCode()); } } diff --git a/tests/PhpPresentation/Tests/Shape/Table/CellTest.php b/tests/PhpPresentation/Tests/Shape/Table/CellTest.php index 7f0ccc502..c4e1ee8b6 100644 --- a/tests/PhpPresentation/Tests/Shape/Table/CellTest.php +++ b/tests/PhpPresentation/Tests/Shape/Table/CellTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -41,30 +40,30 @@ class CellTest extends TestCase public function testConstruct(): void { $object = new Cell(); - $this->assertEquals(0, $object->getActiveParagraphIndex()); - $this->assertCount(1, $object->getParagraphs()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Fill', $object->getFill()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Borders', $object->getBorders()); + self::assertEquals(0, $object->getActiveParagraphIndex()); + self::assertCount(1, $object->getParagraphs()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Fill', $object->getFill()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Borders', $object->getBorders()); } public function testActiveParagraph(): void { $object = new Cell(); - $this->assertEquals(0, $object->getActiveParagraphIndex()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Paragraph', $object->createParagraph()); - $this->assertCount(2, $object->getParagraphs()); + self::assertEquals(0, $object->getActiveParagraphIndex()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Paragraph', $object->createParagraph()); + self::assertCount(2, $object->getParagraphs()); $value = mt_rand(0, 1); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Paragraph', $object->setActiveParagraph($value)); - $this->assertEquals($value, $object->getActiveParagraphIndex()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Paragraph', $object->getActiveParagraph()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Paragraph', $object->getParagraph()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Paragraph', $object->setActiveParagraph($value)); + self::assertEquals($value, $object->getActiveParagraphIndex()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Paragraph', $object->getActiveParagraph()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Paragraph', $object->getParagraph()); $value = mt_rand(0, 1); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Paragraph', $object->getParagraph($value)); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Paragraph', $object->getParagraph($value)); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Table\\Cell', $object->setParagraphs([])); - $this->assertCount(0, $object->getParagraphs()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Paragraph', $object->createParagraph()); - $this->assertCount(1, $object->getParagraphs()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Table\\Cell', $object->setParagraphs([])); + self::assertCount(0, $object->getParagraphs()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Paragraph', $object->createParagraph()); + self::assertCount(1, $object->getParagraphs()); } public function testActiveParagraphException(): void @@ -93,28 +92,28 @@ public function testSetGetHashIndex(): void $object = new Cell(); $value = mt_rand(1, 100); $object->setHashIndex($value); - $this->assertEquals($value, $object->getHashIndex()); + self::assertEquals($value, $object->getHashIndex()); } public function testText(): void { $object = new Cell(); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Table\\Cell', $object->addText()); - $this->assertCount(1, $object->getActiveParagraph()->getRichTextElements()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Table\\Cell', $object->addText(new TextElement())); - $this->assertCount(2, $object->getActiveParagraph()->getRichTextElements()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\TextElement', $object->createText()); - $this->assertCount(3, $object->getActiveParagraph()->getRichTextElements()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\TextElement', $object->createText('ALPHA')); - $this->assertCount(4, $object->getActiveParagraph()->getRichTextElements()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\BreakElement', $object->createBreak()); - $this->assertCount(5, $object->getActiveParagraph()->getRichTextElements()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $object->createTextRun()); - $this->assertCount(6, $object->getActiveParagraph()->getRichTextElements()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $object->createTextRun('BETA')); - $this->assertCount(7, $object->getActiveParagraph()->getRichTextElements()); - $this->assertEquals('ALPHA' . "\r\n" . 'BETA', $object->getPlainText()); - $this->assertEquals('ALPHA' . "\r\n" . 'BETA', (string) $object); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Table\\Cell', $object->addText()); + self::assertCount(1, $object->getActiveParagraph()->getRichTextElements()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Table\\Cell', $object->addText(new TextElement())); + self::assertCount(2, $object->getActiveParagraph()->getRichTextElements()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\TextElement', $object->createText()); + self::assertCount(3, $object->getActiveParagraph()->getRichTextElements()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\TextElement', $object->createText('ALPHA')); + self::assertCount(4, $object->getActiveParagraph()->getRichTextElements()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\BreakElement', $object->createBreak()); + self::assertCount(5, $object->getActiveParagraph()->getRichTextElements()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $object->createTextRun()); + self::assertCount(6, $object->getActiveParagraph()->getRichTextElements()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $object->createTextRun('BETA')); + self::assertCount(7, $object->getActiveParagraph()->getRichTextElements()); + self::assertEquals('ALPHA' . "\r\n" . 'BETA', $object->getPlainText()); + self::assertEquals('ALPHA' . "\r\n" . 'BETA', (string) $object); } public function testParagraphs(): void @@ -127,60 +126,60 @@ public function testParagraphs(): void new Paragraph(), ]; - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Table\\Cell', $object->setParagraphs($array)); - $this->assertCount(3, $object->getParagraphs()); - $this->assertEquals(2, $object->getActiveParagraphIndex()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Table\\Cell', $object->setParagraphs($array)); + self::assertCount(3, $object->getParagraphs()); + self::assertEquals(2, $object->getActiveParagraphIndex()); } public function testGetSetBorders(): void { $object = new Cell(); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Table\\Cell', $object->setBorders(new Borders())); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Borders', $object->getBorders()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Table\\Cell', $object->setBorders(new Borders())); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Borders', $object->getBorders()); } public function testGetSetColspan(): void { $object = new Cell(); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Table\\Cell', $object->setColSpan()); - $this->assertEquals(0, $object->getColSpan()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Table\\Cell', $object->setColSpan()); + self::assertEquals(0, $object->getColSpan()); $value = mt_rand(1, 100); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Table\\Cell', $object->setColSpan($value)); - $this->assertEquals($value, $object->getColSpan()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Table\\Cell', $object->setColSpan($value)); + self::assertEquals($value, $object->getColSpan()); } public function testGetSetFill(): void { $object = new Cell(); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Table\\Cell', $object->setFill(new Fill())); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Fill', $object->getFill()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Table\\Cell', $object->setFill(new Fill())); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Fill', $object->getFill()); } public function testGetSetRowspan(): void { $object = new Cell(); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Table\\Cell', $object->setRowSpan()); - $this->assertEquals(0, $object->getRowSpan()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Table\\Cell', $object->setRowSpan()); + self::assertEquals(0, $object->getRowSpan()); $value = mt_rand(1, 100); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Table\\Cell', $object->setRowSpan($value)); - $this->assertEquals($value, $object->getRowSpan()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Table\\Cell', $object->setRowSpan($value)); + self::assertEquals($value, $object->getRowSpan()); } public function testGetSetWidth(): void { $object = new Cell(); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Table\\Cell', $object->setWidth()); - $this->assertEquals(0, $object->getWidth()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Table\\Cell', $object->setWidth()); + self::assertEquals(0, $object->getWidth()); $value = mt_rand(1, 100); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Table\\Cell', $object->setWidth($value)); - $this->assertEquals($value, $object->getWidth()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Table\\Cell', $object->setWidth($value)); + self::assertEquals($value, $object->getWidth()); } } diff --git a/tests/PhpPresentation/Tests/Shape/Table/RowTest.php b/tests/PhpPresentation/Tests/Shape/Table/RowTest.php index 2e8ed0595..26597a5fa 100644 --- a/tests/PhpPresentation/Tests/Shape/Table/RowTest.php +++ b/tests/PhpPresentation/Tests/Shape/Table/RowTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -39,20 +38,20 @@ class RowTest extends TestCase public function testConstruct(): void { $object = new Row(); - $this->assertCount(1, $object->getCells()); - $this->assertInstanceOf(Fill::class, $object->getFill()); + self::assertCount(1, $object->getCells()); + self::assertInstanceOf(Fill::class, $object->getFill()); $value = mt_rand(1, 100); $object = new Row($value); - $this->assertCount($value, $object->getCells()); - $this->assertInstanceOf(Fill::class, $object->getFill()); + self::assertCount($value, $object->getCells()); + self::assertInstanceOf(Fill::class, $object->getFill()); } public function testGetCell(): void { $object = new Row(); - $this->assertInstanceOf(Cell::class, $object->getCell(0)); + self::assertInstanceOf(Cell::class, $object->getCell(0)); } public function testGetCellException(): void @@ -68,7 +67,7 @@ public function testNextCell(): void { $object = new Row(2); - $this->assertInstanceOf(Cell::class, $object->nextCell()); + self::assertInstanceOf(Cell::class, $object->nextCell()); } public function testNextCellException(): void @@ -89,26 +88,26 @@ public function testSetGetHashIndex(): void $object = new Row(); $value = mt_rand(1, 100); $object->setHashIndex($value); - $this->assertEquals($value, $object->getHashIndex()); + self::assertEquals($value, $object->getHashIndex()); } public function testGetSetFill(): void { $object = new Row(); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Table\\Row', $object->setFill(new Fill())); - $this->assertInstanceOf(Fill::class, $object->getFill()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Table\\Row', $object->setFill(new Fill())); + self::assertInstanceOf(Fill::class, $object->getFill()); } public function testGetSetHeight(): void { $object = new Row(); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Table\\Row', $object->setHeight()); - $this->assertEquals(0, $object->getHeight()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Table\\Row', $object->setHeight()); + self::assertEquals(0, $object->getHeight()); $value = mt_rand(1, 100); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Table\\Row', $object->setHeight($value)); - $this->assertEquals($value, $object->getHeight()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Table\\Row', $object->setHeight($value)); + self::assertEquals($value, $object->getHeight()); } } diff --git a/tests/PhpPresentation/Tests/Shape/TableTest.php b/tests/PhpPresentation/Tests/Shape/TableTest.php index 286b151e9..524aa29a9 100644 --- a/tests/PhpPresentation/Tests/Shape/TableTest.php +++ b/tests/PhpPresentation/Tests/Shape/TableTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -35,8 +34,8 @@ class TableTest extends TestCase public function testConstruct(): void { $object = new Table(); - $this->assertEmpty($object->getRows()); - $this->assertFalse($object->isResizeProportional()); + self::assertEmpty($object->getRows()); + self::assertFalse($object->isResizeProportional()); } public function testNumColums(): void @@ -44,19 +43,19 @@ public function testNumColums(): void $value = mt_rand(1, 100); $object = new Table(); - $this->assertEquals(1, $object->getNumColumns()); - $this->assertInstanceOf(Table::class, $object->setNumColumns($value)); - $this->assertEquals($value, $object->getNumColumns()); + self::assertEquals(1, $object->getNumColumns()); + self::assertInstanceOf(Table::class, $object->setNumColumns($value)); + self::assertEquals($value, $object->getNumColumns()); } public function testRows(): void { $object = new Table(); - $this->assertInstanceOf(Row::class, $object->createRow()); - $this->assertCount(1, $object->getRows()); + self::assertInstanceOf(Row::class, $object->createRow()); + self::assertCount(1, $object->getRows()); - $this->assertInstanceOf(Row::class, $object->getRow(0)); + self::assertInstanceOf(Row::class, $object->getRow(0)); } public function testGetRowException(): void @@ -71,9 +70,9 @@ public function testGetRowException(): void public function testHashCode(): void { $object = new Table(); - $this->assertEquals(md5(get_class($object)), $object->getHashCode()); + self::assertEquals(md5(get_class($object)), $object->getHashCode()); $row = $object->createRow(); - $this->assertEquals(md5($row->getHashCode() . get_class($object)), $object->getHashCode()); + self::assertEquals(md5($row->getHashCode() . get_class($object)), $object->getHashCode()); } } diff --git a/tests/PhpPresentation/Tests/Slide/AbstractSlideTest.php b/tests/PhpPresentation/Tests/Slide/AbstractSlideTest.php index 16fd59778..d8d67a56f 100644 --- a/tests/PhpPresentation/Tests/Slide/AbstractSlideTest.php +++ b/tests/PhpPresentation/Tests/Slide/AbstractSlideTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -37,17 +36,17 @@ public function testCollection(): void $stub = $this->getMockForAbstractClass('PhpOffice\\PhpPresentation\\Slide\\AbstractSlide'); $array = []; - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\AbstractSlide', $stub->setShapeCollection($array)); - $this->assertIsArray($stub->getShapeCollection()); - $this->assertCount(count($array), $stub->getShapeCollection()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\AbstractSlide', $stub->setShapeCollection($array)); + self::assertIsArray($stub->getShapeCollection()); + self::assertCount(count($array), $stub->getShapeCollection()); $array = [ new RichText(), new RichText(), new RichText(), ]; - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\AbstractSlide', $stub->setShapeCollection($array)); - $this->assertIsArray($stub->getShapeCollection()); - $this->assertCount(count($array), $stub->getShapeCollection()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\AbstractSlide', $stub->setShapeCollection($array)); + self::assertIsArray($stub->getShapeCollection()); + self::assertCount(count($array), $stub->getShapeCollection()); } } diff --git a/tests/PhpPresentation/Tests/Slide/AnimationTest.php b/tests/PhpPresentation/Tests/Slide/AnimationTest.php index 84d48cee0..6056202cc 100644 --- a/tests/PhpPresentation/Tests/Slide/AnimationTest.php +++ b/tests/PhpPresentation/Tests/Slide/AnimationTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -38,16 +37,16 @@ public function testShape(): void $object = new Animation(); - $this->assertIsArray($object->getShapeCollection()); - $this->assertCount(0, $object->getShapeCollection()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\Animation', $object->addShape($oStub)); - $this->assertIsArray($object->getShapeCollection()); - $this->assertCount(1, $object->getShapeCollection()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\Animation', $object->setShapeCollection()); - $this->assertIsArray($object->getShapeCollection()); - $this->assertCount(0, $object->getShapeCollection()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\Animation', $object->setShapeCollection([$oStub])); - $this->assertIsArray($object->getShapeCollection()); - $this->assertCount(1, $object->getShapeCollection()); + self::assertIsArray($object->getShapeCollection()); + self::assertCount(0, $object->getShapeCollection()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\Animation', $object->addShape($oStub)); + self::assertIsArray($object->getShapeCollection()); + self::assertCount(1, $object->getShapeCollection()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\Animation', $object->setShapeCollection()); + self::assertIsArray($object->getShapeCollection()); + self::assertCount(0, $object->getShapeCollection()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\Animation', $object->setShapeCollection([$oStub])); + self::assertIsArray($object->getShapeCollection()); + self::assertCount(1, $object->getShapeCollection()); } } diff --git a/tests/PhpPresentation/Tests/Slide/Background/ColorTest.php b/tests/PhpPresentation/Tests/Slide/Background/ColorTest.php index 02946f7a8..a26e10d50 100644 --- a/tests/PhpPresentation/Tests/Slide/Background/ColorTest.php +++ b/tests/PhpPresentation/Tests/Slide/Background/ColorTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -33,10 +32,10 @@ public function testColor(): void $oStyleColor = new StyleColor(); $oStyleColor->setRGB('123456'); - $this->assertNull($object->getColor()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\Background\\Color', $object->setColor($oStyleColor)); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Color', $object->getColor()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\Background\\Color', $object->setColor()); - $this->assertNull($object->getColor()); + self::assertNull($object->getColor()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\Background\\Color', $object->setColor($oStyleColor)); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Color', $object->getColor()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\Background\\Color', $object->setColor()); + self::assertNull($object->getColor()); } } diff --git a/tests/PhpPresentation/Tests/Slide/Background/ImageTest.php b/tests/PhpPresentation/Tests/Slide/Background/ImageTest.php index be9251773..a4efc0525 100644 --- a/tests/PhpPresentation/Tests/Slide/Background/ImageTest.php +++ b/tests/PhpPresentation/Tests/Slide/Background/ImageTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -33,22 +32,22 @@ public function testColor(): void $imagePath = PHPPRESENTATION_TESTS_BASE_DIR . DIRECTORY_SEPARATOR . 'resources' . DIRECTORY_SEPARATOR . 'images' . DIRECTORY_SEPARATOR . 'PhpPresentationLogo.png'; $numSlide = (string) mt_rand(1, 100); - $this->assertNull($object->getPath()); - $this->assertEmpty($object->getFilename()); - $this->assertEmpty($object->getExtension()); - $this->assertEquals('background_' . $numSlide . '.', $object->getIndexedFilename($numSlide)); - - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\Background\\Image', $object->setPath($imagePath)); - $this->assertEquals($imagePath, $object->getPath()); - $this->assertEquals('PhpPresentationLogo.png', $object->getFilename()); - $this->assertEquals('png', $object->getExtension()); - $this->assertEquals('background_' . $numSlide . '.png', $object->getIndexedFilename($numSlide)); - - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\Background\\Image', $object->setPath('', false)); - $this->assertEquals('', $object->getPath()); - $this->assertEmpty($object->getFilename()); - $this->assertEmpty($object->getExtension()); - $this->assertEquals('background_' . $numSlide . '.', $object->getIndexedFilename($numSlide)); + self::assertNull($object->getPath()); + self::assertEmpty($object->getFilename()); + self::assertEmpty($object->getExtension()); + self::assertEquals('background_' . $numSlide . '.', $object->getIndexedFilename($numSlide)); + + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\Background\\Image', $object->setPath($imagePath)); + self::assertEquals($imagePath, $object->getPath()); + self::assertEquals('PhpPresentationLogo.png', $object->getFilename()); + self::assertEquals('png', $object->getExtension()); + self::assertEquals('background_' . $numSlide . '.png', $object->getIndexedFilename($numSlide)); + + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\Background\\Image', $object->setPath('', false)); + self::assertEquals('', $object->getPath()); + self::assertEmpty($object->getFilename()); + self::assertEmpty($object->getExtension()); + self::assertEquals('background_' . $numSlide . '.', $object->getIndexedFilename($numSlide)); } public function testPathException(): void diff --git a/tests/PhpPresentation/Tests/Slide/Background/SchemeColorTest.php b/tests/PhpPresentation/Tests/Slide/Background/SchemeColorTest.php index cdf5142ff..c1cb4890c 100644 --- a/tests/PhpPresentation/Tests/Slide/Background/SchemeColorTest.php +++ b/tests/PhpPresentation/Tests/Slide/Background/SchemeColorTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -32,12 +31,12 @@ public function testBasic(): void $object = new SchemeColor(); - $this->assertNull($object->getSchemeColor()); + self::assertNull($object->getSchemeColor()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\Background\\SchemeColor', $object->setSchemeColor($oStyle)); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\SchemeColor', $object->getSchemeColor()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\Background\\SchemeColor', $object->setSchemeColor($oStyle)); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\SchemeColor', $object->getSchemeColor()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\Background\\SchemeColor', $object->setSchemeColor()); - $this->assertNull($object->getSchemeColor()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\Background\\SchemeColor', $object->setSchemeColor()); + self::assertNull($object->getSchemeColor()); } } diff --git a/tests/PhpPresentation/Tests/Slide/IteratorTest.php b/tests/PhpPresentation/Tests/Slide/IteratorTest.php index 480e874d4..5ab966696 100644 --- a/tests/PhpPresentation/Tests/Slide/IteratorTest.php +++ b/tests/PhpPresentation/Tests/Slide/IteratorTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -39,15 +38,15 @@ public function testMethod(): void $object = new Iterator($oPhpPresentation); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide', $object->current()); - $this->assertEquals(0, $object->key()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Slide', $object->current()); + self::assertEquals(0, $object->key()); $object->next(); - $this->assertEquals(1, $object->key()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide', $object->current()); - $this->assertTrue($object->valid()); + self::assertEquals(1, $object->key()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Slide', $object->current()); + self::assertTrue($object->valid()); $object->next(); - $this->assertFalse($object->valid()); + self::assertFalse($object->valid()); $object->rewind(); - $this->assertEquals(0, $object->key()); + self::assertEquals(0, $object->key()); } } diff --git a/tests/PhpPresentation/Tests/Slide/NoteTest.php b/tests/PhpPresentation/Tests/Slide/NoteTest.php index 7b40555fb..5cf4ce020 100644 --- a/tests/PhpPresentation/Tests/Slide/NoteTest.php +++ b/tests/PhpPresentation/Tests/Slide/NoteTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -35,48 +34,48 @@ class NoteTest extends TestCase public function testParent(): void { $object = new Note(); - $this->assertNull($object->getParent()); + self::assertNull($object->getParent()); $oPhpPresentation = new PhpPresentation(); $oSlide = $oPhpPresentation->createSlide(); $oSlide->setNote($object); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide', $object->getParent()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Slide', $object->getParent()); } public function testExtent(): void { $object = new Note(); - $this->assertNotNull($object->getExtentX()); + self::assertNotNull($object->getExtentX()); $object = new Note(); - $this->assertNotNull($object->getExtentY()); + self::assertNotNull($object->getExtentY()); } public function testHashCode(): void { $object = new Note(); - $this->assertIsString($object->getHashCode()); + self::assertIsString($object->getHashCode()); } public function testOffset(): void { $object = new Note(); - $this->assertNotNull($object->getOffsetX()); + self::assertNotNull($object->getOffsetX()); $object = new Note(); - $this->assertNotNull($object->getOffsetY()); + self::assertNotNull($object->getOffsetY()); } public function testShape(): void { $object = new Note(); - $this->assertEquals(0, $object->getShapeCollection()->count()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText', $object->createRichTextShape()); - $this->assertEquals(1, $object->getShapeCollection()->count()); + self::assertEquals(0, $object->getShapeCollection()->count()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText', $object->createRichTextShape()); + self::assertEquals(1, $object->getShapeCollection()->count()); $oRichText = new RichText(); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText', $object->addShape($oRichText)); - $this->assertEquals(2, $object->getShapeCollection()->count()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText', $object->addShape($oRichText)); + self::assertEquals(2, $object->getShapeCollection()->count()); } /** @@ -86,8 +85,8 @@ public function testSetGetHashIndex(): void { $object = new Note(); $value = mt_rand(1, 100); - $this->assertNull($object->getHashIndex()); + self::assertNull($object->getHashIndex()); $object->setHashIndex($value); - $this->assertEquals($value, $object->getHashIndex()); + self::assertEquals($value, $object->getHashIndex()); } } diff --git a/tests/PhpPresentation/Tests/Slide/SlideLayoutTest.php b/tests/PhpPresentation/Tests/Slide/SlideLayoutTest.php index 2fc7f7df0..b3d23a42d 100644 --- a/tests/PhpPresentation/Tests/Slide/SlideLayoutTest.php +++ b/tests/PhpPresentation/Tests/Slide/SlideLayoutTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -37,9 +36,9 @@ public function testBase(): void $mockSlideMaster = $this->getMockForAbstractClass(SlideMaster::class); $object = new SlideLayout($mockSlideMaster); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\AbstractSlide', $object); - $this->assertInstanceOf('\\ArrayObject', $object->getShapeCollection()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\ColorMap', $object->colorMap); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\AbstractSlide', $object); + self::assertInstanceOf('\\ArrayObject', $object->getShapeCollection()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\ColorMap', $object->colorMap); } public function testLayoutName(): void @@ -48,13 +47,13 @@ public function testLayoutName(): void $mockSlideMaster = $this->getMockForAbstractClass(SlideMaster::class); // Expected - $expectedLayoutName = 'Title' . rand(1, 100); + $expectedLayoutName = 'Title' . mt_rand(1, 100); $object = new SlideLayout($mockSlideMaster); - $this->assertNull($object->getLayoutName()); - $this->assertInstanceOf(SlideLayout::class, $object->setLayoutName($expectedLayoutName)); - $this->assertEquals($expectedLayoutName, $object->getLayoutName()); + self::assertNull($object->getLayoutName()); + self::assertInstanceOf(SlideLayout::class, $object->setLayoutName($expectedLayoutName)); + self::assertEquals($expectedLayoutName, $object->getLayoutName()); } public function testSlideMaster(): void @@ -64,6 +63,6 @@ public function testSlideMaster(): void $object = new SlideLayout($mockSlideMaster); - $this->assertInstanceOf(SlideMaster::class, $object->getSlideMaster()); + self::assertInstanceOf(SlideMaster::class, $object->getSlideMaster()); } } diff --git a/tests/PhpPresentation/Tests/Slide/SlideMasterTest.php b/tests/PhpPresentation/Tests/Slide/SlideMasterTest.php index 4bda4aa51..e910ae79a 100644 --- a/tests/PhpPresentation/Tests/Slide/SlideMasterTest.php +++ b/tests/PhpPresentation/Tests/Slide/SlideMasterTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -37,15 +36,15 @@ class SlideMasterTest extends TestCase public function testBase(): void { $object = new SlideMaster(); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\AbstractSlide', $object); - $this->assertNull($object->getParent()); - $this->assertInstanceOf('\\ArrayObject', $object->getShapeCollection()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\ColorMap', $object->colorMap); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\AbstractSlide', $object); + self::assertNull($object->getParent()); + self::assertInstanceOf('\\ArrayObject', $object->getShapeCollection()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\ColorMap', $object->colorMap); /** @var Color $background */ $background = $object->getBackground(); - $this->assertInstanceOf(Color::class, $background); - $this->assertEquals('FFFFFF', $background->getColor()->getRGB()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\TextStyle', $object->getTextStyles()); + self::assertInstanceOf(Color::class, $background); + self::assertEquals('FFFFFF', $background->getColor()->getRGB()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\TextStyle', $object->getTextStyles()); } public function testLayout(): void @@ -56,10 +55,10 @@ public function testLayout(): void /** @var SlideLayout $mockSlideLayout */ $mockSlideLayout = $this->getMockForAbstractClass(SlideLayout::class, [$object]); - $this->assertEmpty($object->getAllSlideLayouts()); - $this->assertInstanceOf(SlideLayout::class, $object->createSlideLayout()); - $this->assertInstanceOf(SlideLayout::class, $object->addSlideLayout($mockSlideLayout)); - $this->assertCount(2, $object->getAllSlideLayouts()); + self::assertEmpty($object->getAllSlideLayouts()); + self::assertInstanceOf(SlideLayout::class, $object->createSlideLayout()); + self::assertInstanceOf(SlideLayout::class, $object->addSlideLayout($mockSlideLayout)); + self::assertCount(2, $object->getAllSlideLayouts()); } public function testSchemeColors(): void @@ -76,14 +75,14 @@ public function testSchemeColors(): void $object = new SlideMaster(); - $this->assertIsArray($object->getAllSchemeColors()); - $this->assertCount(12, $object->getAllSchemeColors()); + self::assertIsArray($object->getAllSchemeColors()); + self::assertCount(12, $object->getAllSchemeColors()); // Add idem value - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\SlideMaster', $object->addSchemeColor($mockSchemeColorAccent1)); - $this->assertCount(12, $object->getAllSchemeColors()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\SlideMaster', $object->addSchemeColor($mockSchemeColorAccent1)); + self::assertCount(12, $object->getAllSchemeColors()); // Add new value - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\SlideMaster', $object->addSchemeColor($mockSchemeColorNew)); - $this->assertCount(13, $object->getAllSchemeColors()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\SlideMaster', $object->addSchemeColor($mockSchemeColorNew)); + self::assertCount(13, $object->getAllSchemeColors()); } public function testTextStyles(): void @@ -94,8 +93,8 @@ public function testTextStyles(): void $object = new SlideMaster(); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\TextStyle', $object->getTextStyles()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\SlideMaster', $object->setTextStyles($mockTextStyle)); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\TextStyle', $object->getTextStyles()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\TextStyle', $object->getTextStyles()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\SlideMaster', $object->setTextStyles($mockTextStyle)); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\TextStyle', $object->getTextStyles()); } } diff --git a/tests/PhpPresentation/Tests/Slide/TransitionTest.php b/tests/PhpPresentation/Tests/Slide/TransitionTest.php index 5afda6050..836cc4937 100644 --- a/tests/PhpPresentation/Tests/Slide/TransitionTest.php +++ b/tests/PhpPresentation/Tests/Slide/TransitionTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -33,52 +32,52 @@ class TransitionTest extends TestCase public function testSpeed(): void { $object = new Transition(); - $this->assertNull($object->getSpeed()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\Transition', $object->setSpeed()); - $this->assertEquals(Transition::SPEED_MEDIUM, $object->getSpeed()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\Transition', $object->setSpeed(Transition::SPEED_FAST)); - $this->assertEquals(Transition::SPEED_FAST, $object->getSpeed()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\Transition', $object->setSpeed('notagoodvalue')); - $this->assertNull($object->getSpeed()); + self::assertNull($object->getSpeed()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\Transition', $object->setSpeed()); + self::assertEquals(Transition::SPEED_MEDIUM, $object->getSpeed()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\Transition', $object->setSpeed(Transition::SPEED_FAST)); + self::assertEquals(Transition::SPEED_FAST, $object->getSpeed()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\Transition', $object->setSpeed('notagoodvalue')); + self::assertNull($object->getSpeed()); } public function testManualTrigger(): void { $object = new Transition(); - $this->assertFalse($object->hasManualTrigger()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\Transition', $object->setManualTrigger()); - $this->assertFalse($object->hasManualTrigger()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\Transition', $object->setManualTrigger(true)); - $this->assertTrue($object->hasManualTrigger()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\Transition', $object->setManualTrigger(false)); - $this->assertFalse($object->hasManualTrigger()); + self::assertFalse($object->hasManualTrigger()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\Transition', $object->setManualTrigger()); + self::assertFalse($object->hasManualTrigger()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\Transition', $object->setManualTrigger(true)); + self::assertTrue($object->hasManualTrigger()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\Transition', $object->setManualTrigger(false)); + self::assertFalse($object->hasManualTrigger()); } public function testTimeTrigger(): void { $object = new Transition(); - $this->assertFalse($object->hasTimeTrigger()); - $this->assertNull($object->getAdvanceTimeTrigger()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\Transition', $object->setTimeTrigger()); - $this->assertFalse($object->hasTimeTrigger()); - $this->assertNull($object->getAdvanceTimeTrigger()); + self::assertFalse($object->hasTimeTrigger()); + self::assertNull($object->getAdvanceTimeTrigger()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\Transition', $object->setTimeTrigger()); + self::assertFalse($object->hasTimeTrigger()); + self::assertNull($object->getAdvanceTimeTrigger()); $value = mt_rand(1, 1000); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\Transition', $object->setTimeTrigger(true, $value)); - $this->assertTrue($object->hasTimeTrigger()); - $this->assertEquals($value, $object->getAdvanceTimeTrigger()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\Transition', $object->setTimeTrigger(true, $value)); + self::assertTrue($object->hasTimeTrigger()); + self::assertEquals($value, $object->getAdvanceTimeTrigger()); $value = mt_rand(1, 1000); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\Transition', $object->setTimeTrigger(false, $value)); - $this->assertFalse($object->hasTimeTrigger()); - $this->assertNull($object->getAdvanceTimeTrigger()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\Transition', $object->setTimeTrigger(false, $value)); + self::assertFalse($object->hasTimeTrigger()); + self::assertNull($object->getAdvanceTimeTrigger()); } public function testTransitionType(): void { $object = new Transition(); - $this->assertNull($object->getTransitionType()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\Transition', $object->setTransitionType()); - $this->assertNull($object->getTransitionType()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\Transition', $object->setTransitionType(Transition::TRANSITION_RANDOM)); - $this->assertEquals(Transition::TRANSITION_RANDOM, $object->getTransitionType()); + self::assertNull($object->getTransitionType()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\Transition', $object->setTransitionType()); + self::assertNull($object->getTransitionType()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\Transition', $object->setTransitionType(Transition::TRANSITION_RANDOM)); + self::assertEquals(Transition::TRANSITION_RANDOM, $object->getTransitionType()); } } diff --git a/tests/PhpPresentation/Tests/SlideTest.php b/tests/PhpPresentation/Tests/SlideTest.php index eea3f731d..99fff513c 100644 --- a/tests/PhpPresentation/Tests/SlideTest.php +++ b/tests/PhpPresentation/Tests/SlideTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -37,40 +36,40 @@ class SlideTest extends TestCase public function testExtents(): void { $object = new Slide(); - $this->assertNotNull($object->getExtentX()); + self::assertNotNull($object->getExtentX()); $object = new Slide(); - $this->assertNotNull($object->getExtentY()); + self::assertNotNull($object->getExtentY()); } public function testOffset(): void { $object = new Slide(); - $this->assertNotNull($object->getOffsetX()); + self::assertNotNull($object->getOffsetX()); $object = new Slide(); - $this->assertNotNull($object->getOffsetY()); + self::assertNotNull($object->getOffsetY()); } public function testParent(): void { $object = new Slide(); - $this->assertNull($object->getParent()); + self::assertNull($object->getParent()); $oPhpPresentation = new PhpPresentation(); $object = new Slide($oPhpPresentation); - $this->assertInstanceOf(PhpPresentation::class, $object->getParent()); + self::assertInstanceOf(PhpPresentation::class, $object->getParent()); } public function testSlideMasterId(): void { $value = mt_rand(1, 100); $object = new Slide(); - $this->assertEquals(1, $object->getSlideMasterId()); - $this->assertInstanceOf(Slide::class, $object->setSlideMasterId()); - $this->assertEquals(1, $object->getSlideMasterId()); - $this->assertInstanceOf(Slide::class, $object->setSlideMasterId($value)); - $this->assertEquals($value, $object->getSlideMasterId()); + self::assertEquals(1, $object->getSlideMasterId()); + self::assertInstanceOf(Slide::class, $object->setSlideMasterId()); + self::assertEquals(1, $object->getSlideMasterId()); + self::assertInstanceOf(Slide::class, $object->setSlideMasterId($value)); + self::assertEquals($value, $object->getSlideMasterId()); } public function testAnimations(): void @@ -79,17 +78,17 @@ public function testAnimations(): void $oStub = $this->getMockForAbstractClass(Animation::class); $object = new Slide(); - $this->assertIsArray($object->getAnimations()); - $this->assertCount(0, $object->getAnimations()); - $this->assertInstanceOf(Slide::class, $object->addAnimation($oStub)); - $this->assertIsArray($object->getAnimations()); - $this->assertCount(1, $object->getAnimations()); - $this->assertInstanceOf(Slide::class, $object->setAnimations()); - $this->assertIsArray($object->getAnimations()); - $this->assertCount(0, $object->getAnimations()); - $this->assertInstanceOf(Slide::class, $object->setAnimations([$oStub])); - $this->assertIsArray($object->getAnimations()); - $this->assertCount(1, $object->getAnimations()); + self::assertIsArray($object->getAnimations()); + self::assertCount(0, $object->getAnimations()); + self::assertInstanceOf(Slide::class, $object->addAnimation($oStub)); + self::assertIsArray($object->getAnimations()); + self::assertCount(1, $object->getAnimations()); + self::assertInstanceOf(Slide::class, $object->setAnimations()); + self::assertIsArray($object->getAnimations()); + self::assertCount(0, $object->getAnimations()); + self::assertInstanceOf(Slide::class, $object->setAnimations([$oStub])); + self::assertIsArray($object->getAnimations()); + self::assertCount(1, $object->getAnimations()); } public function testBackground(): void @@ -98,49 +97,49 @@ public function testBackground(): void $oStub = $this->getMockForAbstractClass(AbstractBackground::class); $object = new Slide(); - $this->assertNull($object->getBackground()); - $this->assertInstanceOf(Slide::class, $object->setBackground($oStub)); - $this->assertInstanceOf(AbstractBackground::class, $object->getBackground()); - $this->assertInstanceOf(Slide::class, $object->setBackground()); - $this->assertNull($object->getBackground()); + self::assertNull($object->getBackground()); + self::assertInstanceOf(Slide::class, $object->setBackground($oStub)); + self::assertInstanceOf(AbstractBackground::class, $object->getBackground()); + self::assertInstanceOf(Slide::class, $object->setBackground()); + self::assertNull($object->getBackground()); } public function testGroup(): void { $object = new Slide(); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Group', $object->createGroup()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Group', $object->createGroup()); } public function testName(): void { $object = new Slide(); - $this->assertNull($object->getName()); - $this->assertInstanceOf(Slide::class, $object->setName('AAAA')); - $this->assertEquals('AAAA', $object->getName()); - $this->assertInstanceOf(Slide::class, $object->setName()); - $this->assertNull($object->getName()); + self::assertNull($object->getName()); + self::assertInstanceOf(Slide::class, $object->setName('AAAA')); + self::assertEquals('AAAA', $object->getName()); + self::assertInstanceOf(Slide::class, $object->setName()); + self::assertNull($object->getName()); } public function testTransition(): void { $object = new Slide(); $oTransition = new Transition(); - $this->assertNull($object->getTransition()); - $this->assertInstanceOf(Slide::class, $object->setTransition()); - $this->assertNull($object->getTransition()); - $this->assertInstanceOf(Slide::class, $object->setTransition($oTransition)); - $this->assertInstanceOf(Transition::class, $object->getTransition()); - $this->assertInstanceOf(Slide::class, $object->setTransition(null)); - $this->assertNull($object->getTransition()); + self::assertNull($object->getTransition()); + self::assertInstanceOf(Slide::class, $object->setTransition()); + self::assertNull($object->getTransition()); + self::assertInstanceOf(Slide::class, $object->setTransition($oTransition)); + self::assertInstanceOf(Transition::class, $object->getTransition()); + self::assertInstanceOf(Slide::class, $object->setTransition(null)); + self::assertNull($object->getTransition()); } public function testVisible(): void { $object = new Slide(); - $this->assertTrue($object->isVisible()); - $this->assertInstanceOf(Slide::class, $object->setIsVisible(false)); - $this->assertFalse($object->isVisible()); - $this->assertInstanceOf(Slide::class, $object->setIsVisible()); - $this->assertTrue($object->isVisible()); + self::assertTrue($object->isVisible()); + self::assertInstanceOf(Slide::class, $object->setIsVisible(false)); + self::assertFalse($object->isVisible()); + self::assertInstanceOf(Slide::class, $object->setIsVisible()); + self::assertTrue($object->isVisible()); } } diff --git a/tests/PhpPresentation/Tests/Style/AlignmentTest.php b/tests/PhpPresentation/Tests/Style/AlignmentTest.php index 510811fb4..ca1651174 100644 --- a/tests/PhpPresentation/Tests/Style/AlignmentTest.php +++ b/tests/PhpPresentation/Tests/Style/AlignmentTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -37,15 +36,15 @@ class AlignmentTest extends TestCase public function testConstruct(): void { $object = new Alignment(); - $this->assertEquals(Alignment::HORIZONTAL_LEFT, $object->getHorizontal()); - $this->assertEquals(Alignment::VERTICAL_BASE, $object->getVertical()); - $this->assertEquals(Alignment::TEXT_DIRECTION_HORIZONTAL, $object->getTextDirection()); - $this->assertEquals(0, $object->getLevel()); - $this->assertEquals(0, $object->getIndent()); - $this->assertEquals(0, $object->getMarginLeft()); - $this->assertEquals(0, $object->getMarginRight()); - $this->assertEquals(0, $object->getMarginTop()); - $this->assertEquals(0, $object->getMarginBottom()); + self::assertEquals(Alignment::HORIZONTAL_LEFT, $object->getHorizontal()); + self::assertEquals(Alignment::VERTICAL_BASE, $object->getVertical()); + self::assertEquals(Alignment::TEXT_DIRECTION_HORIZONTAL, $object->getTextDirection()); + self::assertEquals(0, $object->getLevel()); + self::assertEquals(0, $object->getIndent()); + self::assertEquals(0, $object->getMarginLeft()); + self::assertEquals(0, $object->getMarginRight()); + self::assertEquals(0, $object->getMarginTop()); + self::assertEquals(0, $object->getMarginBottom()); } /** @@ -54,10 +53,10 @@ public function testConstruct(): void public function testSetGetHorizontal(): void { $object = new Alignment(); - $this->assertInstanceOf(Alignment::class, $object->setHorizontal('')); - $this->assertEquals(Alignment::HORIZONTAL_LEFT, $object->getHorizontal()); - $this->assertInstanceOf(Alignment::class, $object->setHorizontal(Alignment::HORIZONTAL_GENERAL)); - $this->assertEquals(Alignment::HORIZONTAL_GENERAL, $object->getHorizontal()); + self::assertInstanceOf(Alignment::class, $object->setHorizontal('')); + self::assertEquals(Alignment::HORIZONTAL_LEFT, $object->getHorizontal()); + self::assertInstanceOf(Alignment::class, $object->setHorizontal(Alignment::HORIZONTAL_GENERAL)); + self::assertEquals(Alignment::HORIZONTAL_GENERAL, $object->getHorizontal()); } /** @@ -66,12 +65,12 @@ public function testSetGetHorizontal(): void public function testTextDirection(): void { $object = new Alignment(); - $this->assertInstanceOf(Alignment::class, $object->setTextDirection('')); - $this->assertEquals(Alignment::TEXT_DIRECTION_HORIZONTAL, $object->getTextDirection()); - $this->assertInstanceOf(Alignment::class, $object->setTextDirection(Alignment::TEXT_DIRECTION_VERTICAL_90)); - $this->assertEquals(Alignment::TEXT_DIRECTION_VERTICAL_90, $object->getTextDirection()); - $this->assertInstanceOf(Alignment::class, $object->setTextDirection()); - $this->assertEquals(Alignment::TEXT_DIRECTION_HORIZONTAL, $object->getTextDirection()); + self::assertInstanceOf(Alignment::class, $object->setTextDirection('')); + self::assertEquals(Alignment::TEXT_DIRECTION_HORIZONTAL, $object->getTextDirection()); + self::assertInstanceOf(Alignment::class, $object->setTextDirection(Alignment::TEXT_DIRECTION_VERTICAL_90)); + self::assertEquals(Alignment::TEXT_DIRECTION_VERTICAL_90, $object->getTextDirection()); + self::assertInstanceOf(Alignment::class, $object->setTextDirection()); + self::assertEquals(Alignment::TEXT_DIRECTION_HORIZONTAL, $object->getTextDirection()); } /** @@ -80,10 +79,10 @@ public function testTextDirection(): void public function testSetGetVertical(): void { $object = new Alignment(); - $this->assertInstanceOf(Alignment::class, $object->setVertical('')); - $this->assertEquals(Alignment::VERTICAL_BASE, $object->getVertical()); - $this->assertInstanceOf(Alignment::class, $object->setVertical(Alignment::VERTICAL_AUTO)); - $this->assertEquals(Alignment::VERTICAL_AUTO, $object->getVertical()); + self::assertInstanceOf(Alignment::class, $object->setVertical('')); + self::assertEquals(Alignment::VERTICAL_BASE, $object->getVertical()); + self::assertInstanceOf(Alignment::class, $object->setVertical(Alignment::VERTICAL_AUTO)); + self::assertEquals(Alignment::VERTICAL_AUTO, $object->getVertical()); } /** @@ -105,8 +104,8 @@ public function testSetGetLevel(): void { $object = new Alignment(); $value = mt_rand(1, 8); - $this->assertInstanceOf(Alignment::class, $object->setLevel($value)); - $this->assertEquals($value, $object->getLevel()); + self::assertInstanceOf(Alignment::class, $object->setLevel($value)); + self::assertEquals($value, $object->getLevel()); } /** @@ -118,19 +117,19 @@ public function testSetGetIndent(): void // != Alignment::HORIZONTAL_GENERAL $object->setHorizontal(Alignment::HORIZONTAL_CENTER); $value = mt_rand(1, 100); - $this->assertInstanceOf(Alignment::class, $object->setIndent($value)); - $this->assertEquals(0, $object->getIndent()); + self::assertInstanceOf(Alignment::class, $object->setIndent($value)); + self::assertEquals(0, $object->getIndent()); $value = mt_rand(-100, 0); - $this->assertInstanceOf(Alignment::class, $object->setIndent($value)); - $this->assertEquals($value, $object->getIndent()); + self::assertInstanceOf(Alignment::class, $object->setIndent($value)); + self::assertEquals($value, $object->getIndent()); $object->setHorizontal(Alignment::HORIZONTAL_GENERAL); $value = mt_rand(1, 100); - $this->assertInstanceOf(Alignment::class, $object->setIndent($value)); - $this->assertEquals($value, $object->getIndent()); + self::assertInstanceOf(Alignment::class, $object->setIndent($value)); + self::assertEquals($value, $object->getIndent()); $value = mt_rand(-100, 0); - $this->assertInstanceOf(Alignment::class, $object->setIndent($value)); - $this->assertEquals($value, $object->getIndent()); + self::assertInstanceOf(Alignment::class, $object->setIndent($value)); + self::assertEquals($value, $object->getIndent()); } /** @@ -140,10 +139,10 @@ public function testSetGetMarginBottom(): void { $object = new Alignment(); $value = mt_rand(0, 100); - $this->assertInstanceOf(Alignment::class, $object->setMarginBottom($value)); - $this->assertEquals($value, $object->getMarginBottom()); - $this->assertInstanceOf(Alignment::class, $object->setMarginBottom()); - $this->assertEquals(0, $object->getMarginBottom()); + self::assertInstanceOf(Alignment::class, $object->setMarginBottom($value)); + self::assertEquals($value, $object->getMarginBottom()); + self::assertInstanceOf(Alignment::class, $object->setMarginBottom()); + self::assertEquals(0, $object->getMarginBottom()); } /** @@ -155,19 +154,19 @@ public function testSetGetMarginLeft(): void // != Alignment::HORIZONTAL_GENERAL $object->setHorizontal(Alignment::HORIZONTAL_CENTER); $value = mt_rand(1, 100); - $this->assertInstanceOf(Alignment::class, $object->setMarginLeft($value)); - $this->assertEquals(0, $object->getMarginLeft()); + self::assertInstanceOf(Alignment::class, $object->setMarginLeft($value)); + self::assertEquals(0, $object->getMarginLeft()); $value = mt_rand(-100, 0); - $this->assertInstanceOf(Alignment::class, $object->setMarginLeft($value)); - $this->assertEquals($value, $object->getMarginLeft()); + self::assertInstanceOf(Alignment::class, $object->setMarginLeft($value)); + self::assertEquals($value, $object->getMarginLeft()); $object->setHorizontal(Alignment::HORIZONTAL_GENERAL); $value = mt_rand(1, 100); - $this->assertInstanceOf(Alignment::class, $object->setMarginLeft($value)); - $this->assertEquals($value, $object->getMarginLeft()); + self::assertInstanceOf(Alignment::class, $object->setMarginLeft($value)); + self::assertEquals($value, $object->getMarginLeft()); $value = mt_rand(-100, 0); - $this->assertInstanceOf(Alignment::class, $object->setMarginLeft($value)); - $this->assertEquals($value, $object->getMarginLeft()); + self::assertInstanceOf(Alignment::class, $object->setMarginLeft($value)); + self::assertEquals($value, $object->getMarginLeft()); } /** @@ -179,19 +178,19 @@ public function testSetGetMarginRight(): void // != Alignment::HORIZONTAL_GENERAL $object->setHorizontal(Alignment::HORIZONTAL_CENTER); $value = mt_rand(1, 100); - $this->assertInstanceOf(Alignment::class, $object->setMarginRight($value)); - $this->assertEquals(0, $object->getMarginRight()); + self::assertInstanceOf(Alignment::class, $object->setMarginRight($value)); + self::assertEquals(0, $object->getMarginRight()); $value = mt_rand(-100, 0); - $this->assertInstanceOf(Alignment::class, $object->setMarginRight($value)); - $this->assertEquals($value, $object->getMarginRight()); + self::assertInstanceOf(Alignment::class, $object->setMarginRight($value)); + self::assertEquals($value, $object->getMarginRight()); $object->setHorizontal(Alignment::HORIZONTAL_GENERAL); $value = mt_rand(1, 100); - $this->assertInstanceOf(Alignment::class, $object->setMarginRight($value)); - $this->assertEquals($value, $object->getMarginRight()); + self::assertInstanceOf(Alignment::class, $object->setMarginRight($value)); + self::assertEquals($value, $object->getMarginRight()); $value = mt_rand(-100, 0); - $this->assertInstanceOf(Alignment::class, $object->setMarginRight($value)); - $this->assertEquals($value, $object->getMarginRight()); + self::assertInstanceOf(Alignment::class, $object->setMarginRight($value)); + self::assertEquals($value, $object->getMarginRight()); } /** @@ -201,22 +200,22 @@ public function testSetGetMarginTop(): void { $object = new Alignment(); $value = mt_rand(1, 100); - $this->assertInstanceOf(Alignment::class, $object->setMarginTop($value)); - $this->assertEquals($value, $object->getMarginTop()); - $this->assertInstanceOf(Alignment::class, $object->setMarginTop()); - $this->assertEquals(0, $object->getMarginTop()); + self::assertInstanceOf(Alignment::class, $object->setMarginTop($value)); + self::assertEquals($value, $object->getMarginTop()); + self::assertInstanceOf(Alignment::class, $object->setMarginTop()); + self::assertEquals(0, $object->getMarginTop()); } public function testRTL(): void { $object = new Alignment(); - $this->assertFalse($object->isRTL()); - $this->assertInstanceOf(Alignment::class, $object->setIsRTL(true)); - $this->assertTrue($object->isRTL()); - $this->assertInstanceOf(Alignment::class, $object->setIsRTL(false)); - $this->assertFalse($object->isRTL()); - $this->assertInstanceOf(Alignment::class, $object->setIsRTL()); - $this->assertFalse($object->isRTL()); + self::assertFalse($object->isRTL()); + self::assertInstanceOf(Alignment::class, $object->setIsRTL(true)); + self::assertTrue($object->isRTL()); + self::assertInstanceOf(Alignment::class, $object->setIsRTL(false)); + self::assertFalse($object->isRTL()); + self::assertInstanceOf(Alignment::class, $object->setIsRTL()); + self::assertFalse($object->isRTL()); } /** @@ -224,10 +223,10 @@ public function testRTL(): void */ public function testSetGetHashIndex(): void { - $value = rand(1, 100); + $value = mt_rand(1, 100); $object = new Alignment(); $object->setHashIndex($value); - $this->assertEquals($value, $object->getHashIndex()); + self::assertEquals($value, $object->getHashIndex()); } } diff --git a/tests/PhpPresentation/Tests/Style/BorderTest.php b/tests/PhpPresentation/Tests/Style/BorderTest.php index 6084fa10c..80b4d3498 100644 --- a/tests/PhpPresentation/Tests/Style/BorderTest.php +++ b/tests/PhpPresentation/Tests/Style/BorderTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -37,11 +36,11 @@ class BorderTest extends TestCase public function testConstruct(): void { $object = new Border(); - $this->assertEquals(1, $object->getLineWidth()); - $this->assertEquals(Border::LINE_SINGLE, $object->getLineStyle()); - $this->assertEquals(Border::DASH_SOLID, $object->getDashStyle()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Color', $object->getColor()); - $this->assertEquals('FF000000', $object->getColor()->getARGB()); + self::assertEquals(1, $object->getLineWidth()); + self::assertEquals(Border::LINE_SINGLE, $object->getLineStyle()); + self::assertEquals(Border::DASH_SOLID, $object->getDashStyle()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Color', $object->getColor()); + self::assertEquals('FF000000', $object->getColor()->getARGB()); } /** @@ -50,11 +49,11 @@ public function testConstruct(): void public function testSetGetColor(): void { $object = new Border(); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Border', $object->setColor()); - $this->assertNull($object->getColor()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Border', $object->setColor(new Color(COLOR::COLOR_BLUE))); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Color', $object->getColor()); - $this->assertEquals('FF0000FF', $object->getColor()->getARGB()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Border', $object->setColor()); + self::assertNull($object->getColor()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Border', $object->setColor(new Color(COLOR::COLOR_BLUE))); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Color', $object->getColor()); + self::assertEquals('FF0000FF', $object->getColor()->getARGB()); } /** @@ -63,12 +62,12 @@ public function testSetGetColor(): void public function testSetGetDashStyle(): void { $object = new Border(); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Border', $object->setDashStyle()); - $this->assertEquals(Border::DASH_SOLID, $object->getDashStyle()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Border', $object->setDashStyle('')); - $this->assertEquals(Border::DASH_SOLID, $object->getDashStyle()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Border', $object->setDashStyle(BORDER::DASH_DASH)); - $this->assertEquals(Border::DASH_DASH, $object->getDashStyle()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Border', $object->setDashStyle()); + self::assertEquals(Border::DASH_SOLID, $object->getDashStyle()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Border', $object->setDashStyle('')); + self::assertEquals(Border::DASH_SOLID, $object->getDashStyle()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Border', $object->setDashStyle(BORDER::DASH_DASH)); + self::assertEquals(Border::DASH_DASH, $object->getDashStyle()); } /** @@ -79,7 +78,7 @@ public function testSetGetHashIndex(): void $object = new Border(); $value = mt_rand(1, 100); $object->setHashIndex($value); - $this->assertEquals($value, $object->getHashIndex()); + self::assertEquals($value, $object->getHashIndex()); } /** @@ -88,12 +87,12 @@ public function testSetGetHashIndex(): void public function testSetGetLineStyle(): void { $object = new Border(); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Border', $object->setLineStyle()); - $this->assertEquals(Border::LINE_SINGLE, $object->getLineStyle()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Border', $object->setLineStyle('')); - $this->assertEquals(Border::LINE_SINGLE, $object->getLineStyle()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Border', $object->setLineStyle(BORDER::LINE_DOUBLE)); - $this->assertEquals(Border::LINE_DOUBLE, $object->getLineStyle()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Border', $object->setLineStyle()); + self::assertEquals(Border::LINE_SINGLE, $object->getLineStyle()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Border', $object->setLineStyle('')); + self::assertEquals(Border::LINE_SINGLE, $object->getLineStyle()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Border', $object->setLineStyle(BORDER::LINE_DOUBLE)); + self::assertEquals(Border::LINE_DOUBLE, $object->getLineStyle()); } /** @@ -102,10 +101,10 @@ public function testSetGetLineStyle(): void public function testSetGetLineWidth(): void { $object = new Border(); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Border', $object->setLineWidth()); - $this->assertEquals(1, $object->getLineWidth()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Border', $object->setLineWidth()); + self::assertEquals(1, $object->getLineWidth()); $value = mt_rand(1, 100); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Border', $object->setLineWidth($value)); - $this->assertEquals($value, $object->getLineWidth()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Border', $object->setLineWidth($value)); + self::assertEquals($value, $object->getLineWidth()); } } diff --git a/tests/PhpPresentation/Tests/Style/BordersTest.php b/tests/PhpPresentation/Tests/Style/BordersTest.php index 72e9ce8bf..20fcb2855 100644 --- a/tests/PhpPresentation/Tests/Style/BordersTest.php +++ b/tests/PhpPresentation/Tests/Style/BordersTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -37,14 +36,14 @@ class BordersTest extends TestCase public function testConstruct(): void { $object = new Borders(); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Border', $object->getBottom()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Border', $object->getLeft()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Border', $object->getRight()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Border', $object->getTop()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Border', $object->getDiagonalDown()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Border', $object->getDiagonalUp()); - $this->assertEquals(Border::LINE_NONE, $object->getDiagonalDown()->getLineStyle()); - $this->assertEquals(Border::LINE_NONE, $object->getDiagonalUp()->getLineStyle()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Border', $object->getBottom()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Border', $object->getLeft()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Border', $object->getRight()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Border', $object->getTop()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Border', $object->getDiagonalDown()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Border', $object->getDiagonalUp()); + self::assertEquals(Border::LINE_NONE, $object->getDiagonalDown()->getLineStyle()); + self::assertEquals(Border::LINE_NONE, $object->getDiagonalUp()->getLineStyle()); } /** @@ -55,7 +54,7 @@ public function testSetGetHashIndex(): void $object = new Borders(); $value = mt_rand(1, 100); $object->setHashIndex($value); - $this->assertEquals($value, $object->getHashIndex()); + self::assertEquals($value, $object->getHashIndex()); } /** @@ -64,7 +63,7 @@ public function testSetGetHashIndex(): void public function testGetHashCode(): void { $object = new Borders(); - $this->assertEquals( + self::assertEquals( md5( $object->getLeft()->getHashCode() . $object->getRight()->getHashCode() . diff --git a/tests/PhpPresentation/Tests/Style/BulletTest.php b/tests/PhpPresentation/Tests/Style/BulletTest.php index 8d8b96563..e88424987 100644 --- a/tests/PhpPresentation/Tests/Style/BulletTest.php +++ b/tests/PhpPresentation/Tests/Style/BulletTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -37,11 +36,11 @@ class BulletTest extends TestCase public function testConstruct(): void { $object = new Bullet(); - $this->assertEquals(Bullet::TYPE_NONE, $object->getBulletType()); - $this->assertEquals('Calibri', $object->getBulletFont()); - $this->assertEquals('-', $object->getBulletChar()); - $this->assertEquals(Bullet::NUMERIC_DEFAULT, $object->getBulletNumericStyle()); - $this->assertEquals(1, $object->getBulletNumericStartAt()); + self::assertEquals(Bullet::TYPE_NONE, $object->getBulletType()); + self::assertEquals('Calibri', $object->getBulletFont()); + self::assertEquals('-', $object->getBulletChar()); + self::assertEquals(Bullet::NUMERIC_DEFAULT, $object->getBulletNumericStyle()); + self::assertEquals(1, $object->getBulletNumericStartAt()); } /** @@ -50,10 +49,10 @@ public function testConstruct(): void public function testSetGetBulletChar(): void { $object = new Bullet(); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Bullet', $object->setBulletChar()); - $this->assertEquals('-', $object->getBulletChar()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Bullet', $object->setBulletChar('a')); - $this->assertEquals('a', $object->getBulletChar()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Bullet', $object->setBulletChar()); + self::assertEquals('-', $object->getBulletChar()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Bullet', $object->setBulletChar('a')); + self::assertEquals('a', $object->getBulletChar()); } /** @@ -66,12 +65,12 @@ public function testSetGetBulletColor(): void $expectedARGB = '01234567'; // default - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Color', $object->getBulletColor()); - $this->assertEquals(Color::COLOR_BLACK, $object->getBulletColor()->getARGB()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Color', $object->getBulletColor()); + self::assertEquals(Color::COLOR_BLACK, $object->getBulletColor()->getARGB()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Bullet', $object->setBulletColor(new Color($expectedARGB))); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Color', $object->getBulletColor()); - $this->assertEquals($expectedARGB, $object->getBulletColor()->getARGB()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Bullet', $object->setBulletColor(new Color($expectedARGB))); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Color', $object->getBulletColor()); + self::assertEquals($expectedARGB, $object->getBulletColor()->getARGB()); } /** @@ -80,12 +79,12 @@ public function testSetGetBulletColor(): void public function testSetGetBulletFont(): void { $object = new Bullet(); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Bullet', $object->setBulletFont()); - $this->assertEquals('Calibri', $object->getBulletFont()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Bullet', $object->setBulletFont('')); - $this->assertEquals('Calibri', $object->getBulletFont()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Bullet', $object->setBulletFont('Arial')); - $this->assertEquals('Arial', $object->getBulletFont()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Bullet', $object->setBulletFont()); + self::assertEquals('Calibri', $object->getBulletFont()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Bullet', $object->setBulletFont('')); + self::assertEquals('Calibri', $object->getBulletFont()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Bullet', $object->setBulletFont('Arial')); + self::assertEquals('Arial', $object->getBulletFont()); } /** @@ -94,11 +93,11 @@ public function testSetGetBulletFont(): void public function testSetGetBulletNumericStartAt(): void { $object = new Bullet(); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Bullet', $object->setBulletNumericStartAt()); - $this->assertEquals(1, $object->getBulletNumericStartAt()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Bullet', $object->setBulletNumericStartAt()); + self::assertEquals(1, $object->getBulletNumericStartAt()); $value = mt_rand(1, 100); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Bullet', $object->setBulletNumericStartAt($value)); - $this->assertEquals($value, $object->getBulletNumericStartAt()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Bullet', $object->setBulletNumericStartAt($value)); + self::assertEquals($value, $object->getBulletNumericStartAt()); } /** @@ -107,10 +106,10 @@ public function testSetGetBulletNumericStartAt(): void public function testSetGetBulletNumericStyle(): void { $object = new Bullet(); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Bullet', $object->setBulletNumericStyle()); - $this->assertEquals(Bullet::NUMERIC_DEFAULT, $object->getBulletNumericStyle()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Bullet', $object->setBulletNumericStyle(Bullet::NUMERIC_ALPHALCPARENBOTH)); - $this->assertEquals(Bullet::NUMERIC_ALPHALCPARENBOTH, $object->getBulletNumericStyle()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Bullet', $object->setBulletNumericStyle()); + self::assertEquals(Bullet::NUMERIC_DEFAULT, $object->getBulletNumericStyle()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Bullet', $object->setBulletNumericStyle(Bullet::NUMERIC_ALPHALCPARENBOTH)); + self::assertEquals(Bullet::NUMERIC_ALPHALCPARENBOTH, $object->getBulletNumericStyle()); } /** @@ -119,10 +118,10 @@ public function testSetGetBulletNumericStyle(): void public function testSetGetBulletType(): void { $object = new Bullet(); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Bullet', $object->setBulletType()); - $this->assertEquals(Bullet::TYPE_NONE, $object->getBulletType()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Bullet', $object->setBulletType(Bullet::TYPE_BULLET)); - $this->assertEquals(Bullet::TYPE_BULLET, $object->getBulletType()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Bullet', $object->setBulletType()); + self::assertEquals(Bullet::TYPE_NONE, $object->getBulletType()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Bullet', $object->setBulletType(Bullet::TYPE_BULLET)); + self::assertEquals(Bullet::TYPE_BULLET, $object->getBulletType()); } /** @@ -133,6 +132,6 @@ public function testSetGetHashIndex(): void $object = new Bullet(); $value = mt_rand(1, 100); $object->setHashIndex($value); - $this->assertEquals($value, $object->getHashIndex()); + self::assertEquals($value, $object->getHashIndex()); } } diff --git a/tests/PhpPresentation/Tests/Style/ColorMapTest.php b/tests/PhpPresentation/Tests/Style/ColorMapTest.php index 126c80ac1..8f2ed7580 100644 --- a/tests/PhpPresentation/Tests/Style/ColorMapTest.php +++ b/tests/PhpPresentation/Tests/Style/ColorMapTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -28,28 +27,28 @@ class ColorMapTest extends TestCase public function testConstruct(): void { $object = new ColorMap(); - $this->assertIsArray($object->getMapping()); - $this->assertEquals(ColorMap::$mappingDefault, $object->getMapping()); + self::assertIsArray($object->getMapping()); + self::assertEquals(ColorMap::$mappingDefault, $object->getMapping()); } public function testMapping(): void { $object = new ColorMap(); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\ColorMap', $object->setMapping([])); - $this->assertIsArray($object->getMapping()); - $this->assertCount(0, $object->getMapping()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\ColorMap', $object->setMapping([])); + self::assertIsArray($object->getMapping()); + self::assertCount(0, $object->getMapping()); $array = ColorMap::$mappingDefault; - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\ColorMap', $object->setMapping($array)); - $this->assertIsArray($object->getMapping()); - $this->assertEquals(ColorMap::$mappingDefault, $object->getMapping()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\ColorMap', $object->setMapping($array)); + self::assertIsArray($object->getMapping()); + self::assertEquals(ColorMap::$mappingDefault, $object->getMapping()); } public function testModifier(): void { $object = new ColorMap(); $key = array_rand(ColorMap::$mappingDefault); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\ColorMap', $object->changeColor($key, 'AlphaBeta')); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\ColorMap', $object->changeColor($key, 'AlphaBeta')); $array = $object->getMapping(); - $this->assertEquals('AlphaBeta', $array[$key]); + self::assertEquals('AlphaBeta', $array[$key]); } } diff --git a/tests/PhpPresentation/Tests/Style/ColorTest.php b/tests/PhpPresentation/Tests/Style/ColorTest.php index afdfcd26a..97485b57d 100644 --- a/tests/PhpPresentation/Tests/Style/ColorTest.php +++ b/tests/PhpPresentation/Tests/Style/ColorTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -36,9 +35,9 @@ class ColorTest extends TestCase public function testConstruct(): void { $object = new Color(); - $this->assertEquals(Color::COLOR_BLACK, $object->getARGB()); + self::assertEquals(Color::COLOR_BLACK, $object->getARGB()); $object = new Color(COLOR::COLOR_BLUE); - $this->assertEquals(Color::COLOR_BLUE, $object->getARGB()); + self::assertEquals(Color::COLOR_BLUE, $object->getARGB()); } /** @@ -48,14 +47,14 @@ public function testAlpha(): void { $randAlpha = mt_rand(0, 100); $object = new Color(); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Color', $object->setARGB()); - $this->assertEquals(100, $object->getAlpha()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Color', $object->setARGB('AA0000FF')); - $this->assertEquals(67, $object->getAlpha()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Color', $object->setARGB(Color::COLOR_BLUE)); - $this->assertEquals(100, $object->getAlpha()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Color', $object->setAlpha($randAlpha)); - $this->assertEquals($randAlpha, round($object->getAlpha())); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Color', $object->setARGB()); + self::assertEquals(100, $object->getAlpha()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Color', $object->setARGB('AA0000FF')); + self::assertEquals(67, $object->getAlpha()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Color', $object->setARGB(Color::COLOR_BLUE)); + self::assertEquals(100, $object->getAlpha()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Color', $object->setAlpha($randAlpha)); + self::assertEquals($randAlpha, round($object->getAlpha())); } /** @@ -64,12 +63,12 @@ public function testAlpha(): void public function testSetGetARGB(): void { $object = new Color(); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Color', $object->setARGB()); - $this->assertEquals(Color::COLOR_BLACK, $object->getARGB()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Color', $object->setARGB('')); - $this->assertEquals(Color::COLOR_BLACK, $object->getARGB()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Color', $object->setARGB(Color::COLOR_BLUE)); - $this->assertEquals(Color::COLOR_BLUE, $object->getARGB()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Color', $object->setARGB()); + self::assertEquals(Color::COLOR_BLACK, $object->getARGB()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Color', $object->setARGB('')); + self::assertEquals(Color::COLOR_BLACK, $object->getARGB()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Color', $object->setARGB(Color::COLOR_BLUE)); + self::assertEquals(Color::COLOR_BLUE, $object->getARGB()); } /** @@ -78,18 +77,18 @@ public function testSetGetARGB(): void public function testSetGetRGB(): void { $object = new Color(); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Color', $object->setRGB()); - $this->assertEquals('000000', $object->getRGB()); - $this->assertEquals('FF000000', $object->getARGB()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Color', $object->setRGB('')); - $this->assertEquals('000000', $object->getRGB()); - $this->assertEquals('FF000000', $object->getARGB()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Color', $object->setRGB('555')); - $this->assertEquals('555', $object->getRGB()); - $this->assertEquals('FF555', $object->getARGB()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Color', $object->setRGB('6666')); - $this->assertEquals('FF6666', $object->getRGB()); - $this->assertEquals('FF6666', $object->getARGB()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Color', $object->setRGB()); + self::assertEquals('000000', $object->getRGB()); + self::assertEquals('FF000000', $object->getARGB()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Color', $object->setRGB('')); + self::assertEquals('000000', $object->getRGB()); + self::assertEquals('FF000000', $object->getARGB()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Color', $object->setRGB('555')); + self::assertEquals('555', $object->getRGB()); + self::assertEquals('FF555', $object->getARGB()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Color', $object->setRGB('6666')); + self::assertEquals('FF6666', $object->getRGB()); + self::assertEquals('FF6666', $object->getARGB()); } /** @@ -100,6 +99,6 @@ public function testSetGetHashIndex(): void $object = new Color(); $value = mt_rand(1, 100); $object->setHashIndex($value); - $this->assertEquals($value, $object->getHashIndex()); + self::assertEquals($value, $object->getHashIndex()); } } diff --git a/tests/PhpPresentation/Tests/Style/FillTest.php b/tests/PhpPresentation/Tests/Style/FillTest.php index 2ac5eb183..3430b430e 100644 --- a/tests/PhpPresentation/Tests/Style/FillTest.php +++ b/tests/PhpPresentation/Tests/Style/FillTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -37,12 +36,12 @@ class FillTest extends TestCase public function testConstruct(): void { $object = new Fill(); - $this->assertEquals(Fill::FILL_NONE, $object->getFillType()); - $this->assertEquals(0, $object->getRotation()); - $this->assertInstanceOf(Color::class, $object->getStartColor()); - $this->assertEquals(Color::COLOR_WHITE, $object->getEndColor()->getARGB()); - $this->assertInstanceOf(Color::class, $object->getEndColor()); - $this->assertEquals(Color::COLOR_BLACK, $object->getStartColor()->getARGB()); + self::assertEquals(Fill::FILL_NONE, $object->getFillType()); + self::assertEquals(0, $object->getRotation()); + self::assertInstanceOf(Color::class, $object->getStartColor()); + self::assertEquals(Color::COLOR_WHITE, $object->getEndColor()->getARGB()); + self::assertInstanceOf(Color::class, $object->getEndColor()); + self::assertEquals(Color::COLOR_BLACK, $object->getStartColor()->getARGB()); } /** @@ -51,9 +50,9 @@ public function testConstruct(): void public function testSetGetEndColor(): void { $object = new Fill(); - $this->assertInstanceOf(Fill::class, $object->setEndColor(new Color(COLOR::COLOR_BLUE))); - $this->assertInstanceOf(Color::class, $object->getEndColor()); - $this->assertEquals(COLOR::COLOR_BLUE, $object->getEndColor()->getARGB()); + self::assertInstanceOf(Fill::class, $object->setEndColor(new Color(COLOR::COLOR_BLUE))); + self::assertInstanceOf(Color::class, $object->getEndColor()); + self::assertEquals(COLOR::COLOR_BLUE, $object->getEndColor()->getARGB()); } /** @@ -62,10 +61,10 @@ public function testSetGetEndColor(): void public function testSetGetFillType(): void { $object = new Fill(); - $this->assertInstanceOf(Fill::class, $object->setFillType()); - $this->assertEquals(Fill::FILL_NONE, $object->getFillType()); - $this->assertInstanceOf(Fill::class, $object->setFillType(Fill::FILL_GRADIENT_LINEAR)); - $this->assertEquals(Fill::FILL_GRADIENT_LINEAR, $object->getFillType()); + self::assertInstanceOf(Fill::class, $object->setFillType()); + self::assertEquals(Fill::FILL_NONE, $object->getFillType()); + self::assertInstanceOf(Fill::class, $object->setFillType(Fill::FILL_GRADIENT_LINEAR)); + self::assertEquals(Fill::FILL_GRADIENT_LINEAR, $object->getFillType()); } /** @@ -74,11 +73,11 @@ public function testSetGetFillType(): void public function testSetGetRotation(): void { $object = new Fill(); - $this->assertInstanceOf(Fill::class, $object->setRotation()); - $this->assertEquals(0, $object->getRotation()); + self::assertInstanceOf(Fill::class, $object->setRotation()); + self::assertEquals(0, $object->getRotation()); $value = mt_rand(1, 100); - $this->assertInstanceOf(Fill::class, $object->setRotation($value)); - $this->assertEquals($value, $object->getRotation()); + self::assertInstanceOf(Fill::class, $object->setRotation($value)); + self::assertEquals($value, $object->getRotation()); } /** @@ -87,9 +86,9 @@ public function testSetGetRotation(): void public function testSetGetStartColor(): void { $object = new Fill(); - $this->assertInstanceOf(Fill::class, $object->setStartColor(new Color(COLOR::COLOR_BLUE))); - $this->assertInstanceOf(Color::class, $object->getStartColor()); - $this->assertEquals(COLOR::COLOR_BLUE, $object->getStartColor()->getARGB()); + self::assertInstanceOf(Fill::class, $object->setStartColor(new Color(COLOR::COLOR_BLUE))); + self::assertInstanceOf(Color::class, $object->getStartColor()); + self::assertEquals(COLOR::COLOR_BLUE, $object->getStartColor()->getARGB()); } /** @@ -100,6 +99,6 @@ public function testSetGetHashIndex(): void $object = new Fill(); $value = mt_rand(1, 100); $object->setHashIndex($value); - $this->assertEquals($value, $object->getHashIndex()); + self::assertEquals($value, $object->getHashIndex()); } } diff --git a/tests/PhpPresentation/Tests/Style/FontTest.php b/tests/PhpPresentation/Tests/Style/FontTest.php index 47deb3f0b..1237238a3 100644 --- a/tests/PhpPresentation/Tests/Style/FontTest.php +++ b/tests/PhpPresentation/Tests/Style/FontTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -37,17 +36,17 @@ class FontTest extends TestCase public function testConstruct(): void { $object = new Font(); - $this->assertEquals('Calibri', $object->getName()); - $this->assertEquals(10, $object->getSize()); - $this->assertFalse($object->isBold()); - $this->assertFalse($object->isItalic()); - $this->assertFalse($object->isSuperScript()); - $this->assertFalse($object->isSubScript()); - $this->assertFalse($object->isStrikethrough()); - $this->assertEquals(Font::UNDERLINE_NONE, $object->getUnderline()); - $this->assertEquals(0, $object->getCharacterSpacing()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Color', $object->getColor()); - $this->assertEquals(Color::COLOR_BLACK, $object->getColor()->getARGB()); + self::assertEquals('Calibri', $object->getName()); + self::assertEquals(10, $object->getSize()); + self::assertFalse($object->isBold()); + self::assertFalse($object->isItalic()); + self::assertFalse($object->isSuperScript()); + self::assertFalse($object->isSubScript()); + self::assertFalse($object->isStrikethrough()); + self::assertEquals(Font::UNDERLINE_NONE, $object->getUnderline()); + self::assertEquals(0, $object->getCharacterSpacing()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Color', $object->getColor()); + self::assertEquals(Color::COLOR_BLACK, $object->getColor()->getARGB()); } /** @@ -56,13 +55,13 @@ public function testConstruct(): void public function testCharacterSpacing(): void { $object = new Font(); - $this->assertEquals(0, $object->getCharacterSpacing()); - $this->assertInstanceOf(Font::class, $object->setCharacterSpacing(0)); - $this->assertEquals(0, $object->getCharacterSpacing()); - $this->assertInstanceOf(Font::class, $object->setCharacterSpacing(10)); - $this->assertEquals(1000, $object->getCharacterSpacing()); - $this->assertInstanceOf(Font::class, $object->setCharacterSpacing()); - $this->assertEquals(0, $object->getCharacterSpacing()); + self::assertEquals(0, $object->getCharacterSpacing()); + self::assertInstanceOf(Font::class, $object->setCharacterSpacing(0)); + self::assertEquals(0, $object->getCharacterSpacing()); + self::assertInstanceOf(Font::class, $object->setCharacterSpacing(10)); + self::assertEquals(1000, $object->getCharacterSpacing()); + self::assertInstanceOf(Font::class, $object->setCharacterSpacing()); + self::assertEquals(0, $object->getCharacterSpacing()); } /** @@ -71,10 +70,10 @@ public function testCharacterSpacing(): void public function testColor(): void { $object = new Font(); - $this->assertEquals(Color::COLOR_BLACK, $object->getColor()->getARGB()); - $this->assertInstanceOf(Font::class, $object->setColor(new Color(Color::COLOR_BLUE))); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Color', $object->getColor()); - $this->assertEquals(Color::COLOR_BLUE, $object->getColor()->getARGB()); + self::assertEquals(Color::COLOR_BLACK, $object->getColor()->getARGB()); + self::assertInstanceOf(Font::class, $object->setColor(new Color(Color::COLOR_BLUE))); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Color', $object->getColor()); + self::assertEquals(Color::COLOR_BLUE, $object->getColor()->getARGB()); } /** @@ -83,15 +82,15 @@ public function testColor(): void public function testFormat(): void { $object = new Font(); - $this->assertEquals(Font::FORMAT_LATIN, $object->getFormat()); - $this->assertInstanceOf(Font::class, $object->setFormat()); - $this->assertEquals(Font::FORMAT_LATIN, $object->getFormat()); - $this->assertInstanceOf(Font::class, $object->setFormat('UnAuthorized')); - $this->assertEquals(Font::FORMAT_LATIN, $object->getFormat()); - $this->assertInstanceOf(Font::class, $object->setFormat(Font::FORMAT_EAST_ASIAN)); - $this->assertEquals(Font::FORMAT_EAST_ASIAN, $object->getFormat()); - $this->assertInstanceOf(Font::class, $object->setFormat(Font::FORMAT_COMPLEX_SCRIPT)); - $this->assertEquals(Font::FORMAT_COMPLEX_SCRIPT, $object->getFormat()); + self::assertEquals(Font::FORMAT_LATIN, $object->getFormat()); + self::assertInstanceOf(Font::class, $object->setFormat()); + self::assertEquals(Font::FORMAT_LATIN, $object->getFormat()); + self::assertInstanceOf(Font::class, $object->setFormat('UnAuthorized')); + self::assertEquals(Font::FORMAT_LATIN, $object->getFormat()); + self::assertInstanceOf(Font::class, $object->setFormat(Font::FORMAT_EAST_ASIAN)); + self::assertEquals(Font::FORMAT_EAST_ASIAN, $object->getFormat()); + self::assertInstanceOf(Font::class, $object->setFormat(Font::FORMAT_COMPLEX_SCRIPT)); + self::assertEquals(Font::FORMAT_COMPLEX_SCRIPT, $object->getFormat()); } /** @@ -100,12 +99,12 @@ public function testFormat(): void public function testName(): void { $object = new Font(); - $this->assertInstanceOf(Font::class, $object->setName()); - $this->assertEquals('Calibri', $object->getName()); - $this->assertInstanceOf(Font::class, $object->setName('')); - $this->assertEquals('Calibri', $object->getName()); - $this->assertInstanceOf(Font::class, $object->setName('Arial')); - $this->assertEquals('Arial', $object->getName()); + self::assertInstanceOf(Font::class, $object->setName()); + self::assertEquals('Calibri', $object->getName()); + self::assertInstanceOf(Font::class, $object->setName('')); + self::assertEquals('Calibri', $object->getName()); + self::assertInstanceOf(Font::class, $object->setName('Arial')); + self::assertEquals('Arial', $object->getName()); } /** @@ -114,11 +113,11 @@ public function testName(): void public function testSize(): void { $object = new Font(); - $this->assertInstanceOf(Font::class, $object->setSize()); - $this->assertEquals(10, $object->getSize()); + self::assertInstanceOf(Font::class, $object->setSize()); + self::assertEquals(10, $object->getSize()); $value = mt_rand(1, 100); - $this->assertInstanceOf(Font::class, $object->setSize($value)); - $this->assertEquals($value, $object->getSize()); + self::assertInstanceOf(Font::class, $object->setSize($value)); + self::assertEquals($value, $object->getSize()); } /** @@ -127,12 +126,12 @@ public function testSize(): void public function testUnderline(): void { $object = new Font(); - $this->assertInstanceOf(Font::class, $object->setUnderline()); - $this->assertEquals(FONT::UNDERLINE_NONE, $object->getUnderline()); - $this->assertInstanceOf(Font::class, $object->setUnderline('')); - $this->assertEquals(FONT::UNDERLINE_NONE, $object->getUnderline()); - $this->assertInstanceOf(Font::class, $object->setUnderline(FONT::UNDERLINE_DASH)); - $this->assertEquals(FONT::UNDERLINE_DASH, $object->getUnderline()); + self::assertInstanceOf(Font::class, $object->setUnderline()); + self::assertEquals(FONT::UNDERLINE_NONE, $object->getUnderline()); + self::assertInstanceOf(Font::class, $object->setUnderline('')); + self::assertEquals(FONT::UNDERLINE_NONE, $object->getUnderline()); + self::assertInstanceOf(Font::class, $object->setUnderline(FONT::UNDERLINE_DASH)); + self::assertEquals(FONT::UNDERLINE_DASH, $object->getUnderline()); } /** @@ -141,12 +140,12 @@ public function testUnderline(): void public function testSetIsBold(): void { $object = new Font(); - $this->assertInstanceOf(Font::class, $object->setBold()); - $this->assertFalse($object->isBold()); - $this->assertInstanceOf(Font::class, $object->setBold(false)); - $this->assertFalse($object->isBold()); - $this->assertInstanceOf(Font::class, $object->setBold(true)); - $this->assertTrue($object->isBold()); + self::assertInstanceOf(Font::class, $object->setBold()); + self::assertFalse($object->isBold()); + self::assertInstanceOf(Font::class, $object->setBold(false)); + self::assertFalse($object->isBold()); + self::assertInstanceOf(Font::class, $object->setBold(true)); + self::assertTrue($object->isBold()); } /** @@ -155,12 +154,12 @@ public function testSetIsBold(): void public function testSetIsItalic(): void { $object = new Font(); - $this->assertInstanceOf(Font::class, $object->setItalic()); - $this->assertFalse($object->isItalic()); - $this->assertInstanceOf(Font::class, $object->setItalic(false)); - $this->assertFalse($object->isItalic()); - $this->assertInstanceOf(Font::class, $object->setItalic(true)); - $this->assertTrue($object->isItalic()); + self::assertInstanceOf(Font::class, $object->setItalic()); + self::assertFalse($object->isItalic()); + self::assertInstanceOf(Font::class, $object->setItalic(false)); + self::assertFalse($object->isItalic()); + self::assertInstanceOf(Font::class, $object->setItalic(true)); + self::assertTrue($object->isItalic()); } /** @@ -169,12 +168,12 @@ public function testSetIsItalic(): void public function testSetIsStriketrough(): void { $object = new Font(); - $this->assertInstanceOf(Font::class, $object->setStrikethrough()); - $this->assertFalse($object->isStrikethrough()); - $this->assertInstanceOf(Font::class, $object->setStrikethrough(false)); - $this->assertFalse($object->isStrikethrough()); - $this->assertInstanceOf(Font::class, $object->setStrikethrough(true)); - $this->assertTrue($object->isStrikethrough()); + self::assertInstanceOf(Font::class, $object->setStrikethrough()); + self::assertFalse($object->isStrikethrough()); + self::assertInstanceOf(Font::class, $object->setStrikethrough(false)); + self::assertFalse($object->isStrikethrough()); + self::assertInstanceOf(Font::class, $object->setStrikethrough(true)); + self::assertTrue($object->isStrikethrough()); } /** @@ -183,25 +182,25 @@ public function testSetIsStriketrough(): void public function testSetIsSubScript(): void { $object = new Font(); - $this->assertInstanceOf(Font::class, $object->setSubScript()); - $this->assertFalse($object->isSubScript()); - $this->assertInstanceOf(Font::class, $object->setSubScript(false)); - $this->assertFalse($object->isSubScript()); - $this->assertInstanceOf(Font::class, $object->setSubScript(true)); - $this->assertTrue($object->isSubScript()); + self::assertInstanceOf(Font::class, $object->setSubScript()); + self::assertFalse($object->isSubScript()); + self::assertInstanceOf(Font::class, $object->setSubScript(false)); + self::assertFalse($object->isSubScript()); + self::assertInstanceOf(Font::class, $object->setSubScript(true)); + self::assertTrue($object->isSubScript()); // Test toggle of SubScript - $this->assertInstanceOf(Font::class, $object->setSubScript(false)); - $this->assertInstanceOf(Font::class, $object->setSuperScript(false)); - $this->assertFalse($object->isSubScript()); + self::assertInstanceOf(Font::class, $object->setSubScript(false)); + self::assertInstanceOf(Font::class, $object->setSuperScript(false)); + self::assertFalse($object->isSubScript()); - $this->assertInstanceOf(Font::class, $object->setSubScript(true)); - $this->assertInstanceOf(Font::class, $object->setSuperScript(true)); - $this->assertFalse($object->isSubScript()); + self::assertInstanceOf(Font::class, $object->setSubScript(true)); + self::assertInstanceOf(Font::class, $object->setSuperScript(true)); + self::assertFalse($object->isSubScript()); - $this->assertInstanceOf(Font::class, $object->setSubScript(true)); - $this->assertInstanceOf(Font::class, $object->setSuperScript(false)); - $this->assertTrue($object->isSubScript()); + self::assertInstanceOf(Font::class, $object->setSubScript(true)); + self::assertInstanceOf(Font::class, $object->setSuperScript(false)); + self::assertTrue($object->isSubScript()); } /** @@ -210,25 +209,25 @@ public function testSetIsSubScript(): void public function testSetIsSuperScript(): void { $object = new Font(); - $this->assertInstanceOf(Font::class, $object->setSuperScript()); - $this->assertFalse($object->isSuperScript()); - $this->assertInstanceOf(Font::class, $object->setSuperScript(false)); - $this->assertFalse($object->isSuperScript()); - $this->assertInstanceOf(Font::class, $object->setSuperScript(true)); - $this->assertTrue($object->isSuperScript()); + self::assertInstanceOf(Font::class, $object->setSuperScript()); + self::assertFalse($object->isSuperScript()); + self::assertInstanceOf(Font::class, $object->setSuperScript(false)); + self::assertFalse($object->isSuperScript()); + self::assertInstanceOf(Font::class, $object->setSuperScript(true)); + self::assertTrue($object->isSuperScript()); // Test toggle of SubScript - $this->assertInstanceOf(Font::class, $object->setSuperScript(false)); - $this->assertInstanceOf(Font::class, $object->setSubScript(false)); - $this->assertFalse($object->isSuperScript()); + self::assertInstanceOf(Font::class, $object->setSuperScript(false)); + self::assertInstanceOf(Font::class, $object->setSubScript(false)); + self::assertFalse($object->isSuperScript()); - $this->assertInstanceOf(Font::class, $object->setSuperScript(true)); - $this->assertInstanceOf(Font::class, $object->setSubScript(true)); - $this->assertFalse($object->isSuperScript()); + self::assertInstanceOf(Font::class, $object->setSuperScript(true)); + self::assertInstanceOf(Font::class, $object->setSubScript(true)); + self::assertFalse($object->isSuperScript()); - $this->assertInstanceOf(Font::class, $object->setSuperScript(true)); - $this->assertInstanceOf(Font::class, $object->setSubScript(false)); - $this->assertTrue($object->isSuperScript()); + self::assertInstanceOf(Font::class, $object->setSuperScript(true)); + self::assertInstanceOf(Font::class, $object->setSubScript(false)); + self::assertTrue($object->isSuperScript()); } /** @@ -239,6 +238,6 @@ public function testHashIndex(): void $object = new Font(); $value = mt_rand(1, 100); $object->setHashIndex($value); - $this->assertEquals($value, $object->getHashIndex()); + self::assertEquals($value, $object->getHashIndex()); } } diff --git a/tests/PhpPresentation/Tests/Style/OutlineTest.php b/tests/PhpPresentation/Tests/Style/OutlineTest.php index 30411f12b..340b178ef 100644 --- a/tests/PhpPresentation/Tests/Style/OutlineTest.php +++ b/tests/PhpPresentation/Tests/Style/OutlineTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -37,8 +36,8 @@ class OutlineTest extends TestCase public function testConstruct(): void { $object = new Outline(); - $this->assertEquals(1, $object->getWidth()); - $this->assertInstanceOf(Fill::class, $object->getFill()); + self::assertEquals(1, $object->getWidth()); + self::assertInstanceOf(Fill::class, $object->getFill()); } /** @@ -47,9 +46,9 @@ public function testConstruct(): void public function testSetGetFill(): void { $object = new Outline(); - $this->assertInstanceOf(Fill::class, $object->getFill()); - $this->assertInstanceOf(Outline::class, $object->setFill(new Fill())); - $this->assertInstanceOf(Fill::class, $object->getFill()); + self::assertInstanceOf(Fill::class, $object->getFill()); + self::assertInstanceOf(Outline::class, $object->setFill(new Fill())); + self::assertInstanceOf(Fill::class, $object->getFill()); } /** @@ -58,9 +57,9 @@ public function testSetGetFill(): void public function testSetGetWidth(): void { $object = new Outline(); - $this->assertEquals(1, $object->getWidth()); + self::assertEquals(1, $object->getWidth()); $value = mt_rand(1, 100); - $this->assertInstanceOf(Outline::class, $object->setWidth($value)); - $this->assertEquals($value, $object->getWidth()); + self::assertInstanceOf(Outline::class, $object->setWidth($value)); + self::assertEquals($value, $object->getWidth()); } } diff --git a/tests/PhpPresentation/Tests/Style/ShadowTest.php b/tests/PhpPresentation/Tests/Style/ShadowTest.php index ec2286982..5e834fd34 100644 --- a/tests/PhpPresentation/Tests/Style/ShadowTest.php +++ b/tests/PhpPresentation/Tests/Style/ShadowTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -37,14 +36,14 @@ class ShadowTest extends TestCase public function testConstruct(): void { $object = new Shadow(); - $this->assertFalse($object->isVisible()); - $this->assertEquals(6, $object->getBlurRadius()); - $this->assertEquals(2, $object->getDistance()); - $this->assertEquals(0, $object->getDirection()); - $this->assertEquals(Shadow::SHADOW_BOTTOM_RIGHT, $object->getAlignment()); - $this->assertInstanceOf(Color::class, $object->getColor()); - $this->assertEquals(Color::COLOR_BLACK, $object->getColor()->getARGB()); - $this->assertEquals(50, $object->getAlpha()); + self::assertFalse($object->isVisible()); + self::assertEquals(6, $object->getBlurRadius()); + self::assertEquals(2, $object->getDistance()); + self::assertEquals(0, $object->getDirection()); + self::assertEquals(Shadow::SHADOW_BOTTOM_RIGHT, $object->getAlignment()); + self::assertInstanceOf(Color::class, $object->getColor()); + self::assertEquals(Color::COLOR_BLACK, $object->getColor()->getARGB()); + self::assertEquals(50, $object->getAlpha()); } /** @@ -53,10 +52,10 @@ public function testConstruct(): void public function testSetGetAlignment(): void { $object = new Shadow(); - $this->assertInstanceOf(Shadow::class, $object->setAlignment()); - $this->assertEquals(Shadow::SHADOW_BOTTOM_RIGHT, $object->getAlignment()); - $this->assertInstanceOf(Shadow::class, $object->setAlignment(Shadow::SHADOW_CENTER)); - $this->assertEquals(Shadow::SHADOW_CENTER, $object->getAlignment()); + self::assertInstanceOf(Shadow::class, $object->setAlignment()); + self::assertEquals(Shadow::SHADOW_BOTTOM_RIGHT, $object->getAlignment()); + self::assertInstanceOf(Shadow::class, $object->setAlignment(Shadow::SHADOW_CENTER)); + self::assertEquals(Shadow::SHADOW_CENTER, $object->getAlignment()); } /** @@ -65,11 +64,11 @@ public function testSetGetAlignment(): void public function testSetGetAlpha(): void { $object = new Shadow(); - $this->assertInstanceOf(Shadow::class, $object->setAlpha()); - $this->assertEquals(0, $object->getAlpha()); + self::assertInstanceOf(Shadow::class, $object->setAlpha()); + self::assertEquals(0, $object->getAlpha()); $value = mt_rand(1, 100); - $this->assertInstanceOf(Shadow::class, $object->setAlpha($value)); - $this->assertEquals($value, $object->getAlpha()); + self::assertInstanceOf(Shadow::class, $object->setAlpha($value)); + self::assertEquals($value, $object->getAlpha()); } /** @@ -78,11 +77,11 @@ public function testSetGetAlpha(): void public function testSetGetBlurRadius(): void { $object = new Shadow(); - $this->assertInstanceOf(Shadow::class, $object->setBlurRadius()); - $this->assertEquals(6, $object->getBlurRadius()); + self::assertInstanceOf(Shadow::class, $object->setBlurRadius()); + self::assertEquals(6, $object->getBlurRadius()); $value = mt_rand(1, 100); - $this->assertInstanceOf(Shadow::class, $object->setBlurRadius($value)); - $this->assertEquals($value, $object->getBlurRadius()); + self::assertInstanceOf(Shadow::class, $object->setBlurRadius($value)); + self::assertEquals($value, $object->getBlurRadius()); } /** @@ -91,11 +90,11 @@ public function testSetGetBlurRadius(): void public function testSetGetColor(): void { $object = new Shadow(); - $this->assertInstanceOf(Shadow::class, $object->setColor()); - $this->assertNull($object->getColor()); - $this->assertInstanceOf(Shadow::class, $object->setColor(new Color(Color::COLOR_BLUE))); - $this->assertInstanceOf(Color::class, $object->getColor()); - $this->assertEquals(Color::COLOR_BLUE, $object->getColor()->getARGB()); + self::assertInstanceOf(Shadow::class, $object->setColor()); + self::assertNull($object->getColor()); + self::assertInstanceOf(Shadow::class, $object->setColor(new Color(Color::COLOR_BLUE))); + self::assertInstanceOf(Color::class, $object->getColor()); + self::assertEquals(Color::COLOR_BLUE, $object->getColor()->getARGB()); } /** @@ -104,11 +103,11 @@ public function testSetGetColor(): void public function testSetGetDirection(): void { $object = new Shadow(); - $this->assertInstanceOf(Shadow::class, $object->setDirection()); - $this->assertEquals(0, $object->getDirection()); + self::assertInstanceOf(Shadow::class, $object->setDirection()); + self::assertEquals(0, $object->getDirection()); $value = mt_rand(1, 100); - $this->assertInstanceOf(Shadow::class, $object->setDirection($value)); - $this->assertEquals($value, $object->getDirection()); + self::assertInstanceOf(Shadow::class, $object->setDirection($value)); + self::assertEquals($value, $object->getDirection()); } /** @@ -117,11 +116,11 @@ public function testSetGetDirection(): void public function testSetGetDistance(): void { $object = new Shadow(); - $this->assertInstanceOf(Shadow::class, $object->setDistance()); - $this->assertEquals(2, $object->getDistance()); + self::assertInstanceOf(Shadow::class, $object->setDistance()); + self::assertEquals(2, $object->getDistance()); $value = mt_rand(1, 100); - $this->assertInstanceOf(Shadow::class, $object->setDistance($value)); - $this->assertEquals($value, $object->getDistance()); + self::assertInstanceOf(Shadow::class, $object->setDistance($value)); + self::assertEquals($value, $object->getDistance()); } /** @@ -132,7 +131,7 @@ public function testSetGetHashIndex(): void $object = new Shadow(); $value = mt_rand(1, 100); $object->setHashIndex($value); - $this->assertEquals($value, $object->getHashIndex()); + self::assertEquals($value, $object->getHashIndex()); } /** @@ -141,11 +140,11 @@ public function testSetGetHashIndex(): void public function testSetIsVisible(): void { $object = new Shadow(); - $this->assertInstanceOf(Shadow::class, $object->setVisible()); - $this->assertFalse($object->isVisible()); - $this->assertInstanceOf(Shadow::class, $object->setVisible(false)); - $this->assertFalse($object->isVisible()); - $this->assertInstanceOf(Shadow::class, $object->setVisible(true)); - $this->assertTrue($object->isVisible()); + self::assertInstanceOf(Shadow::class, $object->setVisible()); + self::assertFalse($object->isVisible()); + self::assertInstanceOf(Shadow::class, $object->setVisible(false)); + self::assertFalse($object->isVisible()); + self::assertInstanceOf(Shadow::class, $object->setVisible(true)); + self::assertTrue($object->isVisible()); } } diff --git a/tests/PhpPresentation/Tests/Style/TextStyleTest.php b/tests/PhpPresentation/Tests/Style/TextStyleTest.php index b85da8f1f..a021c09d7 100644 --- a/tests/PhpPresentation/Tests/Style/TextStyleTest.php +++ b/tests/PhpPresentation/Tests/Style/TextStyleTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -34,63 +33,63 @@ public function testConstructDefaultTrue(): void $object = new TextStyle(); $arrayBodyStyle = $object->getBodyStyle(); - $this->assertIsArray($arrayBodyStyle); - $this->assertCount(1, $arrayBodyStyle); - $this->assertArrayHasKey(1, $arrayBodyStyle); - $this->assertNull($object->getBodyStyleAtLvl(0)); - $this->assertInstanceOf('PhpOffice\PhpPresentation\Shape\RichText\Paragraph', $object->getBodyStyleAtLvl(1)); + self::assertIsArray($arrayBodyStyle); + self::assertCount(1, $arrayBodyStyle); + self::assertArrayHasKey(1, $arrayBodyStyle); + self::assertNull($object->getBodyStyleAtLvl(0)); + self::assertInstanceOf('PhpOffice\PhpPresentation\Shape\RichText\Paragraph', $object->getBodyStyleAtLvl(1)); $oParagraph = $object->getBodyStyleAtLvl(1); - $this->assertInstanceOf('PhpOffice\PhpPresentation\Shape\RichText\Paragraph', $oParagraph); - $this->assertEquals(Alignment::HORIZONTAL_CENTER, $oParagraph->getAlignment()->getHorizontal()); - $this->assertEquals((-324900 / 9525), $oParagraph->getAlignment()->getIndent()); - $this->assertEquals(0, $oParagraph->getAlignment()->getMarginLeft()); - $this->assertEquals(32, $oParagraph->getFont()->getSize()); + self::assertInstanceOf('PhpOffice\PhpPresentation\Shape\RichText\Paragraph', $oParagraph); + self::assertEquals(Alignment::HORIZONTAL_CENTER, $oParagraph->getAlignment()->getHorizontal()); + self::assertEquals((-324900 / 9525), $oParagraph->getAlignment()->getIndent()); + self::assertEquals(0, $oParagraph->getAlignment()->getMarginLeft()); + self::assertEquals(32, $oParagraph->getFont()->getSize()); /** @var SchemeColor $color */ $color = $oParagraph->getFont()->getColor(); - $this->assertInstanceOf(SchemeColor::class, $color); - $this->assertEquals('tx1', $color->getValue()); + self::assertInstanceOf(SchemeColor::class, $color); + self::assertEquals('tx1', $color->getValue()); $arrayOtherStyle = $object->getOtherStyle(); - $this->assertIsArray($arrayOtherStyle); - $this->assertCount(1, $arrayOtherStyle); - $this->assertArrayHasKey(0, $arrayOtherStyle); - $this->assertInstanceOf('PhpOffice\PhpPresentation\Shape\RichText\Paragraph', $object->getOtherStyleAtLvl(0)); - $this->assertNull($object->getOtherStyleAtLvl(1)); + self::assertIsArray($arrayOtherStyle); + self::assertCount(1, $arrayOtherStyle); + self::assertArrayHasKey(0, $arrayOtherStyle); + self::assertInstanceOf('PhpOffice\PhpPresentation\Shape\RichText\Paragraph', $object->getOtherStyleAtLvl(0)); + self::assertNull($object->getOtherStyleAtLvl(1)); $oParagraph = $object->getOtherStyleAtLvl(0); - $this->assertInstanceOf('PhpOffice\PhpPresentation\Shape\RichText\Paragraph', $oParagraph); - $this->assertEquals(Alignment::HORIZONTAL_CENTER, $oParagraph->getAlignment()->getHorizontal()); - $this->assertEquals(10, $oParagraph->getFont()->getSize()); + self::assertInstanceOf('PhpOffice\PhpPresentation\Shape\RichText\Paragraph', $oParagraph); + self::assertEquals(Alignment::HORIZONTAL_CENTER, $oParagraph->getAlignment()->getHorizontal()); + self::assertEquals(10, $oParagraph->getFont()->getSize()); /** @var SchemeColor $color */ $color = $oParagraph->getFont()->getColor(); - $this->assertInstanceOf(SchemeColor::class, $color); - $this->assertEquals('tx1', $color->getValue()); + self::assertInstanceOf(SchemeColor::class, $color); + self::assertEquals('tx1', $color->getValue()); $arrayTitleStyle = $object->getTitleStyle(); - $this->assertIsArray($arrayTitleStyle); - $this->assertCount(1, $arrayTitleStyle); - $this->assertArrayHasKey(1, $arrayTitleStyle); - $this->assertNull($object->getTitleStyleAtLvl(0)); - $this->assertInstanceOf('PhpOffice\PhpPresentation\Shape\RichText\Paragraph', $object->getTitleStyleAtLvl(1)); + self::assertIsArray($arrayTitleStyle); + self::assertCount(1, $arrayTitleStyle); + self::assertArrayHasKey(1, $arrayTitleStyle); + self::assertNull($object->getTitleStyleAtLvl(0)); + self::assertInstanceOf('PhpOffice\PhpPresentation\Shape\RichText\Paragraph', $object->getTitleStyleAtLvl(1)); $oParagraph = $object->getTitleStyleAtLvl(1); - $this->assertInstanceOf('PhpOffice\PhpPresentation\Shape\RichText\Paragraph', $oParagraph); - $this->assertEquals(Alignment::HORIZONTAL_CENTER, $oParagraph->getAlignment()->getHorizontal()); - $this->assertEquals(44, $oParagraph->getFont()->getSize()); + self::assertInstanceOf('PhpOffice\PhpPresentation\Shape\RichText\Paragraph', $oParagraph); + self::assertEquals(Alignment::HORIZONTAL_CENTER, $oParagraph->getAlignment()->getHorizontal()); + self::assertEquals(44, $oParagraph->getFont()->getSize()); /** @var SchemeColor $color */ $color = $oParagraph->getFont()->getColor(); - $this->assertInstanceOf(SchemeColor::class, $color); - $this->assertEquals('lt1', $color->getValue()); + self::assertInstanceOf(SchemeColor::class, $color); + self::assertEquals('lt1', $color->getValue()); } public function testConstructDefaultFalse(): void { $object = new TextStyle(false); - $this->assertIsArray($object->getBodyStyle()); - $this->assertCount(0, $object->getBodyStyle()); - $this->assertIsArray($object->getOtherStyle()); - $this->assertCount(0, $object->getOtherStyle()); - $this->assertIsArray($object->getTitleStyle()); - $this->assertCount(0, $object->getTitleStyle()); + self::assertIsArray($object->getBodyStyle()); + self::assertCount(0, $object->getBodyStyle()); + self::assertIsArray($object->getOtherStyle()); + self::assertCount(0, $object->getOtherStyle()); + self::assertIsArray($object->getTitleStyle()); + self::assertCount(0, $object->getTitleStyle()); } public function testLevel(): void @@ -99,34 +98,34 @@ public function testLevel(): void $object = new TextStyle(false); $oParagraph = new Paragraph(); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\TextStyle', $object->setBodyStyleAtLvl($oParagraph, null)); - $this->assertNull($object->getBodyStyleAtLvl(null)); - $this->assertCount(0, $object->getBodyStyle()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\TextStyle', $object->setBodyStyleAtLvl($oParagraph, 10)); - $this->assertNull($object->getBodyStyleAtLvl(10)); - $this->assertCount(0, $object->getBodyStyle()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\TextStyle', $object->setBodyStyleAtLvl($oParagraph, $value)); - $this->assertInstanceOf('PhpOffice\PhpPresentation\Shape\RichText\Paragraph', $object->getBodyStyleAtLvl($value)); - $this->assertCount(1, $object->getBodyStyle()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\TextStyle', $object->setBodyStyleAtLvl($oParagraph, null)); + self::assertNull($object->getBodyStyleAtLvl(null)); + self::assertCount(0, $object->getBodyStyle()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\TextStyle', $object->setBodyStyleAtLvl($oParagraph, 10)); + self::assertNull($object->getBodyStyleAtLvl(10)); + self::assertCount(0, $object->getBodyStyle()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\TextStyle', $object->setBodyStyleAtLvl($oParagraph, $value)); + self::assertInstanceOf('PhpOffice\PhpPresentation\Shape\RichText\Paragraph', $object->getBodyStyleAtLvl($value)); + self::assertCount(1, $object->getBodyStyle()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\TextStyle', $object->setOtherStyleAtLvl($oParagraph, null)); - $this->assertNull($object->getOtherStyleAtLvl(null)); - $this->assertCount(0, $object->getOtherStyle()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\TextStyle', $object->setOtherStyleAtLvl($oParagraph, 10)); - $this->assertNull($object->getOtherStyleAtLvl(10)); - $this->assertCount(0, $object->getOtherStyle()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\TextStyle', $object->setOtherStyleAtLvl($oParagraph, $value)); - $this->assertInstanceOf('PhpOffice\PhpPresentation\Shape\RichText\Paragraph', $object->getOtherStyleAtLvl($value)); - $this->assertCount(1, $object->getOtherStyle()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\TextStyle', $object->setOtherStyleAtLvl($oParagraph, null)); + self::assertNull($object->getOtherStyleAtLvl(null)); + self::assertCount(0, $object->getOtherStyle()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\TextStyle', $object->setOtherStyleAtLvl($oParagraph, 10)); + self::assertNull($object->getOtherStyleAtLvl(10)); + self::assertCount(0, $object->getOtherStyle()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\TextStyle', $object->setOtherStyleAtLvl($oParagraph, $value)); + self::assertInstanceOf('PhpOffice\PhpPresentation\Shape\RichText\Paragraph', $object->getOtherStyleAtLvl($value)); + self::assertCount(1, $object->getOtherStyle()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\TextStyle', $object->setTitleStyleAtLvl($oParagraph, null)); - $this->assertNull($object->getTitleStyleAtLvl(null)); - $this->assertCount(0, $object->getTitleStyle()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\TextStyle', $object->setTitleStyleAtLvl($oParagraph, 10)); - $this->assertNull($object->getTitleStyleAtLvl(10)); - $this->assertCount(0, $object->getTitleStyle()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\TextStyle', $object->setTitleStyleAtLvl($oParagraph, $value)); - $this->assertInstanceOf('PhpOffice\PhpPresentation\Shape\RichText\Paragraph', $object->getTitleStyleAtLvl($value)); - $this->assertCount(1, $object->getTitleStyle()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\TextStyle', $object->setTitleStyleAtLvl($oParagraph, null)); + self::assertNull($object->getTitleStyleAtLvl(null)); + self::assertCount(0, $object->getTitleStyle()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\TextStyle', $object->setTitleStyleAtLvl($oParagraph, 10)); + self::assertNull($object->getTitleStyleAtLvl(10)); + self::assertCount(0, $object->getTitleStyle()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\TextStyle', $object->setTitleStyleAtLvl($oParagraph, $value)); + self::assertInstanceOf('PhpOffice\PhpPresentation\Shape\RichText\Paragraph', $object->getTitleStyleAtLvl($value)); + self::assertCount(1, $object->getTitleStyle()); } } diff --git a/tests/PhpPresentation/Tests/Writer/AbstractWriter.php b/tests/PhpPresentation/Tests/Writer/AbstractWriter.php index 7da382b97..a54b7d929 100644 --- a/tests/PhpPresentation/Tests/Writer/AbstractWriter.php +++ b/tests/PhpPresentation/Tests/Writer/AbstractWriter.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -32,8 +31,6 @@ class AbstractWriter extends Writer\AbstractWriter * public wrapper for protected method. * * @return AbstractShape[] All drawings in PhpPresentation - * - * @throws \Exception */ public function allDrawings(): array { diff --git a/tests/PhpPresentation/Tests/Writer/AbstractWriterTest.php b/tests/PhpPresentation/Tests/Writer/AbstractWriterTest.php index 101ed117c..4dfbd2b04 100644 --- a/tests/PhpPresentation/Tests/Writer/AbstractWriterTest.php +++ b/tests/PhpPresentation/Tests/Writer/AbstractWriterTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -45,9 +44,9 @@ public function testConstruct(): void /** @var ZipInterface $oStubZip */ $oStubZip = $this->getMockForAbstractClass(ZipInterface::class); - $this->assertNull($oStubWriter->getZipAdapter()); - $this->assertInstanceOf(AbstractWriter::class, $oStubWriter->setZipAdapter($oStubZip)); - $this->assertInstanceOf(ZipInterface::class, $oStubWriter->getZipAdapter()); + self::assertNull($oStubWriter->getZipAdapter()); + self::assertInstanceOf(AbstractWriter::class, $oStubWriter->setZipAdapter($oStubZip)); + self::assertInstanceOf(ZipInterface::class, $oStubWriter->getZipAdapter()); } /** @@ -69,6 +68,6 @@ public function testAllDrawingsIncludesMasterSlides(): void $writer->setPhpPresentation($presentation); $drawings = $writer->allDrawings(); - $this->assertCount(2, $drawings, 'Number of drawings should equal two: one from normal slide and one from master slide'); + self::assertCount(2, $drawings, 'Number of drawings should equal two: one from normal slide and one from master slide'); } } diff --git a/tests/PhpPresentation/Tests/Writer/ODPresentation/ContentTest.php b/tests/PhpPresentation/Tests/Writer/ODPresentation/ContentTest.php index c67a78bc9..6ec41135c 100644 --- a/tests/PhpPresentation/Tests/Writer/ODPresentation/ContentTest.php +++ b/tests/PhpPresentation/Tests/Writer/ODPresentation/ContentTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -36,6 +35,7 @@ use PhpOffice\PhpPresentation\Style\Fill; use PhpOffice\PhpPresentation\Style\Font; use PhpOffice\PhpPresentation\Tests\PhpPresentationTestCase; +use ReflectionClass; /** * Test class for PhpOffice\PhpPresentation\Writer\ODPresentation\Manifest. @@ -118,7 +118,7 @@ public function testDrawingShapeFill(): void $this->assertIsSchemaOpenDocumentNotValid('1.2'); $oColor = new Color(Color::COLOR_DARKRED); - $oColor->setAlpha(rand(0, 100)); + $oColor->setAlpha(mt_rand(0, 100)); $oShape->getFill()->setFillType(Fill::FILL_SOLID)->setStartColor($oColor); $this->resetPresentationFile(); @@ -539,7 +539,7 @@ public function testRichTextShadow(): void if (0 == $inc || 180 == $inc || 360 == $inc) { $this->assertZipXmlAttributeEquals('content.xml', $element, 'draw:shadow-offset-y', '0cm'); } else { - if (($inc > 0 && $inc < 180) || 360 == $inc) { + if ($inc < 180) { $this->assertZipXmlAttributeEquals('content.xml', $element, 'draw:shadow-offset-y', Drawing::pixelsToCentimeters((int) $randDistance) . 'cm'); } else { $this->assertZipXmlAttributeEquals('content.xml', $element, 'draw:shadow-offset-y', '-' . Drawing::pixelsToCentimeters((int) $randDistance) . 'cm'); @@ -989,7 +989,7 @@ public function testTransition(): void $this->assertZipXmlAttributeContains('content.xml', $element, 'presentation:transition-speed', 'slow'); $this->assertIsSchemaOpenDocumentValid('1.2'); - $rcTransition = new \ReflectionClass('PhpOffice\PhpPresentation\Slide\Transition'); + $rcTransition = new ReflectionClass('PhpOffice\PhpPresentation\Slide\Transition'); $arrayConstants = $rcTransition->getConstants(); foreach ($arrayConstants as $key => $value) { if (0 !== strpos($key, 'TRANSITION_')) { @@ -1001,147 +1001,195 @@ public function testTransition(): void switch ($key) { case 'TRANSITION_BLINDS_HORIZONTAL': $this->assertZipXmlAttributeContains('content.xml', $element, 'presentation:transition-style', 'horizontal-stripes'); + break; case 'TRANSITION_BLINDS_VERTICAL': $this->assertZipXmlAttributeContains('content.xml', $element, 'presentation:transition-style', 'vertical-stripes'); + break; case 'TRANSITION_CHECKER_HORIZONTAL': $this->assertZipXmlAttributeContains('content.xml', $element, 'presentation:transition-style', 'horizontal-checkerboard'); + break; case 'TRANSITION_CHECKER_VERTICAL': $this->assertZipXmlAttributeContains('content.xml', $element, 'presentation:transition-style', 'vertical-checkerboard'); + break; case 'TRANSITION_CIRCLE_HORIZONTAL': $this->assertZipXmlAttributeContains('content.xml', $element, 'presentation:transition-style', 'none'); + break; case 'TRANSITION_CIRCLE_VERTICAL': $this->assertZipXmlAttributeContains('content.xml', $element, 'presentation:transition-style', 'none'); + break; case 'TRANSITION_COMB_HORIZONTAL': $this->assertZipXmlAttributeContains('content.xml', $element, 'presentation:transition-style', 'none'); + break; case 'TRANSITION_COMB_VERTICAL': $this->assertZipXmlAttributeContains('content.xml', $element, 'presentation:transition-style', 'none'); + break; case 'TRANSITION_COVER_DOWN': $this->assertZipXmlAttributeContains('content.xml', $element, 'presentation:transition-style', 'uncover-to-bottom'); + break; case 'TRANSITION_COVER_LEFT': $this->assertZipXmlAttributeContains('content.xml', $element, 'presentation:transition-style', 'uncover-to-left'); + break; case 'TRANSITION_COVER_LEFT_DOWN': $this->assertZipXmlAttributeContains('content.xml', $element, 'presentation:transition-style', 'uncover-to-lowerleft'); + break; case 'TRANSITION_COVER_LEFT_UP': $this->assertZipXmlAttributeContains('content.xml', $element, 'presentation:transition-style', 'uncover-to-upperleft'); + break; case 'TRANSITION_COVER_RIGHT': $this->assertZipXmlAttributeContains('content.xml', $element, 'presentation:transition-style', 'uncover-to-right'); + break; case 'TRANSITION_COVER_RIGHT_DOWN': $this->assertZipXmlAttributeContains('content.xml', $element, 'presentation:transition-style', 'uncover-to-lowerright'); + break; case 'TRANSITION_COVER_RIGHT_UP': $this->assertZipXmlAttributeContains('content.xml', $element, 'presentation:transition-style', 'uncover-to-upperright'); + break; case 'TRANSITION_COVER_UP': $this->assertZipXmlAttributeContains('content.xml', $element, 'presentation:transition-style', 'uncover-to-top'); + break; case 'TRANSITION_CUT': $this->assertZipXmlAttributeContains('content.xml', $element, 'presentation:transition-style', 'none'); + break; case 'TRANSITION_DIAMOND': $this->assertZipXmlAttributeContains('content.xml', $element, 'presentation:transition-style', 'none'); + break; case 'TRANSITION_DISSOLVE': $this->assertZipXmlAttributeContains('content.xml', $element, 'presentation:transition-style', 'dissolve'); + break; case 'TRANSITION_FADE': $this->assertZipXmlAttributeContains('content.xml', $element, 'presentation:transition-style', 'fade-from-center'); + break; case 'TRANSITION_NEWSFLASH': $this->assertZipXmlAttributeContains('content.xml', $element, 'presentation:transition-style', 'none'); + break; case 'TRANSITION_PLUS': $this->assertZipXmlAttributeContains('content.xml', $element, 'presentation:transition-style', 'close'); + break; case 'TRANSITION_PULL_DOWN': $this->assertZipXmlAttributeContains('content.xml', $element, 'presentation:transition-style', 'stretch-from-bottom'); + break; case 'TRANSITION_PULL_LEFT': $this->assertZipXmlAttributeContains('content.xml', $element, 'presentation:transition-style', 'stretch-from-left'); + break; case 'TRANSITION_PULL_RIGHT': $this->assertZipXmlAttributeContains('content.xml', $element, 'presentation:transition-style', 'stretch-from-right'); + break; case 'TRANSITION_PULL_UP': $this->assertZipXmlAttributeContains('content.xml', $element, 'presentation:transition-style', 'stretch-from-top'); + break; case 'TRANSITION_PUSH_DOWN': $this->assertZipXmlAttributeContains('content.xml', $element, 'presentation:transition-style', 'roll-from-bottom'); + break; case 'TRANSITION_PUSH_LEFT': $this->assertZipXmlAttributeContains('content.xml', $element, 'presentation:transition-style', 'roll-from-left'); + break; case 'TRANSITION_PUSH_RIGHT': $this->assertZipXmlAttributeContains('content.xml', $element, 'presentation:transition-style', 'roll-from-right'); + break; case 'TRANSITION_PUSH_UP': $this->assertZipXmlAttributeContains('content.xml', $element, 'presentation:transition-style', 'roll-from-top'); + break; case 'TRANSITION_RANDOM': $this->assertZipXmlAttributeContains('content.xml', $element, 'presentation:transition-style', 'random'); + break; case 'TRANSITION_RANDOMBAR_HORIZONTAL': $this->assertZipXmlAttributeContains('content.xml', $element, 'presentation:transition-style', 'horizontal-lines'); + break; case 'TRANSITION_RANDOMBAR_VERTICAL': $this->assertZipXmlAttributeContains('content.xml', $element, 'presentation:transition-style', 'vertical-lines'); + break; case 'TRANSITION_SPLIT_IN_HORIZONTAL': $this->assertZipXmlAttributeContains('content.xml', $element, 'presentation:transition-style', 'close-horizontal'); + break; case 'TRANSITION_SPLIT_OUT_HORIZONTAL': $this->assertZipXmlAttributeContains('content.xml', $element, 'presentation:transition-style', 'open-horizontal'); + break; case 'TRANSITION_SPLIT_IN_VERTICAL': $this->assertZipXmlAttributeContains('content.xml', $element, 'presentation:transition-style', 'close-vertical'); + break; case 'TRANSITION_SPLIT_OUT_VERTICAL': $this->assertZipXmlAttributeContains('content.xml', $element, 'presentation:transition-style', 'open-vertical'); + break; case 'TRANSITION_STRIPS_LEFT_DOWN': $this->assertZipXmlAttributeContains('content.xml', $element, 'presentation:transition-style', 'none'); + break; case 'TRANSITION_STRIPS_LEFT_UP': $this->assertZipXmlAttributeContains('content.xml', $element, 'presentation:transition-style', 'none'); + break; case 'TRANSITION_STRIPS_RIGHT_DOWN': $this->assertZipXmlAttributeContains('content.xml', $element, 'presentation:transition-style', 'none'); + break; case 'TRANSITION_STRIPS_RIGHT_UP': $this->assertZipXmlAttributeContains('content.xml', $element, 'presentation:transition-style', 'none'); + break; case 'TRANSITION_WEDGE': $this->assertZipXmlAttributeContains('content.xml', $element, 'presentation:transition-style', 'none'); + break; case 'TRANSITION_WIPE_DOWN': $this->assertZipXmlAttributeContains('content.xml', $element, 'presentation:transition-style', 'fade-from-bottom'); + break; case 'TRANSITION_WIPE_LEFT': $this->assertZipXmlAttributeContains('content.xml', $element, 'presentation:transition-style', 'fade-from-left'); + break; case 'TRANSITION_WIPE_RIGHT': $this->assertZipXmlAttributeContains('content.xml', $element, 'presentation:transition-style', 'fade-from-right'); + break; case 'TRANSITION_WIPE_UP': $this->assertZipXmlAttributeContains('content.xml', $element, 'presentation:transition-style', 'fade-from-top'); + break; case 'TRANSITION_ZOOM_IN': $this->assertZipXmlAttributeContains('content.xml', $element, 'presentation:transition-style', 'none'); + break; case 'TRANSITION_ZOOM_OUT': $this->assertZipXmlAttributeContains('content.xml', $element, 'presentation:transition-style', 'none'); + break; } $this->assertIsSchemaOpenDocumentValid('1.2'); @@ -1192,7 +1240,7 @@ public function testShowType(string $slideshowType, bool $withAttribute): void } /** - * @return array<array<string|bool>> + * @return array<array<bool|string>> */ public function dataProviderShowType(): array { diff --git a/tests/PhpPresentation/Tests/Writer/ODPresentation/MetaInfManifestTest.php b/tests/PhpPresentation/Tests/Writer/ODPresentation/MetaInfManifestTest.php index 6019d6666..223330864 100644 --- a/tests/PhpPresentation/Tests/Writer/ODPresentation/MetaInfManifestTest.php +++ b/tests/PhpPresentation/Tests/Writer/ODPresentation/MetaInfManifestTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpPresentation/Tests/Writer/ODPresentation/MetaTest.php b/tests/PhpPresentation/Tests/Writer/ODPresentation/MetaTest.php index a6a142e69..73e68a3ce 100644 --- a/tests/PhpPresentation/Tests/Writer/ODPresentation/MetaTest.php +++ b/tests/PhpPresentation/Tests/Writer/ODPresentation/MetaTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -31,9 +30,6 @@ class MetaTest extends PhpPresentationTestCase * @dataProvider dataProviderCustomProperties * * @param mixed $propertyValue - * @param string|null $propertyType - * @param string $expectedValue - * @param string $expectedValueType */ public function testCustomProperties($propertyValue, ?string $propertyType, string $expectedValue, string $expectedValueType): void { @@ -50,7 +46,7 @@ public function testCustomProperties($propertyValue, ?string $propertyType, stri } /** - * @return array<array<bool|string|int|float|null>> + * @return array<array<null|bool|float|int|string>> */ public function dataProviderCustomProperties(): array { diff --git a/tests/PhpPresentation/Tests/Writer/ODPresentation/ObjectsChartTest.php b/tests/PhpPresentation/Tests/Writer/ODPresentation/ObjectsChartTest.php index 59e668c8a..af4df5210 100644 --- a/tests/PhpPresentation/Tests/Writer/ODPresentation/ObjectsChartTest.php +++ b/tests/PhpPresentation/Tests/Writer/ODPresentation/ObjectsChartTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -95,8 +94,7 @@ public function testAxisFont(): void $this->assertZipXmlAttributeEquals('Object 1/content.xml', $element, 'fo:font-size', '16pt'); $this->assertZipXmlAttributeEquals('Object 1/content.xml', $element, 'fo:font-family', 'Arial'); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); } public function testAxisTitleRotation(): void @@ -115,10 +113,9 @@ public function testAxisTitleRotation(): void $this->assertZipXmlElementExists('Object 1/content.xml', $element); $this->assertZipXmlAttributeNotExists('Object 1/content.xml', $element, 'style:rotation-angle'); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); - $value = rand(1, 360); + $value = mt_rand(1, 360); $oShape->getPlotArea()->getAxisX()->setTitleRotation($value); $this->resetPresentationFile(); @@ -127,8 +124,7 @@ public function testAxisTitleRotation(): void $this->assertZipXmlAttributeExists('Object 1/content.xml', $element, 'style:rotation-angle'); $this->assertZipXmlAttributeEquals('Object 1/content.xml', $element, 'style:rotation-angle', '-' . $value); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); } public function testAxisVisibility(): void @@ -156,8 +152,7 @@ public function testAxisVisibility(): void $this->assertZipXmlElementNotExists('Object 1/content.xml', $element); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); $oShape->getPlotArea()->getAxisX()->setIsVisible(true); $oShape->getPlotArea()->getAxisY()->setIsVisible(true); @@ -183,8 +178,7 @@ public function testAxisVisibility(): void $this->assertZipXmlElementExists('Object 1/content.xml', $element); $this->assertZipXmlElementEquals('Object 1/content.xml', $element, 'Axis Y'); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); } public function testChartDisplayBlankAs(): void @@ -203,8 +197,7 @@ public function testChartDisplayBlankAs(): void $this->assertZipXmlElementExists('Object 1/content.xml', $element); $this->assertZipXmlAttributeExists('Object 1/content.xml', $element, 'chart:treat-empty-cells'); $this->assertZipXmlAttributeEquals('Object 1/content.xml', $element, 'chart:treat-empty-cells', 'use-zero'); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); $this->resetPresentationFile(); $oShape->setDisplayBlankAs(Chart::BLANKAS_SPAN); @@ -213,8 +206,7 @@ public function testChartDisplayBlankAs(): void $this->assertZipXmlElementExists('Object 1/content.xml', $element); $this->assertZipXmlAttributeExists('Object 1/content.xml', $element, 'chart:treat-empty-cells'); $this->assertZipXmlAttributeEquals('Object 1/content.xml', $element, 'chart:treat-empty-cells', 'ignore'); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); $this->resetPresentationFile(); $oShape->setDisplayBlankAs(Chart::BLANKAS_GAP); @@ -223,8 +215,7 @@ public function testChartDisplayBlankAs(): void $this->assertZipXmlElementExists('Object 1/content.xml', $element); $this->assertZipXmlAttributeExists('Object 1/content.xml', $element, 'chart:treat-empty-cells'); $this->assertZipXmlAttributeEquals('Object 1/content.xml', $element, 'chart:treat-empty-cells', 'leave-gap'); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); } public function testLegend(): void @@ -250,8 +241,7 @@ public function testLegend(): void $this->assertZipXmlElementExists('Object 1/content.xml', $element); $element = '/office:document-content/office:body/office:chart/chart:chart/table:table/table:table-header-rows/table:table-row/table:table-cell[@office:value-type=\'string\']'; $this->assertZipXmlElementExists('Object 1/content.xml', $element); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); $oChart->getLegend()->setPosition(Legend::POSITION_RIGHT); $this->resetPresentationFile(); @@ -259,8 +249,7 @@ public function testLegend(): void $element = '/office:document-content/office:body/office:chart/chart:chart/chart:legend'; $this->assertZipXmlElementExists('Object 1/content.xml', $element); $this->assertZipXmlAttributeEquals('Object 1/content.xml', $element, 'chart:legend-position', 'end'); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); $oChart->getLegend()->setPosition(Legend::POSITION_LEFT); $this->resetPresentationFile(); @@ -268,8 +257,7 @@ public function testLegend(): void $element = '/office:document-content/office:body/office:chart/chart:chart/chart:legend'; $this->assertZipXmlElementExists('Object 1/content.xml', $element); $this->assertZipXmlAttributeEquals('Object 1/content.xml', $element, 'chart:legend-position', 'start'); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); $oChart->getLegend()->setPosition(Legend::POSITION_BOTTOM); $this->resetPresentationFile(); @@ -277,8 +265,7 @@ public function testLegend(): void $element = '/office:document-content/office:body/office:chart/chart:chart/chart:legend'; $this->assertZipXmlElementExists('Object 1/content.xml', $element); $this->assertZipXmlAttributeEquals('Object 1/content.xml', $element, 'chart:legend-position', 'bottom'); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); $oChart->getLegend()->setPosition(Legend::POSITION_TOP); $this->resetPresentationFile(); @@ -286,8 +273,7 @@ public function testLegend(): void $element = '/office:document-content/office:body/office:chart/chart:chart/chart:legend'; $this->assertZipXmlElementExists('Object 1/content.xml', $element); $this->assertZipXmlAttributeEquals('Object 1/content.xml', $element, 'chart:legend-position', 'top'); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); $oChart->getLegend()->setPosition(Legend::POSITION_TOPRIGHT); $this->resetPresentationFile(); @@ -295,8 +281,7 @@ public function testLegend(): void $element = '/office:document-content/office:body/office:chart/chart:chart/chart:legend'; $this->assertZipXmlElementExists('Object 1/content.xml', $element); $this->assertZipXmlAttributeEquals('Object 1/content.xml', $element, 'chart:legend-position', 'top-end'); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); } public function testSeriesValues(): void @@ -321,8 +306,7 @@ public function testSeriesValues(): void $this->assertZipXmlElementExists('Object 1/content.xml', $element); $this->assertZipXmlElementEquals('Object 1/content.xml', $element, 'NaN'); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); $this->resetPresentationFile(); @@ -341,8 +325,7 @@ public function testSeriesValues(): void $this->assertZipXmlElementExists('Object 1/content.xml', $element); $this->assertZipXmlElementEquals('Object 1/content.xml', $element, '12.3'); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); $this->resetPresentationFile(); @@ -360,8 +343,7 @@ public function testSeriesValues(): void $this->assertZipXmlElementExists('Object 1/content.xml', $element); $this->assertZipXmlElementEquals('Object 1/content.xml', $element, 'data'); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); } public function testSeriesShowConfig(): void @@ -379,8 +361,7 @@ public function testSeriesShowConfig(): void $this->assertZipXmlAttributeExists('Object 1/content.xml', $element, 'chart:data-label-number'); $this->assertZipXmlAttributeEquals('Object 1/content.xml', $element, 'chart:data-label-number', 'value'); $this->assertZipXmlAttributeNotExists('Object 1/content.xml', $element, 'chart:data-label-text'); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); $oSeries->setShowValue(false); $this->resetPresentationFile(); @@ -389,8 +370,7 @@ public function testSeriesShowConfig(): void $this->assertZipXmlElementExists('Object 1/content.xml', $element); $this->assertZipXmlAttributeNotExists('Object 1/content.xml', $element, 'chart:data-label-number'); $this->assertZipXmlAttributeNotExists('Object 1/content.xml', $element, 'chart:data-label-text'); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); // $showCategoryName = false / $showPercentage = true / $showValue = true $oSeries->setShowValue(true); @@ -401,8 +381,7 @@ public function testSeriesShowConfig(): void $this->assertZipXmlAttributeExists('Object 1/content.xml', $element, 'chart:data-label-number'); $this->assertZipXmlAttributeEquals('Object 1/content.xml', $element, 'chart:data-label-number', 'value-and-percentage'); $this->assertZipXmlAttributeNotExists('Object 1/content.xml', $element, 'chart:data-label-text'); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); // $showCategoryName = false / $showPercentage = true / $showValue = false $oSeries->setShowValue(false); @@ -412,8 +391,7 @@ public function testSeriesShowConfig(): void $this->assertZipXmlAttributeExists('Object 1/content.xml', $element, 'chart:data-label-number'); $this->assertZipXmlAttributeEquals('Object 1/content.xml', $element, 'chart:data-label-number', 'percentage'); $this->assertZipXmlAttributeNotExists('Object 1/content.xml', $element, 'chart:data-label-text'); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); // $showCategoryName = false / $showPercentage = true / $showValue = false $oSeries->setShowCategoryName(true); @@ -422,8 +400,7 @@ public function testSeriesShowConfig(): void $this->assertZipXmlElementExists('Object 1/content.xml', $element); $this->assertZipXmlAttributeExists('Object 1/content.xml', $element, 'chart:data-label-text'); $this->assertZipXmlAttributeEquals('Object 1/content.xml', $element, 'chart:data-label-text', 'true'); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); } public function testTitleVisibility(): void @@ -435,21 +412,19 @@ public function testTitleVisibility(): void $elementTitle = '/office:document-content/office:body/office:chart/chart:chart/chart:title'; $elementStyle = '/office:document-content/office:automatic-styles/style:style[@style:name=\'styleTitle\']'; - $this->assertTrue($oShape->getTitle()->isVisible()); - $this->assertInstanceOf('PhpOffice\PhpPresentation\Shape\Chart\Title', $oShape->getTitle()->setVisible(true)); + self::assertTrue($oShape->getTitle()->isVisible()); + self::assertInstanceOf('PhpOffice\PhpPresentation\Shape\Chart\Title', $oShape->getTitle()->setVisible(true)); $this->assertZipXmlElementExists('Object 1/content.xml', $elementTitle); $this->assertZipXmlElementExists('Object 1/content.xml', $elementStyle); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); - $this->assertInstanceOf('PhpOffice\PhpPresentation\Shape\Chart\Title', $oShape->getTitle()->setVisible(false)); + self::assertInstanceOf('PhpOffice\PhpPresentation\Shape\Chart\Title', $oShape->getTitle()->setVisible(false)); $this->resetPresentationFile(); $this->assertZipXmlElementNotExists('Object 1/content.xml', $elementTitle); $this->assertZipXmlElementNotExists('Object 1/content.xml', $elementStyle); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); } public function testTypeArea(): void @@ -474,8 +449,7 @@ public function testTypeArea(): void $this->assertZipXmlAttributeExists('Object 1/content.xml', $element, 'draw:fill-color'); $this->assertZipXmlAttributeEquals('Object 1/content.xml', $element, 'draw:fill-color', '#93A9CE'); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); } public function testTypeAxisBounds(): void @@ -493,8 +467,7 @@ public function testTypeAxisBounds(): void $this->assertZipXmlAttributeNotExists('Object 1/content.xml', $element, 'chart:minimum'); $this->assertZipXmlAttributeNotExists('Object 1/content.xml', $element, 'chart:maximum'); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); $oShape->getPlotArea()->getAxisX()->setMinBounds($value); $this->resetPresentationFile(); @@ -503,8 +476,7 @@ public function testTypeAxisBounds(): void $this->assertZipXmlAttributeExists('Object 1/content.xml', $element, 'chart:minimum'); $this->assertZipXmlAttributeEquals('Object 1/content.xml', $element, 'chart:minimum', $value); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); $oShape->getPlotArea()->getAxisX()->setMinBounds(null); $oShape->getPlotArea()->getAxisX()->setMaxBounds($value); @@ -514,8 +486,7 @@ public function testTypeAxisBounds(): void $this->assertZipXmlAttributeExists('Object 1/content.xml', $element, 'chart:maximum'); $this->assertZipXmlAttributeEquals('Object 1/content.xml', $element, 'chart:maximum', $value); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); $oShape->getPlotArea()->getAxisX()->setMinBounds($value); $oShape->getPlotArea()->getAxisX()->setMaxBounds($value); @@ -526,8 +497,7 @@ public function testTypeAxisBounds(): void $this->assertZipXmlAttributeExists('Object 1/content.xml', $element, 'chart:maximum'); $this->assertZipXmlAttributeEquals('Object 1/content.xml', $element, 'chart:maximum', $value); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); } public function testTypeAxisOutline(): void @@ -547,8 +517,7 @@ public function testTypeAxisOutline(): void $this->assertZipXmlAttributeExists('Object 1/content.xml', $element, 'svg:stroke-color'); $this->assertZipXmlAttributeEquals('Object 1/content.xml', $element, 'svg:stroke-color', '#000000'); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); $this->resetPresentationFile(); $shape->getPlotArea()->getAxisX()->getOutline()->setWidth(10); @@ -562,8 +531,7 @@ public function testTypeAxisOutline(): void $this->assertZipXmlAttributeExists('Object 1/content.xml', $element, 'svg:stroke-color'); $this->assertZipXmlAttributeEquals('Object 1/content.xml', $element, 'svg:stroke-color', '#ABCDEF'); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); } public function testTypeAxisTickLabelPosition(): void @@ -581,8 +549,7 @@ public function testTypeAxisTickLabelPosition(): void $this->assertZipXmlAttributeNotExists('Object 1/content.xml', $element, 'chart:axis-position'); $this->assertZipXmlAttributeNotExists('Object 1/content.xml', $element, 'chart:tick-mark-position'); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); $this->resetPresentationFile(); $oShape->getPlotArea()->getAxisX()->setTickLabelPosition(Axis::TICK_LABEL_POSITION_HIGH); @@ -593,8 +560,7 @@ public function testTypeAxisTickLabelPosition(): void $this->assertZipXmlAttributeEquals('Object 1/content.xml', $element, 'chart:axis-position', '0'); $this->assertZipXmlAttributeNotExists('Object 1/content.xml', $element, 'chart:tick-mark-position'); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); $this->resetPresentationFile(); $oShape->getPlotArea()->getAxisX()->setTickLabelPosition(Axis::TICK_LABEL_POSITION_LOW); @@ -606,8 +572,7 @@ public function testTypeAxisTickLabelPosition(): void $this->assertZipXmlAttributeExists('Object 1/content.xml', $element, 'chart:tick-mark-position'); $this->assertZipXmlAttributeEquals('Object 1/content.xml', $element, 'chart:tick-mark-position', 'at-axis'); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); } public function testTypeAxisUnit(): void @@ -625,8 +590,7 @@ public function testTypeAxisUnit(): void $this->assertZipXmlAttributeNotExists('Object 1/content.xml', $element, 'chart:interval-minor-divisor'); $this->assertZipXmlAttributeNotExists('Object 1/content.xml', $element, 'chart:interval-major'); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); $shape->getPlotArea()->getAxisX()->setMinorUnit($value); $this->resetPresentationFile(); @@ -635,8 +599,7 @@ public function testTypeAxisUnit(): void $this->assertZipXmlAttributeExists('Object 1/content.xml', $element, 'chart:interval-minor-divisor'); $this->assertZipXmlAttributeEquals('Object 1/content.xml', $element, 'chart:interval-minor-divisor', $value); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); $shape->getPlotArea()->getAxisX()->setMinorUnit(null); $shape->getPlotArea()->getAxisX()->setMajorUnit($value); @@ -646,8 +609,7 @@ public function testTypeAxisUnit(): void $this->assertZipXmlAttributeExists('Object 1/content.xml', $element, 'chart:interval-major'); $this->assertZipXmlAttributeEquals('Object 1/content.xml', $element, 'chart:interval-major', $value); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); $shape->getPlotArea()->getAxisX()->setMinorUnit($value); $shape->getPlotArea()->getAxisX()->setMajorUnit($value); @@ -658,8 +620,7 @@ public function testTypeAxisUnit(): void $this->assertZipXmlAttributeExists('Object 1/content.xml', $element, 'chart:interval-major'); $this->assertZipXmlAttributeEquals('Object 1/content.xml', $element, 'chart:interval-major', $value); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); } public function testTypeBar(): void @@ -691,8 +652,7 @@ public function testTypeBar(): void $this->assertZipXmlAttributeNotExists('Object 1/content.xml', $element, 'chart:percentage'); $this->assertZipXmlAttributeEquals('Object 1/content.xml', $element, 'chart:data-label-number', 'value'); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); } public function testTypeBarGroupingStacked(): void @@ -710,8 +670,7 @@ public function testTypeBarGroupingStacked(): void $this->assertZipXmlAttributeNotExists('Object 1/content.xml', $element, 'chart:percentage'); $this->assertZipXmlAttributeEquals('Object 1/content.xml', $element, 'chart:data-label-number', 'value'); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); } public function testTypeBarGroupingPercentStacked(): void @@ -729,8 +688,7 @@ public function testTypeBarGroupingPercentStacked(): void $this->assertZipXmlAttributeEquals('Object 1/content.xml', $element, 'chart:percentage', 'true'); $this->assertZipXmlAttributeEquals('Object 1/content.xml', $element, 'chart:data-label-number', 'percentage'); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); } public function testTypeBarHorizontal(): void @@ -756,8 +714,7 @@ public function testTypeBarHorizontal(): void $this->assertZipXmlAttributeNotExists('Object 1/content.xml', $element, 'chart:three-dimensional'); $this->assertZipXmlAttributeNotExists('Object 1/content.xml', $element, 'chart:right-angled-axes'); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); } public function testTypeBar3D(): void @@ -787,8 +744,7 @@ public function testTypeBar3D(): void $this->assertZipXmlAttributeExists('Object 1/content.xml', $element, 'chart:right-angled-axes'); $this->assertZipXmlAttributeEquals('Object 1/content.xml', $element, 'chart:right-angled-axes', 'true'); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); } public function testTypeBar3DHorizontal(): void @@ -816,8 +772,7 @@ public function testTypeBar3DHorizontal(): void $this->assertZipXmlAttributeExists('Object 1/content.xml', $element, 'chart:right-angled-axes'); $this->assertZipXmlAttributeEquals('Object 1/content.xml', $element, 'chart:right-angled-axes', 'true'); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); } public function testTypeDoughnut(): void @@ -843,8 +798,7 @@ public function testTypeDoughnut(): void $this->assertZipXmlAttributeEquals('Object 1/content.xml', $element, 'chart:class', 'chart:ring'); $element = '/office:document-content/office:automatic-styles/style:style/style:chart-properties/chart:label-separator/text:p'; $this->assertZipXmlElementNotExists('Object 1/content.xml', $element); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); // $oDoughnut->setHoleSize($randHoleSize); // $this->resetPresentationFile(); @@ -855,8 +809,7 @@ public function testTypeDoughnut(): void $element = '/office:document-content/office:automatic-styles/style:style/style:chart-properties/chart:label-separator/text:p'; $this->assertZipXmlElementExists('Object 1/content.xml', $element); $this->assertZipXmlElementEquals('Object 1/content.xml', $element, $randSeparator); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); } public function testTypeLine(): void @@ -892,8 +845,7 @@ public function testTypeLine(): void $this->assertZipXmlAttributeEquals('Object 1/content.xml', $element, 'svg:stroke-width', '0.035cm'); $this->assertZipXmlAttributeEquals('Object 1/content.xml', $element, 'svg:stroke-color', '#000000'); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); } public function testTypeLineGridlines(): void @@ -961,8 +913,8 @@ public function testTypeLineGridlines(): void $this->assertZipXmlAttributeStartsWith('Object 1/content.xml', $expectedElementStyle, 'svg:stroke-color', '#'); $this->assertZipXmlAttributeEndsWith('Object 1/content.xml', $expectedElementStyle, 'svg:stroke-color', $expectedColor->getRGB()); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + // chart:title : + $this->assertIsSchemaOpenDocumentValid('1.2'); } } @@ -991,8 +943,7 @@ public function testTypeLineMarker(): void $this->assertZipXmlAttributeEquals('Object 1/content.xml', $expectedElement, 'chart:symbol-width', $expectedSizeCm); $this->assertZipXmlAttributeEquals('Object 1/content.xml', $expectedElement, 'chart:symbol-height', $expectedSizeCm); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); $oSeries->getMarker()->setSymbol($expectedSymbol2); $oLine->setSeries([$oSeries]); @@ -1000,8 +951,7 @@ public function testTypeLineMarker(): void $this->assertZipXmlAttributeEquals('Object 1/content.xml', $expectedElement, 'chart:symbol-name', 'horizontal-bar'); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); $oSeries->getMarker()->setSymbol($expectedSymbol3); $oLine->setSeries([$oSeries]); @@ -1009,8 +959,7 @@ public function testTypeLineMarker(): void $this->assertZipXmlAttributeEquals('Object 1/content.xml', $expectedElement, 'chart:symbol-name', 'circle'); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); $oSeries->getMarker()->setSymbol($expectedSymbol4); $oLine->setSeries([$oSeries]); @@ -1018,8 +967,7 @@ public function testTypeLineMarker(): void $this->assertZipXmlAttributeEquals('Object 1/content.xml', $expectedElement, 'chart:symbol-name', 'arrow-up'); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); $oSeries->getMarker()->setSymbol($expectedSymbol5); $oLine->setSeries([$oSeries]); @@ -1029,8 +977,7 @@ public function testTypeLineMarker(): void $this->assertZipXmlAttributeNotExists('Object 1/content.xml', $expectedElement, 'chart:symbol-width'); $this->assertZipXmlAttributeNotExists('Object 1/content.xml', $expectedElement, 'chart:symbol-height'); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); } public function testTypeLineSeriesOutline(): void @@ -1059,8 +1006,7 @@ public function testTypeLineSeriesOutline(): void $this->assertZipXmlAttributeEquals('Object 1/content.xml', $expectedElement, 'svg:stroke-width', '0.079cm'); $this->assertZipXmlAttributeExists('Object 1/content.xml', $expectedElement, 'svg:stroke-color'); $this->assertZipXmlAttributeEquals('Object 1/content.xml', $expectedElement, 'svg:stroke-color', '#4a7ebb'); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); $oSeries->setOutline($oOutline); $oLine->setSeries([$oSeries]); @@ -1072,8 +1018,7 @@ public function testTypeLineSeriesOutline(): void $this->assertZipXmlAttributeEquals('Object 1/content.xml', $expectedElement, 'svg:stroke-width', $expectedWidthCm); $this->assertZipXmlAttributeExists('Object 1/content.xml', $expectedElement, 'svg:stroke-color'); $this->assertZipXmlAttributeEquals('Object 1/content.xml', $expectedElement, 'svg:stroke-color', '#' . $oColor->getRGB()); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); } public function testTypeLineSmooth(): void @@ -1092,8 +1037,7 @@ public function testTypeLineSmooth(): void $this->assertZipFileExists('Object 1/content.xml'); $this->assertZipXmlElementExists('Object 1/content.xml', $element); $this->assertZipXmlAttributeNotExists('Object 1/content.xml', $element, 'chart:interpolation'); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); $this->resetPresentationFile(); $oLine->setIsSmooth(true); @@ -1103,8 +1047,7 @@ public function testTypeLineSmooth(): void $this->assertZipXmlElementExists('Object 1/content.xml', $element); $this->assertZipXmlAttributeExists('Object 1/content.xml', $element, 'chart:interpolation'); $this->assertZipXmlAttributeEquals('Object 1/content.xml', $element, 'chart:interpolation', 'cubic-spline'); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); } public function testTypePie(): void @@ -1134,8 +1077,7 @@ public function testTypePie(): void $this->assertZipXmlElementExists('Object 1/content.xml', $element); $this->assertZipXmlAttributeEquals('Object 1/content.xml', $element, 'chart:reverse-direction', 'true'); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); } public function testTypePie3D(): void @@ -1165,8 +1107,7 @@ public function testTypePie3D(): void $this->assertZipXmlElementExists('Object 1/content.xml', $element); $this->assertZipXmlAttributeEquals('Object 1/content.xml', $element, 'chart:reverse-direction', 'true'); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); } public function testTypePie3DExplosion(): void @@ -1184,8 +1125,7 @@ public function testTypePie3DExplosion(): void $element = '/office:document-content/office:automatic-styles/style:style[@style:name=\'styleSeries0\'][@style:family=\'chart\']/style:chart-properties'; $this->assertZipXmlElementExists('Object 1/content.xml', $element); $this->assertZipXmlAttributeEquals('Object 1/content.xml', $element, 'chart:pie-offset', $value); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); } public function testTypeRadar(): void @@ -1210,8 +1150,7 @@ public function testTypeRadar(): void $element = '/office:document-content/office:automatic-styles/style:style[@style:name=\'styleAxisY\']/style:chart-properties'; $this->assertZipXmlElementExists('Object 1/content.xml', $element); $this->assertZipXmlAttributeNotExists('Object 1/content.xml', $element, 'chart:reverse-direction'); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); } public function testTypeRadarSeriesOutline(): void @@ -1241,8 +1180,7 @@ public function testTypeRadarSeriesOutline(): void $this->assertZipXmlAttributeEquals('Object 1/content.xml', $expectedElement, 'svg:stroke-width', '0.079cm'); $this->assertZipXmlAttributeExists('Object 1/content.xml', $expectedElement, 'svg:stroke-color'); $this->assertZipXmlAttributeEquals('Object 1/content.xml', $expectedElement, 'svg:stroke-color', '#4a7ebb'); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); $series->setOutline($outline); $radarChart->setSeries([$series]); @@ -1254,8 +1192,7 @@ public function testTypeRadarSeriesOutline(): void $this->assertZipXmlAttributeEquals('Object 1/content.xml', $expectedElement, 'svg:stroke-width', $expectedWidthCm); $this->assertZipXmlAttributeExists('Object 1/content.xml', $expectedElement, 'svg:stroke-color'); $this->assertZipXmlAttributeEquals('Object 1/content.xml', $expectedElement, 'svg:stroke-color', '#' . $color->getRGB()); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); } public function testTypeScatter(): void @@ -1270,8 +1207,7 @@ public function testTypeScatter(): void $element = '/office:document-content/office:body/office:chart/chart:chart'; $this->assertZipXmlElementExists('Object 1/content.xml', $element); $this->assertZipXmlAttributeEquals('Object 1/content.xml', $element, 'chart:class', 'chart:scatter'); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); } public function testTypeScatterMarker(): void @@ -1298,8 +1234,7 @@ public function testTypeScatterMarker(): void $this->assertZipXmlAttributeEquals('Object 1/content.xml', $expectedElement, 'chart:symbol-width', $expectedSizeCm); $this->assertZipXmlAttributeEquals('Object 1/content.xml', $expectedElement, 'chart:symbol-height', $expectedSizeCm); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); $oSeries->getMarker()->setSymbol($expectedSymbol2); $oScatter->setSeries([$oSeries]); @@ -1307,8 +1242,7 @@ public function testTypeScatterMarker(): void $this->assertZipXmlAttributeEquals('Object 1/content.xml', $expectedElement, 'chart:symbol-name', 'horizontal-bar'); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); $oSeries->getMarker()->setSymbol($expectedSymbol3); $oScatter->setSeries([$oSeries]); @@ -1316,8 +1250,7 @@ public function testTypeScatterMarker(): void $this->assertZipXmlAttributeEquals('Object 1/content.xml', $expectedElement, 'chart:symbol-name', 'circle'); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); $oSeries->getMarker()->setSymbol($expectedSymbol4); $oScatter->setSeries([$oSeries]); @@ -1325,8 +1258,7 @@ public function testTypeScatterMarker(): void $this->assertZipXmlAttributeEquals('Object 1/content.xml', $expectedElement, 'chart:symbol-name', 'arrow-up'); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); $oSeries->getMarker()->setSymbol($expectedSymbol5); $oScatter->setSeries([$oSeries]); @@ -1336,8 +1268,7 @@ public function testTypeScatterMarker(): void $this->assertZipXmlAttributeNotExists('Object 1/content.xml', $expectedElement, 'chart:symbol-width'); $this->assertZipXmlAttributeNotExists('Object 1/content.xml', $expectedElement, 'chart:symbol-height'); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); } public function testTypeScatterSeriesOutline(): void @@ -1365,8 +1296,7 @@ public function testTypeScatterSeriesOutline(): void $this->assertZipXmlAttributeEquals('Object 1/content.xml', $expectedElement, 'svg:stroke-width', '0.079cm'); $this->assertZipXmlAttributeExists('Object 1/content.xml', $expectedElement, 'svg:stroke-color'); $this->assertZipXmlAttributeEquals('Object 1/content.xml', $expectedElement, 'svg:stroke-color', '#4a7ebb'); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); $oSeries->setOutline($oOutline); $oScatter->setSeries([$oSeries]); @@ -1378,8 +1308,7 @@ public function testTypeScatterSeriesOutline(): void $this->assertZipXmlAttributeEquals('Object 1/content.xml', $expectedElement, 'svg:stroke-width', $expectedWidthCm); $this->assertZipXmlAttributeExists('Object 1/content.xml', $expectedElement, 'svg:stroke-color'); $this->assertZipXmlAttributeEquals('Object 1/content.xml', $expectedElement, 'svg:stroke-color', '#' . $oColor->getRGB()); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); } public function testTypeScatterSmooth(): void @@ -1398,8 +1327,7 @@ public function testTypeScatterSmooth(): void $this->assertZipFileExists('Object 1/content.xml'); $this->assertZipXmlElementExists('Object 1/content.xml', $element); $this->assertZipXmlAttributeNotExists('Object 1/content.xml', $element, 'chart:interpolation'); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); $this->resetPresentationFile(); $scatter->setIsSmooth(true); @@ -1409,7 +1337,6 @@ public function testTypeScatterSmooth(): void $this->assertZipXmlElementExists('Object 1/content.xml', $element); $this->assertZipXmlAttributeExists('Object 1/content.xml', $element, 'chart:interpolation'); $this->assertZipXmlAttributeEquals('Object 1/content.xml', $element, 'chart:interpolation', 'cubic-spline'); - // chart:title : Element chart failed to validate attributes - $this->assertIsSchemaOpenDocumentNotValid('1.2'); + $this->assertIsSchemaOpenDocumentValid('1.2'); } } diff --git a/tests/PhpPresentation/Tests/Writer/ODPresentation/StylesTest.php b/tests/PhpPresentation/Tests/Writer/ODPresentation/StylesTest.php index 523087adf..a6332b638 100644 --- a/tests/PhpPresentation/Tests/Writer/ODPresentation/StylesTest.php +++ b/tests/PhpPresentation/Tests/Writer/ODPresentation/StylesTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -59,7 +58,7 @@ public function testDocumentLayout(): void public function testCustomDocumentLayout(): void { $oDocumentLayout = new DocumentLayout(); - $oDocumentLayout->setDocumentLayout(['cx' => rand(1, 100), 'cy' => rand(1, 100)]); + $oDocumentLayout->setDocumentLayout(['cx' => mt_rand(1, 100), 'cy' => mt_rand(1, 100)]); $this->oPresentation->setLayout($oDocumentLayout); $element = '/office:document-styles/office:automatic-styles/style:page-layout'; @@ -118,12 +117,14 @@ public function testStrokeDash(): void case Border::DASH_SYSDOT: $this->assertZipXmlAttributeExists('styles.xml', $element, 'draw:dots1'); $this->assertZipXmlAttributeExists('styles.xml', $element, 'draw:dots1-length'); + break; case Border::DASH_DASH: case Border::DASH_LARGEDASH: case Border::DASH_SYSDASH: $this->assertZipXmlAttributeExists('styles.xml', $element, 'draw:dots2'); $this->assertZipXmlAttributeExists('styles.xml', $element, 'draw:dots2-length'); + break; case Border::DASH_DASHDOT: case Border::DASH_LARGEDASHDOT: @@ -134,6 +135,7 @@ public function testStrokeDash(): void $this->assertZipXmlAttributeExists('styles.xml', $element, 'draw:dots1-length'); $this->assertZipXmlAttributeExists('styles.xml', $element, 'draw:dots2'); $this->assertZipXmlAttributeExists('styles.xml', $element, 'draw:dots2-length'); + break; } $this->assertIsSchemaOpenDocumentValid('1.2'); diff --git a/tests/PhpPresentation/Tests/Writer/ODPresentationTest.php b/tests/PhpPresentation/Tests/Writer/ODPresentationTest.php index ba8724708..52f4e47c9 100644 --- a/tests/PhpPresentation/Tests/Writer/ODPresentationTest.php +++ b/tests/PhpPresentation/Tests/Writer/ODPresentationTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -43,9 +42,9 @@ public function testConstruct(): void $this->oPresentation->getActiveSlide()->createDrawingShape(); $object = new ODPresentation($this->oPresentation); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\PhpPresentation', $object->getPhpPresentation()); - $this->assertEquals('./', $object->getDiskCachingDirectory()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\HashTable', $object->getDrawingHashTable()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\PhpPresentation', $object->getPhpPresentation()); + self::assertEquals('./', $object->getDiskCachingDirectory()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\HashTable', $object->getDrawingHashTable()); } /** @@ -66,7 +65,7 @@ public function testSave(): void $object = new ODPresentation($this->oPresentation); $object->save($filename); - $this->assertTrue(file_exists($filename)); + self::assertFileExists($filename); unlink($filename); } @@ -89,11 +88,11 @@ public function testSaveEmpty(): void public function testSetGetUseDiskCaching(): void { $object = new ODPresentation($this->oPresentation); - $this->assertFalse($object->hasDiskCaching()); + self::assertFalse($object->hasDiskCaching()); $object->setUseDiskCaching(true, sys_get_temp_dir()); - $this->assertTrue($object->hasDiskCaching()); - $this->assertEquals(sys_get_temp_dir(), $object->getDiskCachingDirectory()); + self::assertTrue($object->hasDiskCaching()); + self::assertEquals(sys_get_temp_dir(), $object->getDiskCachingDirectory()); } /** diff --git a/tests/PhpPresentation/Tests/Writer/PowerPoint2007/CommentAuthorsTest.php b/tests/PhpPresentation/Tests/Writer/PowerPoint2007/CommentAuthorsTest.php index 18552dbbc..6fdf967f6 100644 --- a/tests/PhpPresentation/Tests/Writer/PowerPoint2007/CommentAuthorsTest.php +++ b/tests/PhpPresentation/Tests/Writer/PowerPoint2007/CommentAuthorsTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpPresentation/Tests/Writer/PowerPoint2007/DocPropsAppTest.php b/tests/PhpPresentation/Tests/Writer/PowerPoint2007/DocPropsAppTest.php index fc9ba5aef..3ec8812f2 100644 --- a/tests/PhpPresentation/Tests/Writer/PowerPoint2007/DocPropsAppTest.php +++ b/tests/PhpPresentation/Tests/Writer/PowerPoint2007/DocPropsAppTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpPresentation/Tests/Writer/PowerPoint2007/DocPropsCoreTest.php b/tests/PhpPresentation/Tests/Writer/PowerPoint2007/DocPropsCoreTest.php index 2f7f87732..3a87a2613 100644 --- a/tests/PhpPresentation/Tests/Writer/PowerPoint2007/DocPropsCoreTest.php +++ b/tests/PhpPresentation/Tests/Writer/PowerPoint2007/DocPropsCoreTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpPresentation/Tests/Writer/PowerPoint2007/DocPropsCustomTest.php b/tests/PhpPresentation/Tests/Writer/PowerPoint2007/DocPropsCustomTest.php index 057b2b839..098f72a33 100644 --- a/tests/PhpPresentation/Tests/Writer/PowerPoint2007/DocPropsCustomTest.php +++ b/tests/PhpPresentation/Tests/Writer/PowerPoint2007/DocPropsCustomTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpPresentation/Tests/Writer/PowerPoint2007/DocPropsThumbnailTest.php b/tests/PhpPresentation/Tests/Writer/PowerPoint2007/DocPropsThumbnailTest.php index c65bba64e..cd29a9733 100644 --- a/tests/PhpPresentation/Tests/Writer/PowerPoint2007/DocPropsThumbnailTest.php +++ b/tests/PhpPresentation/Tests/Writer/PowerPoint2007/DocPropsThumbnailTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpPresentation/Tests/Writer/PowerPoint2007/PptChartsTest.php b/tests/PhpPresentation/Tests/Writer/PowerPoint2007/PptChartsTest.php index aba15710f..d2513a928 100644 --- a/tests/PhpPresentation/Tests/Writer/PowerPoint2007/PptChartsTest.php +++ b/tests/PhpPresentation/Tests/Writer/PowerPoint2007/PptChartsTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -110,7 +109,7 @@ public function testChartIncludeSpreadsheet(): void $oLine->addSeries($oSeries); $oShape->getPlotArea()->setType($oLine); - $this->assertTrue($oShape->hasIncludedSpreadsheet()); + self::assertTrue($oShape->hasIncludedSpreadsheet()); $this->assertZipFileExists('ppt/charts/' . $oShape->getIndexedFilename()); $this->assertZipFileExists('ppt/embeddings/' . $oShape->getIndexedFilename() . '.xlsx'); @@ -153,7 +152,7 @@ public function testChartIncludeSpreadsheet(): void $this->resetPresentationFile(); $oShape->setIncludeSpreadsheet(false); - $this->assertFalse($oShape->hasIncludedSpreadsheet()); + self::assertFalse($oShape->hasIncludedSpreadsheet()); $this->assertZipFileExists('ppt/charts/' . $oShape->getIndexedFilename()); $this->assertZipFileNotExists('ppt/charts/_rels/' . $oShape->getIndexedFilename() . '.rels'); @@ -199,11 +198,11 @@ public function testTitleVisibilityTrue(): void $oShape->getPlotArea()->setType($oLine); // Default - $this->assertTrue($oShape->getTitle()->isVisible()); + self::assertTrue($oShape->getTitle()->isVisible()); // Set Visible : TRUE - $this->assertInstanceOf('PhpOffice\PhpPresentation\Shape\Chart\Title', $oShape->getTitle()->setVisible(true)); - $this->assertTrue($oShape->getTitle()->isVisible()); + self::assertInstanceOf('PhpOffice\PhpPresentation\Shape\Chart\Title', $oShape->getTitle()->setVisible(true)); + self::assertTrue($oShape->getTitle()->isVisible()); $this->assertZipXmlElementExists('ppt/charts/' . $oShape->getIndexedFilename(), $element); $this->assertZipXmlAttributeEquals('ppt/charts/' . $oShape->getIndexedFilename(), $element, 'val', '0'); $this->assertIsSchemaECMA376Valid(); @@ -219,8 +218,8 @@ public function testTitleVisibilityFalse(): void $oShape->getPlotArea()->setType($oLine); // Set Visible : FALSE - $this->assertInstanceOf('PhpOffice\PhpPresentation\Shape\Chart\Title', $oShape->getTitle()->setVisible(false)); - $this->assertFalse($oShape->getTitle()->isVisible()); + self::assertInstanceOf('PhpOffice\PhpPresentation\Shape\Chart\Title', $oShape->getTitle()->setVisible(false)); + self::assertFalse($oShape->getTitle()->isVisible()); $this->assertZipXmlElementExists('ppt/charts/' . $oShape->getIndexedFilename(), $element); $this->assertZipXmlAttributeEquals('ppt/charts/' . $oShape->getIndexedFilename(), $element, 'val', '1'); $this->assertIsSchemaECMA376Valid(); @@ -334,12 +333,12 @@ public function testIsReversedOrder(): void $oShape->getPlotArea()->setType($oLine); // default - $this->assertFalse($oShape->getPlotArea()->getAxisX()->isReversedOrder()); + self::assertFalse($oShape->getPlotArea()->getAxisX()->isReversedOrder()); $this->assertZipXmlAttributeEquals('ppt/charts/' . $oShape->getIndexedFilename(), $element, 'val', 'minMax'); $this->assertIsSchemaECMA376Valid(); // reversed order - $this->assertInstanceOf(Axis::class, $oShape->getPlotArea()->getAxisX()->setIsReversedOrder(true)); + self::assertInstanceOf(Axis::class, $oShape->getPlotArea()->getAxisX()->setIsReversedOrder(true)); $this->resetPresentationFile(); $this->assertZipXmlElementExists('ppt/charts/' . $oShape->getIndexedFilename(), $element); @@ -347,7 +346,7 @@ public function testIsReversedOrder(): void $this->assertIsSchemaECMA376Valid(); // reset reversed order - $this->assertInstanceOf(Axis::class, $oShape->getPlotArea()->getAxisX()->setIsReversedOrder(false)); + self::assertInstanceOf(Axis::class, $oShape->getPlotArea()->getAxisX()->setIsReversedOrder(false)); $this->resetPresentationFile(); $this->assertZipXmlElementExists('ppt/charts/' . $oShape->getIndexedFilename(), $element); @@ -538,7 +537,7 @@ public function testAxisTitleRotation(): void $this->assertZipXmlAttributeNotExists($pathShape, $element, 'rot'); $this->resetPresentationFile(); - $value = rand(0, 360); + $value = mt_rand(0, 360); $oShape->getPlotArea()->getAxisX()->setTitleRotation($value); $pathShape = 'ppt/charts/' . $oShape->getIndexedFilename(); @@ -558,8 +557,8 @@ public function testAxisVisibility(): void $oShape->getPlotArea()->setType($oLine); // Set Visible : FALSE - $this->assertInstanceOf('PhpOffice\PhpPresentation\Shape\Chart\Axis', $oShape->getPlotArea()->getAxisX()->setIsVisible(false)); - $this->assertFalse($oShape->getPlotArea()->getAxisX()->isVisible()); + self::assertInstanceOf('PhpOffice\PhpPresentation\Shape\Chart\Axis', $oShape->getPlotArea()->getAxisX()->setIsVisible(false)); + self::assertFalse($oShape->getPlotArea()->getAxisX()->isVisible()); $this->assertZipXmlElementExists('ppt/charts/' . $oShape->getIndexedFilename(), $element); $this->assertZipXmlAttributeEquals('ppt/charts/' . $oShape->getIndexedFilename(), $element, 'val', '1'); @@ -568,8 +567,8 @@ public function testAxisVisibility(): void $this->resetPresentationFile(); // Set Visible : TRUE - $this->assertInstanceOf('PhpOffice\PhpPresentation\Shape\Chart\Axis', $oShape->getPlotArea()->getAxisX()->setIsVisible(true)); - $this->assertTrue($oShape->getPlotArea()->getAxisX()->isVisible()); + self::assertInstanceOf('PhpOffice\PhpPresentation\Shape\Chart\Axis', $oShape->getPlotArea()->getAxisX()->setIsVisible(true)); + self::assertTrue($oShape->getPlotArea()->getAxisX()->isVisible()); $this->assertZipXmlElementExists('ppt/charts/' . $oShape->getIndexedFilename(), $element); $this->assertZipXmlAttributeEquals('ppt/charts/' . $oShape->getIndexedFilename(), $element, 'val', '0'); @@ -777,7 +776,7 @@ public function testTypeBar3DSuperScript(): void public function testTypeDoughnut(): void { $randHoleSize = mt_rand(10, 90); - $randSeparator = chr(rand(ord('A'), ord('Z'))); + $randSeparator = chr(mt_rand(ord('A'), ord('Z'))); $oSlide = $this->oPresentation->getActiveSlide(); $oShape = $oSlide->createChartShape(); diff --git a/tests/PhpPresentation/Tests/Writer/PowerPoint2007/PptCommentsTest.php b/tests/PhpPresentation/Tests/Writer/PowerPoint2007/PptCommentsTest.php index 8c67c8ac7..d41b8d47d 100644 --- a/tests/PhpPresentation/Tests/Writer/PowerPoint2007/PptCommentsTest.php +++ b/tests/PhpPresentation/Tests/Writer/PowerPoint2007/PptCommentsTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpPresentation/Tests/Writer/PowerPoint2007/PptMediaTest.php b/tests/PhpPresentation/Tests/Writer/PowerPoint2007/PptMediaTest.php index ca77f4d33..637851dd9 100644 --- a/tests/PhpPresentation/Tests/Writer/PowerPoint2007/PptMediaTest.php +++ b/tests/PhpPresentation/Tests/Writer/PowerPoint2007/PptMediaTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpPresentation/Tests/Writer/PowerPoint2007/PptPresPropsTest.php b/tests/PhpPresentation/Tests/Writer/PowerPoint2007/PptPresPropsTest.php index 6acf0e83b..8efef668a 100644 --- a/tests/PhpPresentation/Tests/Writer/PowerPoint2007/PptPresPropsTest.php +++ b/tests/PhpPresentation/Tests/Writer/PowerPoint2007/PptPresPropsTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpPresentation/Tests/Writer/PowerPoint2007/PptPresentationTest.php b/tests/PhpPresentation/Tests/Writer/PowerPoint2007/PptPresentationTest.php index b3b02454a..47ac1c3e4 100644 --- a/tests/PhpPresentation/Tests/Writer/PowerPoint2007/PptPresentationTest.php +++ b/tests/PhpPresentation/Tests/Writer/PowerPoint2007/PptPresentationTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpPresentation/Tests/Writer/PowerPoint2007/PptSlideMastersTest.php b/tests/PhpPresentation/Tests/Writer/PowerPoint2007/PptSlideMastersTest.php index bc99f27c7..14cf1642b 100644 --- a/tests/PhpPresentation/Tests/Writer/PowerPoint2007/PptSlideMastersTest.php +++ b/tests/PhpPresentation/Tests/Writer/PowerPoint2007/PptSlideMastersTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -47,18 +46,19 @@ public function testWriteSlideMasterRelationships(): void $layouts = [new SlideLayout($slideMaster)]; - $slideMaster->expects($this->once()) + $slideMaster->expects(self::once()) ->method('getAllSlideLayouts') - ->will($this->returnValue($layouts)); + ->willReturn($layouts); + /** @var ArrayObject<int, ShapeDrawingFile> $collection */ $collection = new ArrayObject(); $collection[] = new ShapeDrawingFile(); $collection[] = new ShapeDrawingFile(); $collection[] = new ShapeDrawingFile(); - $slideMaster->expects($this->exactly(2)) + $slideMaster->expects(self::exactly(2)) ->method('getShapeCollection') - ->will($this->returnValue($collection)); + ->willReturn($collection); $data = $writer->writeSlideMasterRelationships($slideMaster); @@ -69,13 +69,13 @@ public function testWriteSlideMasterRelationships(): void $xpath->registerNamespace('r', 'http://schemas.openxmlformats.org/package/2006/relationships'); $list = $xpath->query('//r:Relationship'); - $this->assertEquals(5, $list->length); + self::assertEquals(5, $list->length); foreach (range(0, 4) as $id) { /** @var DOMElement $domItem */ $domItem = $list->item($id); - $this->assertInstanceOf(DOMElement::class, $domItem); - $this->assertEquals('rId' . (string) ($id + 1), $domItem->getAttribute('Id')); + self::assertInstanceOf(DOMElement::class, $domItem); + self::assertEquals('rId' . (string) ($id + 1), $domItem->getAttribute('Id')); } } } diff --git a/tests/PhpPresentation/Tests/Writer/PowerPoint2007/PptSlidesTest.php b/tests/PhpPresentation/Tests/Writer/PowerPoint2007/PptSlidesTest.php index c1651a84c..c8ad91423 100644 --- a/tests/PhpPresentation/Tests/Writer/PowerPoint2007/PptSlidesTest.php +++ b/tests/PhpPresentation/Tests/Writer/PowerPoint2007/PptSlidesTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -36,6 +35,7 @@ use PhpOffice\PhpPresentation\Style\Fill; use PhpOffice\PhpPresentation\Style\Font; use PhpOffice\PhpPresentation\Tests\PhpPresentationTestCase; +use ReflectionClass; class PptSlidesTest extends PhpPresentationTestCase { @@ -1093,7 +1093,7 @@ public function testTransition(): void $this->assertZipXmlAttributeEquals('ppt/slides/slide1.xml', $element, 'spd', 'slow'); $this->assertIsSchemaECMA376Valid(); - $rcTransition = new \ReflectionClass('PhpOffice\PhpPresentation\Slide\Transition'); + $rcTransition = new ReflectionClass('PhpOffice\PhpPresentation\Slide\Transition'); $arrayConstants = $rcTransition->getConstants(); foreach ($arrayConstants as $key => $value) { if (0 !== strpos($key, 'TRANSITION_')) { @@ -1106,144 +1106,191 @@ public function testTransition(): void switch ($key) { case 'TRANSITION_BLINDS_HORIZONTAL': $this->assertZipXmlElementExists('ppt/slides/slide1.xml', $element . '/p:blinds[@dir=\'horz\']'); + break; case 'TRANSITION_BLINDS_VERTICAL': $this->assertZipXmlElementExists('ppt/slides/slide1.xml', $element . '/p:blinds[@dir=\'vert\']'); + break; case 'TRANSITION_CHECKER_HORIZONTAL': $this->assertZipXmlElementExists('ppt/slides/slide1.xml', $element . '/p:checker[@dir=\'horz\']'); + break; case 'TRANSITION_CHECKER_VERTICAL': $this->assertZipXmlElementExists('ppt/slides/slide1.xml', $element . '/p:checker[@dir=\'vert\']'); + break; case 'TRANSITION_CIRCLE': $this->assertZipXmlElementExists('ppt/slides/slide1.xml', $element . '/p:circle'); + break; case 'TRANSITION_COMB_HORIZONTAL': $this->assertZipXmlElementExists('ppt/slides/slide1.xml', $element . '/p:comb[@dir=\'horz\']'); + break; case 'TRANSITION_COMB_VERTICAL': $this->assertZipXmlElementExists('ppt/slides/slide1.xml', $element . '/p:comb[@dir=\'vert\']'); + break; case 'TRANSITION_COVER_DOWN': $this->assertZipXmlElementExists('ppt/slides/slide1.xml', $element . '/p:cover[@dir=\'d\']'); + break; case 'TRANSITION_COVER_LEFT': $this->assertZipXmlElementExists('ppt/slides/slide1.xml', $element . '/p:cover[@dir=\'l\']'); + break; case 'TRANSITION_COVER_LEFT_DOWN': $this->assertZipXmlElementExists('ppt/slides/slide1.xml', $element . '/p:cover[@dir=\'ld\']'); + break; case 'TRANSITION_COVER_LEFT_UP': $this->assertZipXmlElementExists('ppt/slides/slide1.xml', $element . '/p:cover[@dir=\'lu\']'); + break; case 'TRANSITION_COVER_RIGHT': $this->assertZipXmlElementExists('ppt/slides/slide1.xml', $element . '/p:cover[@dir=\'r\']'); + break; case 'TRANSITION_COVER_RIGHT_DOWN': $this->assertZipXmlElementExists('ppt/slides/slide1.xml', $element . '/p:cover[@dir=\'rd\']'); + break; case 'TRANSITION_COVER_RIGHT_UP': $this->assertZipXmlElementExists('ppt/slides/slide1.xml', $element . '/p:cover[@dir=\'ru\']'); + break; case 'TRANSITION_COVER_UP': $this->assertZipXmlElementExists('ppt/slides/slide1.xml', $element . '/p:cover[@dir=\'u\']'); + break; case 'TRANSITION_CUT': $this->assertZipXmlElementExists('ppt/slides/slide1.xml', $element . '/p:cut'); + break; case 'TRANSITION_DIAMOND': $this->assertZipXmlElementExists('ppt/slides/slide1.xml', $element . '/p:diamond'); + break; case 'TRANSITION_DISSOLVE': $this->assertZipXmlElementExists('ppt/slides/slide1.xml', $element . '/p:dissolve'); + break; case 'TRANSITION_FADE': $this->assertZipXmlElementExists('ppt/slides/slide1.xml', $element . '/p:fade'); + break; case 'TRANSITION_NEWSFLASH': $this->assertZipXmlElementExists('ppt/slides/slide1.xml', $element . '/p:newsflash'); + break; case 'TRANSITION_PLUS': $this->assertZipXmlElementExists('ppt/slides/slide1.xml', $element . '/p:plus'); + break; case 'TRANSITION_PULL_DOWN': $this->assertZipXmlElementExists('ppt/slides/slide1.xml', $element . '/p:pull[@dir=\'d\']'); + break; case 'TRANSITION_PULL_LEFT': $this->assertZipXmlElementExists('ppt/slides/slide1.xml', $element . '/p:pull[@dir=\'l\']'); + break; case 'TRANSITION_PULL_RIGHT': $this->assertZipXmlElementExists('ppt/slides/slide1.xml', $element . '/p:pull[@dir=\'r\']'); + break; case 'TRANSITION_PULL_UP': $this->assertZipXmlElementExists('ppt/slides/slide1.xml', $element . '/p:pull[@dir=\'u\']'); + break; case 'TRANSITION_PUSH_DOWN': $this->assertZipXmlElementExists('ppt/slides/slide1.xml', $element . '/p:push[@dir=\'d\']'); + break; case 'TRANSITION_PUSH_LEFT': $this->assertZipXmlElementExists('ppt/slides/slide1.xml', $element . '/p:push[@dir=\'l\']'); + break; case 'TRANSITION_PUSH_RIGHT': $this->assertZipXmlElementExists('ppt/slides/slide1.xml', $element . '/p:push[@dir=\'r\']'); + break; case 'TRANSITION_PUSH_UP': $this->assertZipXmlElementExists('ppt/slides/slide1.xml', $element . '/p:push[@dir=\'u\']'); + break; case 'TRANSITION_RANDOM': $this->assertZipXmlElementExists('ppt/slides/slide1.xml', $element . '/p:random'); + break; case 'TRANSITION_RANDOMBAR_HORIZONTAL': $this->assertZipXmlElementExists('ppt/slides/slide1.xml', $element . '/p:randomBar[@dir=\'horz\']'); + break; case 'TRANSITION_RANDOMBAR_VERTICAL': $this->assertZipXmlElementExists('ppt/slides/slide1.xml', $element . '/p:randomBar[@dir=\'vert\']'); + break; case 'TRANSITION_SPLIT_IN_HORIZONTAL': $this->assertZipXmlElementExists('ppt/slides/slide1.xml', $element . '/p:split[@dir=\'in\'][@orient=\'horz\']'); + break; case 'TRANSITION_SPLIT_OUT_HORIZONTAL': $this->assertZipXmlElementExists('ppt/slides/slide1.xml', $element . '/p:split[@dir=\'out\'][@orient=\'horz\']'); + break; case 'TRANSITION_SPLIT_IN_VERTICAL': $this->assertZipXmlElementExists('ppt/slides/slide1.xml', $element . '/p:split[@dir=\'in\'][@orient=\'vert\']'); + break; case 'TRANSITION_SPLIT_OUT_VERTICAL': $this->assertZipXmlElementExists('ppt/slides/slide1.xml', $element . '/p:split[@dir=\'out\'][@orient=\'vert\']'); + break; case 'TRANSITION_STRIPS_LEFT_DOWN': $this->assertZipXmlElementExists('ppt/slides/slide1.xml', $element . '/p:strips[@dir=\'ld\']'); + break; case 'TRANSITION_STRIPS_LEFT_UP': $this->assertZipXmlElementExists('ppt/slides/slide1.xml', $element . '/p:strips[@dir=\'lu\']'); + break; case 'TRANSITION_STRIPS_RIGHT_DOWN': $this->assertZipXmlElementExists('ppt/slides/slide1.xml', $element . '/p:strips[@dir=\'rd\']'); + break; case 'TRANSITION_STRIPS_RIGHT_UP': $this->assertZipXmlElementExists('ppt/slides/slide1.xml', $element . '/p:strips[@dir=\'ru\']'); + break; case 'TRANSITION_WEDGE': $this->assertZipXmlElementExists('ppt/slides/slide1.xml', $element . '/p:wedge'); + break; case 'TRANSITION_WIPE_DOWN': $this->assertZipXmlElementExists('ppt/slides/slide1.xml', $element . '/p:wipe[@dir=\'d\']'); + break; case 'TRANSITION_WIPE_LEFT': $this->assertZipXmlElementExists('ppt/slides/slide1.xml', $element . '/p:wipe[@dir=\'l\']'); + break; case 'TRANSITION_WIPE_RIGHT': $this->assertZipXmlElementExists('ppt/slides/slide1.xml', $element . '/p:wipe[@dir=\'r\']'); + break; case 'TRANSITION_WIPE_UP': $this->assertZipXmlElementExists('ppt/slides/slide1.xml', $element . '/p:wipe[@dir=\'u\']'); + break; case 'TRANSITION_ZOOM_IN': $this->assertZipXmlElementExists('ppt/slides/slide1.xml', $element . '/p:zoom[@dir=\'in\']'); + break; case 'TRANSITION_ZOOM_OUT': $this->assertZipXmlElementExists('ppt/slides/slide1.xml', $element . '/p:zoom[@dir=\'out\']'); + break; } $this->assertIsSchemaECMA376Valid(); diff --git a/tests/PhpPresentation/Tests/Writer/PowerPoint2007/PptTablePropsTest.php b/tests/PhpPresentation/Tests/Writer/PowerPoint2007/PptTablePropsTest.php index dd4957b0d..50322e774 100644 --- a/tests/PhpPresentation/Tests/Writer/PowerPoint2007/PptTablePropsTest.php +++ b/tests/PhpPresentation/Tests/Writer/PowerPoint2007/PptTablePropsTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpPresentation/Tests/Writer/PowerPoint2007/PptViewPropsTest.php b/tests/PhpPresentation/Tests/Writer/PowerPoint2007/PptViewPropsTest.php index a2bed9edf..3bed78410 100644 --- a/tests/PhpPresentation/Tests/Writer/PowerPoint2007/PptViewPropsTest.php +++ b/tests/PhpPresentation/Tests/Writer/PowerPoint2007/PptViewPropsTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpPresentation/Tests/Writer/PowerPoint2007/RelationshipsTest.php b/tests/PhpPresentation/Tests/Writer/PowerPoint2007/RelationshipsTest.php index 015e5464c..e8dcbaec3 100644 --- a/tests/PhpPresentation/Tests/Writer/PowerPoint2007/RelationshipsTest.php +++ b/tests/PhpPresentation/Tests/Writer/PowerPoint2007/RelationshipsTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ diff --git a/tests/PhpPresentation/Tests/Writer/PowerPoint2007Test.php b/tests/PhpPresentation/Tests/Writer/PowerPoint2007Test.php index e8b283b57..b51edfe28 100644 --- a/tests/PhpPresentation/Tests/Writer/PowerPoint2007Test.php +++ b/tests/PhpPresentation/Tests/Writer/PowerPoint2007Test.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -41,8 +40,8 @@ public function testConstruct(): void { $object = new PowerPoint2007($this->oPresentation); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\PhpPresentation', $object->getPhpPresentation()); - $this->assertEquals('./', $object->getDiskCachingDirectory()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\PhpPresentation', $object->getPhpPresentation()); + self::assertEquals('./', $object->getDiskCachingDirectory()); } /** @@ -55,7 +54,7 @@ public function testSave(): void $object = new PowerPoint2007($this->oPresentation); $object->save($filename); - $this->assertTrue(file_exists($filename)); + self::assertFileExists($filename); unlink($filename); } @@ -78,15 +77,15 @@ public function testSaveEmptyException(): void public function testDiskCaching(): void { $object = new PowerPoint2007($this->oPresentation); - $this->assertFalse($object->hasDiskCaching()); + self::assertFalse($object->hasDiskCaching()); $object->setUseDiskCaching(true); - $this->assertTrue($object->hasDiskCaching()); - $this->assertEquals('./', $object->getDiskCachingDirectory()); + self::assertTrue($object->hasDiskCaching()); + self::assertEquals('./', $object->getDiskCachingDirectory()); $object->setUseDiskCaching(true, sys_get_temp_dir()); - $this->assertTrue($object->hasDiskCaching()); - $this->assertEquals(sys_get_temp_dir(), $object->getDiskCachingDirectory()); + self::assertTrue($object->hasDiskCaching()); + self::assertEquals(sys_get_temp_dir(), $object->getDiskCachingDirectory()); } /** diff --git a/tests/PhpPresentation/Tests/Writer/SerializedTest.php b/tests/PhpPresentation/Tests/Writer/SerializedTest.php index 4d495d6d1..77cc19a79 100644 --- a/tests/PhpPresentation/Tests/Writer/SerializedTest.php +++ b/tests/PhpPresentation/Tests/Writer/SerializedTest.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -36,7 +35,7 @@ class SerializedTest extends TestCase public function testConstruct(): void { $object = new Serialized(new PhpPresentation()); - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\PhpPresentation', $object->getPhpPresentation()); + self::assertInstanceOf('PhpOffice\\PhpPresentation\\PhpPresentation', $object->getPhpPresentation()); } public function testSaveEmpty(): void @@ -58,7 +57,7 @@ public function testSave(): void $object = new Serialized($oPhpPresentation); $object->save($file); - $this->assertFileExists($file); + self::assertFileExists($file); } public function testSaveNotExistingDir(): void @@ -88,11 +87,11 @@ public function testSaveOverwriting(): void $oImage->setPath(PHPPRESENTATION_TESTS_BASE_DIR . DIRECTORY_SEPARATOR . 'resources' . DIRECTORY_SEPARATOR . 'images' . DIRECTORY_SEPARATOR . 'PhpPresentationLogo.png'); $file = tempnam(sys_get_temp_dir(), 'PhpPresentation_Serialized'); - file_put_contents($file, rand(1, 100)); + file_put_contents($file, mt_rand(1, 100)); $object = new Serialized($oPhpPresentation); $object->save($file); - $this->assertFileExists($file); + self::assertFileExists($file); } } diff --git a/tests/PhpPresentation/Tests/_includes/PhpPresentationTestCase.php b/tests/PhpPresentation/Tests/_includes/PhpPresentationTestCase.php index 77cba12ca..2d3ebbe47 100644 --- a/tests/PhpPresentation/Tests/_includes/PhpPresentationTestCase.php +++ b/tests/PhpPresentation/Tests/_includes/PhpPresentationTestCase.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -29,11 +28,15 @@ use PhpOffice\PhpPresentation\IOFactory; use PhpOffice\PhpPresentation\PhpPresentation; use PHPUnit\Framework\TestCase; +use RecursiveDirectoryIterator; +use RecursiveIteratorIterator; +use SplFileInfo; +use ZipArchive; class PhpPresentationTestCase extends TestCase { /** - * @var PhpPresentation|null + * @var null|PhpPresentation */ protected $oPresentation; @@ -55,19 +58,19 @@ class PhpPresentationTestCase extends TestCase /** * DOMDocument object. * - * @var DOMDocument|null + * @var null|DOMDocument */ private $xmlDom; /** - * @var DOMXPath|null + * @var null|DOMXPath */ private $xmlXPath; /** * File name. * - * @var string|null + * @var null|string */ private $xmlFile; @@ -204,7 +207,7 @@ protected function writePresentationFile(PhpPresentation $oPhpPresentation, $wri $xmlWriter = IOFactory::createWriter($oPhpPresentation, $writerName); $xmlWriter->save($this->filePath); - $zip = new \ZipArchive(); + $zip = new ZipArchive(); $res = $zip->open($this->filePath); if (true === $res) { $zip->extractTo($this->workDirectory); @@ -406,10 +409,10 @@ public function assertIsSchemaECMA376Valid(): void { // validate all XML files $path = realpath($this->workDirectory . '/ppt'); - $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path)); + $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)); foreach ($iterator as $file) { - /** @var \SplFileInfo $file */ + /** @var SplFileInfo $file */ if ('xml' !== $file->getExtension()) { continue; } @@ -433,10 +436,10 @@ public function assertIsSchemaOOXMLValid(): void { // validate all XML files $path = realpath($this->workDirectory . '/ppt'); - $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path)); + $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)); foreach ($iterator as $file) { - /** @var \SplFileInfo $file */ + /** @var SplFileInfo $file */ if ('xml' !== $file->getExtension()) { continue; } @@ -479,11 +482,11 @@ public function assertIsSchemaOpenDocumentValid(string $version = '1.0', bool $t // validate all XML files $path = realpath($this->workDirectory); - $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path)); + $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)); $isValid = true; foreach ($iterator as $file) { - /** @var \SplFileInfo $file */ + /** @var SplFileInfo $file */ if ('xml' !== $file->getExtension()) { continue; } @@ -530,15 +533,19 @@ protected function failXmlError(LibXMLError $error, string $fileName, string $so switch ($error->level) { case LIBXML_ERR_WARNING: $errorType = 'warning'; + break; case LIBXML_ERR_ERROR: $errorType = 'error'; + break; case LIBXML_ERR_FATAL: $errorType = 'fatal'; + break; default: $errorType = 'Error'; + break; } $errorLine = (int) $error->line; diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 88d30d03c..8d83f9d83 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -12,7 +12,6 @@ * * @see https://github.com/PHPOffice/PHPPresentation * - * @copyright 2009-2015 PHPPresentation contributors * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ @@ -37,12 +36,12 @@ } } -spl_autoload_register(function ($class) { +spl_autoload_register(function ($class): void { $class = ltrim($class, '\\'); $prefix = 'PhpOffice\\PhpPresentation\\Tests'; if (0 === strpos($class, $prefix)) { $class = str_replace('\\', DIRECTORY_SEPARATOR, $class); - $class = join(DIRECTORY_SEPARATOR, ['PhpPresentation', 'Tests', '_includes']) . + $class = implode(DIRECTORY_SEPARATOR, ['PhpPresentation', 'Tests', '_includes']) . substr($class, strlen($prefix)); $file = __DIR__ . DIRECTORY_SEPARATOR . $class . '.php'; if (file_exists($file)) {