attached() public static method

Example: Router::attach('app', array( 'absolute' => true, 'host' => '{:subdomain:[a-z]+}.{:hostname}.{:tld}', 'scheme' => '{:scheme:https://}', 'prefix' => '' )); $result = Router::attached('app', array( 'subdomain' => 'app', 'hostname' => 'blog', 'tld' => 'co.uk' )); Will give the following array in $result: array( 'absolute' => true, 'host' => 'blog.mysite.co.uk', 'scheme' => 'http://', 'prefix' => '' ));
public static attached ( $name = null, array $vars = [] ) : mixed
$vars array
return mixed The settings array of the scope or an array of settings array if `$name === null`.
Example #1
0
 protected function _saveCtrlContext()
 {
     $this->_context['scope'] = Router::scope(false);
     $this->_context['routes'] = Router::get();
     $this->_context['scopes'] = Router::attached();
     Router::reset();
 }
Example #2
0
 public function testListAttached()
 {
     Router::attach('scope1', array('prefix' => 'scope1', 'absolute' => true));
     Router::attach('scope2', array('prefix' => 'scope2', 'library' => 'app'));
     Router::attach('scope3', array('prefix' => 'scope3'));
     $expected = array('scope1' => array('prefix' => 'scope1', 'absolute' => true, 'host' => null, 'scheme' => null, 'base' => null, 'pattern' => '@^(.*?)//localhost/scope1/@', 'library' => 'scope1', 'values' => array(), 'params' => array()), 'scope2' => array('prefix' => 'scope2', 'library' => 'app', 'absolute' => false, 'host' => null, 'scheme' => null, 'base' => null, 'pattern' => '@^/scope2/@', 'values' => array(), 'params' => array()), 'scope3' => array('prefix' => 'scope3', 'absolute' => false, 'host' => null, 'scheme' => null, 'base' => null, 'pattern' => '@^/scope3/@', 'library' => 'scope3', 'values' => array(), 'params' => array()));
     $this->assertEqual($expected, Router::attached());
 }