Created
July 2, 2020 20:29
-
-
Save samadfcibd/d40f0bfc80ca93ed96a14875e8de4dcf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
abstract class PaymentStatusService | |
{ | |
public abstract function getStatus($payment_id); | |
} | |
class CreditCardPaymentStatus extends PaymentStatusService | |
{ | |
public function getStatus($payment_id) | |
{ | |
return 'success'; | |
} | |
} | |
class SonaliPaymentStatus extends PaymentStatusService | |
{ | |
public function getStatus($payment_id) | |
{ | |
return ['status' => 'success']; | |
} | |
} | |
$payment_status = new CreditCardPaymentStatus(); | |
$payment_status->getStatus(1); | |
$payment_status = new SonaliPaymentStatus(); | |
$payment_status->getStatus(1); | |
// Here the LSP violates !!! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment