original_string: public function getAllUnread(User $user = null)
      {
          // If there's no passed user, get the current logged in user
          $user = $user ?? Craft::$app->getUser();
  
          if ($user) {
              $notifications = NotificationsRecord::find()->where(['notifiable' => $user->id, 'read_at' => null])->all();
              return $this->formatNotificationData($notifications)->toArray();
          }
  
          // No notifications when we don't have a passed in or logged in user
          return [];
      }
code: public function getAllUnread(User $user = null)
      {
          // If there's no passed user, get the current logged in user
          $user = $user ?? Craft::$app->getUser();
  
          if ($user) {
              $notifications = NotificationsRecord::find()->where(['notifiable' => $user->id, 'read_at' => null])->all();
              return $this->formatNotificationData($notifications)->toArray();
          }
  
          // No notifications when we don't have a passed in or logged in user
          return [];
      }
code_tokens: public function getAllUnread ( User $ user = null ) { // If there's no passed user, get the current logged in user $ user = $ user ?? Craft :: $ app -> getUser ( ) ; if ( $ user ) { $ notifications = NotificationsRecord :: find ( ) -> where ( [ 'notifiable' => $ user -> id , 'read_at' => null ] ) -> all ( ) ; return $ this -> formatNotificationData ( $ notifications ) -> toArray ( ) ; } // No notifications when we don't have a passed in or logged in user return [ ] ; }
docstring: Get all unread notifications for a certain User
  
  @param User $user
  
  @return array
docstring_tokens: Get all unread notifications for a certain User