made some refactoring
This commit is contained in:
14
resources/view/principles/liskov-substitution.php
Normal file
14
resources/view/principles/liskov-substitution.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package: patterns
|
||||
* @author: Yevhen Odynets
|
||||
* @date: 2025-07-07
|
||||
* @time: 08:36
|
||||
*/
|
||||
|
||||
declare(strict_types = 1);
|
||||
|
||||
use Pattern\SOLID\LiskovSubstitution\Bird;
|
||||
|
||||
$bird = new Bird;
|
||||
23
resources/view/principles/open-closed.php
Normal file
23
resources/view/principles/open-closed.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package: patterns
|
||||
* @author: Yevhen Odynets
|
||||
* @date: 2025-07-07
|
||||
* @time: 05:52
|
||||
*/
|
||||
|
||||
declare(strict_types = 1);
|
||||
|
||||
// Separate extensible behaviour behind an interface, and flip the dependencies
|
||||
|
||||
use Pattern\SOLID\OpenClosed\Figures\AreaCalculator;
|
||||
use Pattern\SOLID\OpenClosed\Figures\Circle;
|
||||
use Pattern\SOLID\OpenClosed\Figures\Square;
|
||||
|
||||
$circle = new Circle(3);
|
||||
$square = new Square(2, 5);
|
||||
$areaCalculator = new AreaCalculator;
|
||||
|
||||
/** @noinspection ForgottenDebugOutputInspection */
|
||||
dump('Circle(3)', $areaCalculator->calculate([$circle, $square]));
|
||||
22
resources/view/principles/solid-single-responsibility.php
Normal file
22
resources/view/principles/solid-single-responsibility.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package: patterns
|
||||
* @author: Yevhen Odynets
|
||||
* @date: 2025-07-07
|
||||
* @time: 00:04
|
||||
*/
|
||||
|
||||
declare(strict_types = 1);
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Pattern\SOLID\SingleResponsibility\HtmlOutput;
|
||||
use Pattern\SOLID\SingleResponsibility\SalesReporter;
|
||||
use Pattern\SOLID\SingleResponsibility\SalesRepository;
|
||||
|
||||
$now = Carbon::now();
|
||||
$report = new SalesReporter(new SalesRepository);
|
||||
|
||||
$output = $report->between($now->clone()->subDays(10)->format('Y-m-d'), $now->format('Y-m-d'), new HtmlOutput);
|
||||
|
||||
echo($output);
|
||||
Reference in New Issue
Block a user