<commit_before><?php
/**
 * conjoon
 * (c) 2002-2009 siteartwork.de/conjoon.org
 * <EMAIL>
 *
 * $Author$
 * $Id$
 * $Date$
 * $Revision$
 * $LastChangedDate$
 * $LastChangedBy$
 * $URL$
 */

/**
 * @see Zend_Cache
 */
require_once 'Zend/Cache.php';

/**
 * @see Conjoon_Builder
 */
require_once 'Conjoon/Builder.php';


class Conjoon_Modules_Service_Twitter_Account_Builder extends Conjoon_Builder {

    protected $_validGetOptions = array('userId');

    /**
     * Returns either a cahced list of twitter accounts for a user, or
     * the accounts out of the database which will immediately be validated
     * against the twitter service (network access)
     *
     * @param array $options An associative array with the following
     * key value/pairs:
     *   - userId: the id of the user to fetch al twitter accounts for
     *
     *
     * @return Array anr array with instances of
     * Conjoon_Modules_Service_Twitter_Account_Model_Account
     */
    protected function _get(Array $options)
    {
        $userId = $options['userId'];

        $cacheId = (string)$userId;

        $cache = $this->_cache;

        if (!($cache->test($cacheId))) {

            /**
             * @see Conjoon_BeanContext_Decorator
             */
            require_once 'Conjoon/BeanContext/Decorator.php';
            $decoratedModel = new Conjoon_BeanContext_Decorator(
                'Conjoon_Modules_Service_Twitter_Account_Model_Account'
            );

            $accounts = $decoratedModel->getAccountsForUserAsDto($userId);

            /**
             * @see Zend_Service_Twitter
             */
            require_once 'Zend/Service/Twitter.php';

            for ($i = 0, $len = count($accounts); $i < $len; $i++) {
                $dto =& $accounts[$i];
                $dto->updateInterval = ((int)$dto->updateInterval) * 1000;

                try {
                    /**<commit_msg> - fixed: updated Account Builder for Twitter accounts to new Builder API<commit_after><?php
/**
 * conjoon
 * (c) 2002-2009 siteartwork.de/conjoon.org
 * <EMAIL>
 *
 * $Author$
 * $Id$
 * $Date$
 * $Revision$
 * $LastChangedDate$
 * $LastChangedBy$
 * $URL$
 */

/**
 * @see Zend_Cache
 */
require_once 'Zend/Cache.php';

/**
 * @see Conjoon_Builder
 */
require_once 'Conjoon/Builder.php';


class Conjoon_Modules_Service_Twitter_Account_Builder extends Conjoon_Builder {

    protected $_validGetOptions = array('userId');

    /**
     *
     * @param array $options An associative array with the following
     * key value/pairs:
     *   - userId: the id of the user to fetch al twitter accounts for
     */
    protected function _buildId(Array $options)
    {
        return (string)$options['userId'];
    }

    /**
     * Returns either a cahced list of twitter accounts for a user, or
     * the accounts out of the database which will immediately be validated
     * against the twitter service (network access)
     *
     * @param array $options An associative array with the following
     * key value/pairs:
     *   - userId: the id of the user to fetch al twitter accounts for
     *
     *
     * @return Array anr array with instances of
     * Conjoon_Modules_Service_Twitter_Account_Model_Account
     */
    protected function _get(Array $options)
    {
        $userId = $options['userId'];

        $cacheId = $this->_buildId($options);

        $cache = $this->_cache;

        if (!($cache->test($cacheId))) {

            /**
             * @see Conjoon_BeanContext_Decorator
             */
            require_once 'Conjoon/BeanContext/Decorator.php';
            $decoratedModel = new Conjoon_BeanContext_Decorator(
                'Conjoon_Modules_Service_Twitter_Account_Model_Account'
            );

            $accounts = $decoratedModel->getAccountsForUserAsDto($userId);

            /**
             * @see Zend_Service_Twitter
             */
            require_once 'Zend/Service/Twitter.php';

            for ($i = 0, $len = count($accounts); $i < $len; $i++) {
                $dto =& $accounts[$i];
                $dto->updateInterval = ((int)$dto->updateInterval) * 1000;

                try {
                    /**
{'fraction_non_alphanumeric': 0.11478552600047927, 'fraction_numerical': 0.006230529595015576, 'mean_word_length': 2.233152594887684, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 16, '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': '1221630', 'n_tokens_mistral': 1293, 'n_tokens_neox': 1226, 'n_words': 296}