igaster\laravelTheme\Themes::add PHP Метод

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

Add a new theme to the hierarcy. Optionaly define a parent theme.
public add ( Theme $theme, string $parentName = '' ) : Theme
$theme Theme
$parentName string
Результат Theme
    public function add(Theme $theme, $parentName = '')
    {
        $theme->addParent($parentName ? $this->find($parentName) : $this->root);
        return $theme;
    }

Usage Example

Пример #1
1
 public function testSetTheme()
 {
     $themes = new Themes();
     $theme1 = new Theme('theme1');
     $theme2 = new Theme('theme2');
     $themes->add($theme1);
     $themes->add($theme2);
     $themes->set('theme1');
     $this->assertEquals('theme1', $themes->get());
 }