-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HP-1631: added into Customer entity state #73
base: master
Are you sure you want to change the base?
Changes from 12 commits
96029e2
0b6a488
302f89d
d54f6d9
2b04c3a
7c1611c
a8886bc
ca0fe01
6a368f5
ebdf697
9828d4c
b34a233
1e0f18e
41cacd7
22c85c2
37c07ba
dfb7231
c9a4c9b
2981ac3
183a7dc
04a6a3c
7006e78
db98bad
dd9c18c
a172483
18bd6e5
2da650c
11e129f
9b70aed
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace hiqdev\php\billing\customer; | ||
|
||
enum CustomerState: string | ||
{ | ||
case BLOCKED = 'blocked'; | ||
case DELETED = 'deleted'; | ||
case NEW = 'new'; | ||
case OK = 'ok'; | ||
|
||
public static function isDeleted(CustomerInterface $customer): bool | ||
{ | ||
return $customer->getState() === self::DELETED; | ||
} | ||
|
||
public static function deleted(): CustomerState | ||
{ | ||
return self::DELETED; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -106,7 +106,7 @@ public function calculatePrice(PriceInterface $price, ActionInterface $action): | |
$charges = [$charge]; | ||
} | ||
|
||
if ($action->isFinished()) { | ||
if ($action->isNotActive()) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Codebase verification Inconsistent Method Usage Detected The 🔗 Analysis chainVerify the semantic change and its implications The condition for setting charges as finished has been changed from
To ensure consistency across the codebase, run the following script: Consider adding a comment explaining the rationale behind this change to improve code maintainability. 🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Description: Check for usage of isFinished() and isNotActive() methods
# Test 1: Check for remaining usages of isFinished()
echo "Checking for remaining usages of isFinished():"
rg --type php 'isFinished\(\)'
# Test 2: Check for new usages of isNotActive()
echo "Checking for new usages of isNotActive():"
rg --type php 'isNotActive\(\)'
# Test 3: Check if ActionInterface has been updated
echo "Checking if ActionInterface has been updated:"
rg --type php -p 'ActionInterface.php' 'function isNotActive\(\)'
Length of output: 1297 Script: #!/bin/bash
# Description: Locate ActionInterface.php and verify the presence of isNotActive() method
# Test 1: Find the path to ActionInterface.php
echo "Locating ActionInterface.php in the repository:"
fd --type f 'ActionInterface\.php'
# Test 2: If found, check for the isNotActive() method within the file
# Note: This test will only run if the previous test finds the file
FILE_PATH=$(fd --type f 'ActionInterface\.php')
if [ -n "$FILE_PATH" ]; then
echo "Checking for isNotActive() method in $FILE_PATH:"
rg 'function\s+isNotActive\s*\(' "$FILE_PATH"
else
echo "ActionInterface.php not found in the repository."
fi
Length of output: 867 Script: #!/bin/bash
# Description: Locate the primary ActionInterface.php and verify the presence of isNotActive() method
# Test 1: Find the primary ActionInterface.php file, excluding temporary or backup files
echo "Locating the primary ActionInterface.php in the repository:"
fd --type f 'ActionInterface\.php' | grep -v 'TemporaryActionInterface\.php'
# Assign the found file to a variable
FILE_PATH=$(fd --type f 'ActionInterface\.php' | grep -v 'TemporaryActionInterface\.php')
# Test 2: If the primary ActionInterface.php is found, check for the isNotActive() method
if [ -n "$FILE_PATH" ]; then
echo "Checking for isNotActive() method in $FILE_PATH:"
rg 'function\s+isNotActive\s*\(' "$FILE_PATH"
else
echo "Primary ActionInterface.php not found in the repository."
fi
Length of output: 661 |
||
foreach ($charges as $charge) { | ||
$charge->setFinished(); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codebase verification
Update Remaining Usages of
isFinished()
toisNotActive()
The method
isFinished()
is still used in the following files:src/bill/Bill.php
src/charge/Charge.php
Please update these method calls to
isNotActive()
to maintain consistency and prevent potential errors.🔗 Analysis chain
Approve renaming
isFinished()
toisNotActive()
with suggestionsThe renaming of
isFinished()
toisNotActive()
improves clarity and aligns better with the method's functionality. The internal logic update is consistent with this change.Consider adding a PHPDoc comment to explain the purpose and behavior of the
isNotActive()
method, especially if it differs from the previousisFinished()
method.Please run the following script to check for any remaining usage of the
isFinished()
method in the codebase:Ensure that all occurrences of
isFinished()
are updated toisNotActive()
if they refer to this class.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 226