- Added PPH-DI definition file
This commit is contained in:
		
							parent
							
								
									19aa25df1b
								
							
						
					
					
						commit
						d503628356
					
				@ -14,5 +14,14 @@
 | 
			
		||||
        "psr-4": {
 | 
			
		||||
            "Mcnd\\CLI\\": "src/"
 | 
			
		||||
        }
 | 
			
		||||
    },
 | 
			
		||||
    "extra": {
 | 
			
		||||
        "lean": {
 | 
			
		||||
            "autoload": {
 | 
			
		||||
                "definitions": [
 | 
			
		||||
                    "meta/definitions.php"
 | 
			
		||||
                ]
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										33
									
								
								meta/definitions.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								meta/definitions.php
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,33 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
use function DI\autowire, DI\create, DI\get;
 | 
			
		||||
 | 
			
		||||
use Psr\Http\Message\ResponseInterface;
 | 
			
		||||
 | 
			
		||||
use Mcnd\CLI\CliMiddleware;
 | 
			
		||||
 | 
			
		||||
use Notes\CLI\CommandFetcher;
 | 
			
		||||
 | 
			
		||||
use Lean\{ Factory, Lean };
 | 
			
		||||
 | 
			
		||||
return [
 | 
			
		||||
    CommandFetcher::class => function($c) {
 | 
			
		||||
        $fetcher = new CommandFetcher(null, null, $c->get('cli.caching'));
 | 
			
		||||
 | 
			
		||||
        $fetcher->setFolderList(array_map(function($item) {
 | 
			
		||||
            return $item;
 | 
			
		||||
        }, $c->get(Lean::class)->getCli()));
 | 
			
		||||
 | 
			
		||||
        return $fetcher;
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    CliMiddleware::class => function($c) {
 | 
			
		||||
        return new CliMiddleware($c, $c->get('cli.response:default'), $c->get(CommandFetcher::class));
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    'cli.response:default' => function($c) {
 | 
			
		||||
        return function() {
 | 
			
		||||
            return Factory\HttpFactory::createTextResponse("This is the default response from CLI middleware which indicates that no command were registered for this application.\n");
 | 
			
		||||
        };
 | 
			
		||||
    },
 | 
			
		||||
];
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user