original_string: public function is_system_account_connected() {
          if (!$this->is_configured()) {
              return false;
          }
          $sys = system_account::get_record(['issuerid' => $this->get('id')]);
          if (empty($sys) || empty($sys->get('refreshtoken'))) {
              return false;
          }
  
          $scopes = api::get_system_scopes_for_issuer($this);
  
          $grantedscopes = $sys->get('grantedscopes');
  
          $scopes = explode(' ', $scopes);
  
          foreach ($scopes as $scope) {
              if (!empty($scope)) {
                  if (strpos(' ' . $grantedscopes . ' ', ' ' . $scope . ' ') === false) {
                      // We have not been granted all the scopes that are required.
                      return false;
                  }
              }
          }
  
          return true;
      }
code: public function is_system_account_connected() {
          if (!$this->is_configured()) {
              return false;
          }
          $sys = system_account::get_record(['issuerid' => $this->get('id')]);
          if (empty($sys) || empty($sys->get('refreshtoken'))) {
              return false;
          }
  
          $scopes = api::get_system_scopes_for_issuer($this);
  
          $grantedscopes = $sys->get('grantedscopes');
  
          $scopes = explode(' ', $scopes);
  
          foreach ($scopes as $scope) {
              if (!empty($scope)) {
                  if (strpos(' ' . $grantedscopes . ' ', ' ' . $scope . ' ') === false) {
                      // We have not been granted all the scopes that are required.
                      return false;
                  }
              }
          }
  
          return true;
      }
code_tokens: public function is_system_account_connected ( ) { if ( ! $ this -> is_configured ( ) ) { return false ; } $ sys = system_account :: get_record ( [ 'issuerid' => $ this -> get ( 'id' ) ] ) ; if ( empty ( $ sys ) || empty ( $ sys -> get ( 'refreshtoken' ) ) ) { return false ; } $ scopes = api :: get_system_scopes_for_issuer ( $ this ) ; $ grantedscopes = $ sys -> get ( 'grantedscopes' ) ; $ scopes = explode ( ' ' , $ scopes ) ; foreach ( $ scopes as $ scope ) { if ( ! empty ( $ scope ) ) { if ( strpos ( ' ' . $ grantedscopes . ' ' , ' ' . $ scope . ' ' ) === false ) { // We have not been granted all the scopes that are required. return false ; } } } return true ; }
docstring: Do we have a refresh token for a system account?
  @return boolean
docstring_tokens: Do we have a refresh token for a system account?