-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_modern.php
40 lines (33 loc) · 972 Bytes
/
test_modern.php
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
<?php declare(strict_types=1);
namespace Ivastly\GoAopHelloWorld\BankingSystem\Modern;
use Ivastly\GoAopHelloWorld\Aop\ApplicationAspectKernel;
require_once 'vendor/autoload.php';
/* Initialize AOP engine */
$applicationAspectKernel = ApplicationAspectKernel::getInstance();
$applicationAspectKernel->init(
[
'debug' => false, // before benchmark is run, debug should be set to false
'appDir' => __DIR__ . '/..',
'cacheDir' => __DIR__ . '/cache',
'includePaths' => [
__DIR__ . '/src',
],
]
);
/* --- */
$banks = [];
for ($i = 1; $i <= 1000; ++$i)
{
$className = "Ivastly\\GoAopHelloWorld\\BankingSystem\\Modern\\Bank$i";
$banks [] = new $className();
}
foreach ($banks as $bank)
{
$amount = 1;
for ($iteration = 40; $iteration > -40; --$iteration)
{
$amount += $iteration;
$bank->transaction($amount);
}
}
//var_dump($banks[50]); // class name here will be "Ivastly\GoAopHelloWorld\BankingSystem\Modern\Bank1__AopProxied"