FOF30\Factory\SwitchFactory::transparentAuthentication PHP Method

transparentAuthentication() public method

Creates a new TransparentAuthentication
public transparentAuthentication ( array $config = [] ) : TransparentAuthentication
$config array The configuration values for the TransparentAuthentication object
return FOF30\TransparentAuthentication\TransparentAuthentication
    public function transparentAuthentication(array $config = array())
    {
        $toolbarClass = $this->container->getNamespacePrefix($this->getSection()) . 'TransparentAuthentication\\TransparentAuthentication';
        try {
            return $this->createTransparentAuthentication($toolbarClass, $config);
        } catch (TransparentAuthenticationNotFound $e) {
            // Not found. Let's go on.
        }
        $toolbarClass = $this->container->getNamespacePrefix('inverse') . 'TransparentAuthentication\\TransparentAuthentication';
        try {
            return $this->createTransparentAuthentication($toolbarClass, $config);
        } catch (TransparentAuthenticationNotFound $e) {
            // Not found. Return the default TransparentAuthentication
            return new TransparentAuthentication($this->container, $config);
        }
    }

Usage Example

コード例 #1
0
ファイル: SwitchFactoryTest.php プロジェクト: Joal01/fof
 /**
  * @group           SwitchFactory
  * @covers          FOF30\Factory\SwitchFactory::transparentAuthentication
  * @dataProvider    SwitchFactoryDataprovider::getTestTransparentAuthentication
  */
 public function testTransparentAuthentication($test, $check)
 {
     $msg = 'SwitchFactory::transparentAuthentication %s - Case: ' . $check['case'];
     $container = new TestContainer(array('componentName' => $test['component']));
     $platform = $container->platform;
     $platform::$isAdmin = $test['backend'];
     $factory = new SwitchFactory($container);
     $result = $factory->transparentAuthentication();
     $this->assertEquals($check['result'], get_class($result), sprintf($msg, 'Returned the wrong result'));
 }