<commit_before><?php

namespace Inori\TwitterAppBundle\Services;

use \TwitterOAuth;

class TwitterApp {

    private $twitter;

    public function __construct(TwitterOAuth $twitter)
    {
        $this->twitter = $twitter;
    }
    
    public function getApi()
    {
        return $this->twitter;
    }
    
    public function tweet($status)
    {
        return $this->twitter->post('statuses/update', array('status' => $status));
    }
        
    public function follow($user)
    {
        return $this->twitter->post('friendships/create', array('screen_name' => $user));
    }
    
    public function sendDirectMessage($text, $user)
    {
        return $this->twitter->post('direct_messages/new', array('text' => $text, 'screen_name' => $user));
    }    
    
    public function getDirectMessages($since = false)
    {
        return $this->twitter->get('direct_messages', array('since_id' => $since));
    }
}<commit_msg>added docs to main service class<commit_after><?php

namespace Inori\TwitterAppBundle\Services;

use \TwitterOAuth;

/**
 * Very simple proxy class to TwitterOAuth functionality
 */
class TwitterApp {

    private $twitter;

    /**
     * @param \TwitterOAuth $twitter TwitterOAuth API client instance
     */
    public function __construct(TwitterOAuth $twitter)
    {
        $this->twitter = $twitter;
    }

    /**
     * Get oAuth client
     *
     * @return \TwitterOAuth
     */
    public function getApi()
    {
        return $this->twitter;
    }

    /**
     * Update status of a user (or tweet for short)
     *
     * @param string $status Message to tweet (max 140 characters)
     *
     * @return string JSON encoded array
     */
    public function tweet($status)
    {
        return $this->twitter->post('statuses/update', array('status' => $status));
    }

    /**
     * Follow a certain user
     *
     * @param string $user Username to follow
     *
     * @return string JSON encoded array
     */
    public function follow($user)
    {
        return $this->twitter->post('friendships/create', array('screen_name' => $user));
    }

    /**
     * Send DM to a given user
     *
     * @param string $text Message to send (max 140 characters)
     * @param string $user Username to send DM to
     *
     * @return string JSON encoded array
     */
    public function sendDirectMessage($text, $user)
    {
        return $this->twitter->post('direct_messages/new', array('text' => $text, 'screen_name' => $user));
    }

    /**
     * Fetch Direct Messages sent to app user
     *
     * @param string $since ID of DM after which to get updates
     *
     * @return string JSON encoded array
     */
    public function getDirectMessages($since = false)
    {
        return $this->twitter->get('direct_messages', array('since_id' => $since));
    }
}
{'fraction_non_alphanumeric': 0.1273434736469756, 'fraction_numerical': 0.0021223912274495934, 'mean_word_length': 2.4362089914945324, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '478030', 'n_tokens_mistral': 834, 'n_tokens_neox': 806, 'n_words': 217}