getMenuStyle() private method

Recursively drop back to the parents menu style when the current menu has a parent and has no changes
private getMenuStyle ( ) : MenuStyle
return MenuStyle
示例#1
0
 /**
  * Recursively drop back to the parents menu style
  * when the current menu has a parent and has no changes
  *
  * @return MenuStyle
  */
 private function getMenuStyle()
 {
     if (null === $this->parent) {
         return $this->buildStyle();
     }
     if ($this->style !== MenuStyle::getDefaultStyleValues()) {
         return $this->buildStyle();
     }
     return $this->parent->getMenuStyle();
 }
示例#2
0
 /**
  * Recursively drop back to the parents menu style
  * when the current menu has a parent and has no changes
  *
  * @return MenuStyle
  */
 private function getMenuStyle()
 {
     $diff = array_udiff_assoc($this->style, $this->getStyleClassDefaults(), function ($current, $default) {
         if ($current instanceof TerminalInterface) {
             return 0;
         }
         return $current === $default ? 0 : 1;
     });
     if (!$diff && null !== $this->parent) {
         return $this->parent->getMenuStyle();
     }
     return new MenuStyle(...array_values($this->style));
 }