public function setStyle($style, Document $document = NULL) {
    $class = 'ChapterThree\AppleNewsAPI\Document\Styles\ComponentStyle';
    if (is_string($style)) {
      // Check that style exists.
      if ($document &&
          empty($document->getComponentStyles()[$style])
      ) {
        $this->triggerError("No component style \"${style}\" found.");
        return $this;
      }
    }
    elseif (!$style instanceof $class) {
      $this->triggerError("Style not of class ${class}.");
      return $this;
    }
    $this->style = $style;
    return $this;
  }
public function setStyle($style, Document $document = NULL) {
    $class = 'ChapterThree\AppleNewsAPI\Document\Styles\ComponentStyle';
    if (is_string($style)) {
      // Check that style exists.
      if ($document &&
          empty($document->getComponentStyles()[$style])
      ) {
        $this->triggerError("No component style \"${style}\" found.");
        return $this;
      }
    }
    elseif (!$style instanceof $class) {
      $this->triggerError("Style not of class ${class}.");
      return $this;
    }
    $this->style = $style;
    return $this;
  }
public function setStyle ( $ style , Document $ document = NULL ) { $ class = 'ChapterThree\AppleNewsAPI\Document\Styles\ComponentStyle' ; if ( is_string ( $ style ) ) { // Check that style exists. if ( $ document && empty ( $ document -> getComponentStyles ( ) [ $ style ] ) ) { $ this -> triggerError ( "No component style \"${style}\" found." ) ; return $ this ; } } elseif ( ! $ style instanceof $ class ) { $ this -> triggerError ( "Style not of class ${class}." ) ; return $ this ; } $ this -> style = $ style ; return $ this ; }
Setter for style.

@param \ChapterThree\AppleNewsAPI\Document\Styles\ComponentStyle|string $style
Either a ComponentStyle object, or a string reference to one defined in
$document.
@param \ChapterThree\AppleNewsAPI\Document|NULL $document
If required by first parameter.

@return $this
Setter for style .