Create and return a new naming subdirectory with the attributes
of this one.
public createSubdirectory ( string $name, array $filter = [] ) : |
||
$name | string | The name of the new subdirectory |
$filter | array | Array with filters that will be applied when copy the attributes |
return | The new naming subdirectory |
/** * Test if the search for a subdirectory works. * * @return void */ public function testSearchForASubdirectory() { // create a three level directory $level1 = $this->namingDirectory->createSubdirectory('level1'); $level2 = $level1->createSubdirectory('level2'); $level3 = $level2->createSubdirectory('level3'); // search for the last created subdirectory $this->assertInstanceOf('AppserverIo\\Psr\\Naming\\NamingDirectoryInterface', $this->namingDirectory->search('php:level1/level2/level3')); }
/** * Test if the search for a subdirectory works. * * @return void */ public function testSearchForASubdirectory() { // create a three level directory $level1 = $this->namingDirectory->createSubdirectory('level1'); $level2 = $level1->createSubdirectory('level2'); $level2->createSubdirectory('level3'); // search for the last created subdirectory $this->assertSame('.', $this->namingDirectory->search('php:level1/level2/level3')); }
$bootstrapFilename = sprintf('%s/etc/appserver/conf.d/bootstrap-commands.xml', APPSERVER_BP); } elseif (array_key_exists($watch, $arguments) && file_exists(sprintf('%s/etc/appserver/conf.d/bootstrap-watcher.xml', APPSERVER_BP))) { // set the default watcher boostrap file $bootstrapFilename = sprintf('%s/etc/appserver/conf.d/bootstrap-watcher.xml', APPSERVER_BP); } elseif (file_exists(sprintf('%s/etc/appserver/conf.d/bootstrap.xml', APPSERVER_BP))) { // try to load the default bootstrap file $bootstrapFilename = sprintf('%s/etc/appserver/conf.d/bootstrap.xml', APPSERVER_BP); } else { // throw an exception if we don't have a bootstrap file throw new \Exception('Can\'t find a bootstrap file'); } // create and initialize the naming directory $namingDirectory = new NamingDirectory(); $namingDirectory->setScheme('php'); // create a directory for the services $namingDirectory->createSubdirectory('php:env'); $namingDirectory->createSubdirectory('php:env/args'); $namingDirectory->createSubdirectory('php:global'); $namingDirectory->createSubdirectory('php:global/log'); $namingDirectory->createSubdirectory('php:services'); // create the default subdirectories foreach (array_keys(ApplicationServer::$runlevels) as $runlevel) { $namingDirectory->createSubdirectory(sprintf('php:services/%s', $runlevel)); } // bind the command line arguments to the naming directory foreach ($arguments as $name => $value) { $namingDirectory->bind(sprintf('php:env/args/%s', $name), empty($value) ? true : $value); } // bind the current user to the naming directory $namingDirectory->bind('php:env/currentUser', isset($_SERVER['SUDO_USER']) ? $_SERVER['SUDO_USER'] : get_current_user()); // bind the path to the default configuration and bootstrap filenames