original_string: public function setAccessTokenFromProfile(TwitterProfile $profile)
      {
          $tokens = $profile->get(['access_token', 'access_token_secret']);
  
          if (!empty($tokens['access_token'])) {
              $this->app['twitter']->setTokens($tokens['access_token'], $tokens['access_token_secret']);
              $this->profile = $profile;
          } else {
              // use the access token from profile that referenced this profile
              $referencingProfile = $profile->relation('most_recently_referenced_by');
  
              // recursion would be nice here, but could be dangerous
              $tokens = $referencingProfile->get(['access_token', 'access_token_secret']);
  
              if ($referencingProfile->exists() && !empty($tokens['access_token'])) {
                  $this->app['twitter']->setTokens($tokens['access_token'], $tokens['access_token_secret']);
                  $this->profile = $referencingProfile;
              }
          }
  
          return $this;
      }
code: public function setAccessTokenFromProfile(TwitterProfile $profile)
      {
          $tokens = $profile->get(['access_token', 'access_token_secret']);
  
          if (!empty($tokens['access_token'])) {
              $this->app['twitter']->setTokens($tokens['access_token'], $tokens['access_token_secret']);
              $this->profile = $profile;
          } else {
              // use the access token from profile that referenced this profile
              $referencingProfile = $profile->relation('most_recently_referenced_by');
  
              // recursion would be nice here, but could be dangerous
              $tokens = $referencingProfile->get(['access_token', 'access_token_secret']);
  
              if ($referencingProfile->exists() && !empty($tokens['access_token'])) {
                  $this->app['twitter']->setTokens($tokens['access_token'], $tokens['access_token_secret']);
                  $this->profile = $referencingProfile;
              }
          }
  
          return $this;
      }
code_tokens: public function setAccessTokenFromProfile ( TwitterProfile $ profile ) { $ tokens = $ profile -> get ( [ 'access_token' , 'access_token_secret' ] ) ; if ( ! empty ( $ tokens [ 'access_token' ] ) ) { $ this -> app [ 'twitter' ] -> setTokens ( $ tokens [ 'access_token' ] , $ tokens [ 'access_token_secret' ] ) ; $ this -> profile = $ profile ; } else { // use the access token from profile that referenced this profile $ referencingProfile = $ profile -> relation ( 'most_recently_referenced_by' ) ; // recursion would be nice here, but could be dangerous $ tokens = $ referencingProfile -> get ( [ 'access_token' , 'access_token_secret' ] ) ; if ( $ referencingProfile -> exists ( ) && ! empty ( $ tokens [ 'access_token' ] ) ) { $ this -> app [ 'twitter' ] -> setTokens ( $ tokens [ 'access_token' ] , $ tokens [ 'access_token_secret' ] ) ; $ this -> profile = $ referencingProfile ; } } return $ this ; }
docstring: Sets the appropriate Twitter API access token using
  a given Twitter Profile
  
  @param TwitterProfile $profile
  
  @return TwitterService
docstring_tokens: Sets the appropriate Twitter API access token using a given Twitter Profile