Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Refactoring and base64 #5

Merged
merged 22 commits into from
Apr 3, 2024
Merged

Refactoring and base64 #5

merged 22 commits into from
Apr 3, 2024

Conversation

renfordt
Copy link
Owner

@renfordt renfordt commented Apr 3, 2024

  • base64 encryption for InitialsAvatars
  • Refactoring of Colors class
  • More tests

renfordt added 22 commits March 31, 2024 23:28
The source code related to color conversion and adjustments is refactored for better readability and usability. The documentation for the methods was edited to be more descriptive and accurate. Now, each method has a clear description, a thorough parameter documentation, and well-documented return values. This change enhances code maintainability and improves the developer experience.
Significant update to ColorTest class to include more tests for color conversion methods. Extended the test suite to cover conversions among Hex, RGB, HSL, HSV, and CVH formats. Also added tests for the `setHex` and `setRGB` methods.
The commit updates expected color results in multiple test cases to ensure more accurate testing. Specific error messages correlating to the failed test cases have also been added to facilitate better debugging. Additionally, the commit normalizes hexadecimal color values towards uppercase in the tests.
The expected result for the color test case involving RGB (0, 0, 255) was incorrect. This has been updated to reflect the accurate expected output. This change ensures the accuracy and reliability of the tests for color conversions.
The Larvatar class documentation has been revised for clarity and greater readability. The constructor of the class now contains more detailed descriptions for parameters, elaborating on their purpose and default values. Also, a new method documentation for 'setSize' method has been added.
This update introduces new test cases for both GravatarTest.php and LarvatarTest.php, mainly focusing on verification of different avatar types and size settings. Gravatar type tests have been implemented for InitialsAvatar, Gravatar, and MP types, while Larvatar size tests examine regular, large, and small sizes.
The functionality of the InitialsAvatar class has been divided into smaller methods to enhance readability and maintainability. Documentation was added to all methods, offering a clear and precise description of their function and parameters. This new design makes the code more modular and easier to understand.
This commit refactors the GitHub Actions workflow for the PHP project. It adds a new job for dependency validation, revises existing jobs for better maintenance, and enhances the structure of the whole workflow. The code coverage task has been improved as well for better performance and accuracy.
The CodeClimate reporter ID used in the PHP workflow on GitHub has been updated. This new ID ensures accurate and up-to-date reporting on CodeClimate for our code coverage results.
The Color.php file was refactored to improve readability and streamline its logic. Color calculations are now separated into distinct methods and redundant code was eliminated. The changes also include reordering class methods for consistent access modifiers.
The name for the test suite in the phpunit.xml file has been changed from "Larvatar Test Suite" to "default". The update aligns the specified name with the general test naming convention.
The color scheme for generating avatars has been updated in test cases. This change involves updating the SVG generation code within the LarvatarTest and InitialsAvatarTest files. The expectation strings in equality assertions have been updated to reflect the new color values.
The README file has been updated with new badge links to provide more complete information about the package. Some minor text changes have also been made, including modifying the installation instructions and simplifying the explanation of usage.
An optional parameter `encoding` has been added to the `generate` method in the InitialsAvatar.php file. This parameter allows the SVG code of the initials to be returned in base64 encoding if specified.
Expanded the testHexToRGB method within ColorTest. Each test case now includes detailed color-specific names for clarity. The ability to identify failed test cases is also improved by using individual assert statements for each scenario.
Two new test cases have been added to ColorTest for RGBToHSL conversion. The method is now tested with 'Mountain Meadow' and '#8c5a45' color codes to ensure correct color conversions.
The test case for color Mountain Meadow in ColorTest.php has been modified. The expected result of the RGBToHSL function was slightly incorrect and has now been updated for the accurate testing.
The color values in the SVG output of the Larvatar and InitialsAvatar classes have been modified in the test scripts. These changes reflect the updated color scheme for avatar generation - from a previous pink (#e8d2dc) to a lighter version (#f3dde7), and from a dark red (#690230) to a brighter purple (#9c3563).
Exception handling has been added to RGB color calculation to ensure all input values are set before proceeding to finalize calculation, hence improving system stability. The calculateRGBRange and finalizeRGBCalculation methods have also been updated with better structured and comprehensive docstrings as well as added functionality for better color computation.
This commit introduces a new test case to the `InitialsAvatarTest` suite. This new test verifies that the `generate()` function, with 'base64' as an argument, provides the expected Base64 output.
The getImageHTML method in the Larvatar class now accepts an optional encoding parameter. When 'base64' is passed in as the encoding type, it generates a base64-encoded version of the image. In any other case, it generates the image without encoding.
In the README file, a section has been added that provides instructions on how to implement base64 encryption. Please note, this encryption method currently only works with the InitialsAvatar type.
@renfordt renfordt merged commit edb142b into main Apr 3, 2024
10 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant