PHP Classes

File: config/setDirectory.php

Recommend this page to a friend!
  Classes of Till Wehowski   Lazy PHP Event Handler   config/setDirectory.php   Download  
File: config/setDirectory.php
Role: Configuration script
Content type: text/plain
Description: Configuration script
Class: Lazy PHP Event Handler
Register event handlers to be loaded dynamically
Author: By
Last change:
Date: 2 years ago
Size: 703 bytes
 

Contents

Class file image Download
<?php
use Psr\Container\ContainerInterface;
use function
DI\decorate;


return [
   
   
   
'dir.compiled.events' =>function (ContainerInterface $c) {
        
$d = $c->get('project')->dir.\DIRECTORY_SEPARATOR.'compiled'.\DIRECTORY_SEPARATOR.'~events';
             if(!
is_dir($d)){
              
mkdir($d, 0755, true);
             }
      return
$d;
        },
   
   
'state.emitter' => decorate(function($emitter, ContainerInterface $c){
      
$emitter->once('bootstrap', function($eventName, $emitter, \webfan\hps\Event $Event){
                \
Webfan\App\EventModule::setBaseDir($Event->getArgument('container')->get('dir.compiled.events'));
           });
        return
$emitter;
    }),
   
   

       
];