use Demo\Example\HumanDemo; use Demo\Example\IntroductionDemo; use Demo\Example\LoggingDemo; use Demo\Example\PropertyDemo; use Demo\Example\UserFluentDemo; use Demo\Highlighter; use Go\Instrument\Transformer\MagicConstantTransformer; $isAOPDisabled = isset($_COOKIE['aop_on']) && $_COOKIE['aop_on'] == 'false'; include __DIR__ . ($isAOPDisabled ? '/autoload.php' : '/autoload_aspect.php'); $showCase = isset($_GET['showcase']) ? $_GET['showcase'] : 'default'; $example = null; $aspectName = ''; switch ($showCase) { case 'cacheable': $aspectName = 'Demo\\Aspect\\CachingAspect'; $example = new CacheableDemo(); $result = $example->getReport(12345); // First call will take 0.1 second echo "Result is: ", $result, PHP_EOL; $result = $example->getReport(12346); // This call is cached and result should be '12345' echo "Result is: ", $result, PHP_EOL; break; case 'loggable': $aspectName = 'Demo\\Aspect\\LoggingAspect'; $example = new LoggingDemo(); $example->execute('LoggingTask'); // Logging for dynamic methods LoggingDemo::runByName('StaticTask'); // Logging for static methods break;