original_string: public function getComponentsFlattened() {
      $components = [];
      foreach ($this->getComponents() as $component) {
        $components[] = $component;
        if ($component instanceof ComponentNested) {
          /** @var \ChapterThree\AppleNewsAPI\Document\Components\ComponentNested $component */
          $descendants = $component->getComponentsFlattened();
          array_merge($components, $descendants);
        }
      }
      return $components;
    }
code: public function getComponentsFlattened() {
      $components = [];
      foreach ($this->getComponents() as $component) {
        $components[] = $component;
        if ($component instanceof ComponentNested) {
          /** @var \ChapterThree\AppleNewsAPI\Document\Components\ComponentNested $component */
          $descendants = $component->getComponentsFlattened();
          array_merge($components, $descendants);
        }
      }
      return $components;
    }
code_tokens: public function getComponentsFlattened ( ) { $ components = [ ] ; foreach ( $ this -> getComponents ( ) as $ component ) { $ components [ ] = $ component ; if ( $ component instanceof ComponentNested ) { /** @var \ChapterThree\AppleNewsAPI\Document\Components\ComponentNested $component */ $ descendants = $ component -> getComponentsFlattened ( ) ; array_merge ( $ components , $ descendants ) ; } } return $ components ; }
docstring: Gets nested components as a flattened list.
  
  @return array
  List of \ChapterThree\AppleNewsAPI\Document\Components\Component.
docstring_tokens: Gets nested components as a flattened list .