Skip to content

Instantly share code, notes, and snippets.

View samadfcibd's full-sized avatar

Abdus Samad samadfcibd

View GitHub Profile
<?php
interface AuthenticationService
{
public function authenticate($email);
}
class GoogleAuthenticationService implements AuthenticationService
{
public function authenticate($email)
<?php
class GoogleAuthenticationService
{
public function authenticate($email)
{
return 'true';
}
}
<?php
interface PrinterInterface
{
public function print();
}
interface PhotocopyInterface
{
public function photocopy();
<?php
interface PrinterInterface
{
public function print();
public function photocopy();
public function scan();
}
<?php
abstract class PaymentStatusService
{
public abstract function getStatus($payment_id);
}
class CreditCardPaymentStatus extends PaymentStatusService
{
public function getStatus($payment_id)
<?php
interface paymentInterface
{
public function pay();
}
class payWithPaypal implements paymentInterface
{
public function pay()
<?php
class PaymentService
{
public function payWithPaypal()
{
// pay with paypal
}
public function payWithCreditCard()
<?php
class userInfo
{
public function getUserName()
{
return 'name';
}
public function getUserAddress()
<?php
class userInfo
{
public function getUserName()
{
return 'name';
}
// Here SRP violates
# Python needs a MySQL driver to access the MySQL database.
import mysql.connector
# Start by creating a connection to the database.
mydb = mysql.connector.connect(
host="192.168.152.221",
user="ocpl",
passwd="ocpl@321",