コード例 #1
0
ファイル: Helper.php プロジェクト: ripzappa0924/carte0.0.1
 /**
  * Lazy loads helpers.
  *
  * @param string $name Name of the property being accessed.
  * @return mixed Helper or property found at $name
  * @deprecated Accessing request properties through this method is deprecated and will be removed in 3.0.
  */
 public function __get($name)
 {
     if (isset($this->_helperMap[$name]) && !isset($this->{$name})) {
         $settings = array_merge((array) $this->_helperMap[$name]['config'], array('enabled' => false));
         $this->{$name} = $this->_View->addHelper($this->_helperMap[$name]['class'], $this->_config);
     }
     if (isset($this->{$name})) {
         return $this->{$name};
     }
 }
コード例 #2
0
ファイル: ViewTest.php プロジェクト: ripzappa0924/carte0.0.1
 /**
  * Test __get allowing access to helpers.
  *
  * @return void
  */
 public function testMagicGetAndAddHelper()
 {
     $View = new View();
     $View->addHelper('Html');
     $this->assertInstanceOf('Cake\\View\\Helper\\HtmlHelper', $View->Html);
 }