AppserverIo\Appserver\Application\Application::getClassLoader PHP Метод

getClassLoader() публичный Метод

Return the requested class loader instance
public getClassLoader ( string $identifier ) : AppserverIo\Appserver\Core\Interfaces\ClassLoaderInterface
$identifier string The unique identifier of the requested class loader
Результат AppserverIo\Appserver\Core\Interfaces\ClassLoaderInterface The class loader instance
    public function getClassLoader($identifier)
    {
        if (isset($this->classLoaders[$identifier])) {
            return $this->classLoaders[$identifier];
        }
    }

Usage Example

Пример #1
0
 /**
  * Test if the getter for a certain class loader works.
  *
  * @return void
  */
 public function testGetClassLoader()
 {
     $mockLoader = $this->getMock('\\AppserverIo\\Appserver\\Core\\Interfaces\\ClassLoaderInterface');
     $reflectionClass = new \ReflectionClass($mockLoader);
     $mockLoaderConfig = $this->getMock('\\AppserverIo\\Appserver\\Core\\Api\\Node\\ClassLoaderNodeInterface');
     $mockLoaderConfig->expects($this->any())->method('getName')->will($this->returnValue($reflectionClass->getShortName()));
     $this->application->addClassLoader($mockLoader, $mockLoaderConfig);
     $this->assertEquals($mockLoader, $this->application->getClassLoader($reflectionClass->getShortName()));
 }