-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathweb.php
More file actions
52 lines (43 loc) · 1.68 KB
/
Copy pathweb.php
File metadata and controls
52 lines (43 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
use App\Solid\OpenCloseResponsibility\AreaCalculation\Circle;
use App\Solid\OpenCloseResponsibility\AreaCalculation\Rectangle;
use App\Solid\OpenCloseResponsibility\AreaCalculation\Testangle;
use App\Solid\OpenCloseResponsibility\AreaCalculation\Triangle;
use App\Solid\OpenCloseResponsibility\AreaCalculation\AreaCalculator;
use App\Solid\OpenCloseResponsibility\PaymentMethod\CodPaymentMethod;
use App\Solid\OpenCloseResponsibility\PaymentMethod\PaymentService;
use App\Solid\SingleResponsibility\CsvExport;
use App\Solid\SingleResponsibility\PdfExport;
use App\Solid\SingleResponsibility\SaleReport;
use Illuminate\Support\Facades\Route;
Route::get('/single-responsibility', function () {
return (new SaleReport())->getSaleReportBetween('2024-01-01', '2024-12-31')->exportReport(
new CsvExport() // Or (Any Single Export Class that implement SalesReportExportFormatInterface)
// new PdfExport()
);
});
Route::get('/open-closed-responsibility', function () {
/**
* Area Calculation Example
*/
// This call via array argument. and check the Interface instance in its function.
// return (new AreaCalculator())->totalArea([
// new Rectangle(12,20),
// new Rectangle(20,20),
// new Circle(20)
// ]);
// // it's not array. it's instance of ShapeInterface
return (new AreaCalculator())->totalArea(
new Rectangle(12,20),
new Triangle(20,20),
new Circle(20),
new Testangle(20,10),
);
/**
* Payment Method Example
*/
return (new PaymentService)->pay(new CodPaymentMethod());
});
Route::get('/', function () {
// return (new PaymentService)->pay(new CodPaymentMethod());
});