code: public function takeRight($num)
      {
          if ($num > $this->count()) {
              $num = $this->count();
          }
  
          return $this->slice($this->count() - $num, $this->count());
      }
docs: {@inheritdoc}