<commit_before><?php

/**
 * This file is part of the OpenPNE package.
 * (c) OpenPNE Project (http://www.openpne.jp/)
 *
 * For the full copyright and license information, please view the LICENSE
 * file and the NOTICE file that were distributed with this source code.
 */

/**
 * activity data table
 *
 * @package    OpenPNE
 * @subpackage model
 * @author     <NAME> <<EMAIL>>
 */
class ActivityDataTable extends Doctrine_Table
{
  const PUBLIC_FLAG_OPEN    = 0;
  const PUBLIC_FLAG_SNS     = 1;
  const PUBLIC_FLAG_FRIEND  = 2;
  const PUBLIC_FLAG_PRIVATE = 3;

  protected static $publicFlags = array(
    self::PUBLIC_FLAG_OPEN    => 'All Users on the Web',
    self::PUBLIC_FLAG_SNS     => 'All Members',
    self::PUBLIC_FLAG_FRIEND  => '%my_friend%',
    self::PUBLIC_FLAG_PRIVATE => 'Private',
  );

  public function updateActivity($memberId, $body, $options = array())
  {
    $object = new ActivityData();
    $object->setMemberId($memberId);
    $object->setBody($body);

    if (isset($options['public_flag']))
    {
      $publicFlagKeys = array_keys($this->getPublicFlags(false));
      if (!in_array($options['public_flag'], $publicFlagKeys))
      {
        throw new LogicException('Invalid public flag');
      }
      $object->setPublicFlag($options['public_flag']);
    }

    if (isset($options['in_reply_to_activity_id']))
    {
      $object->setInReplyToActivityId($options['in_reply_to_activity_id']);
    }

    if (isset($options['is_pc']) && !$options['is_pc'])
    {
      $object->setIsPc(false);
    }
    if (isset($options['is_mobile']) && !$options['is_mobile'])
    {
      $object->setIsMobile(false);
    }

    if (isset($options['source']))
    {
      $object->setSource($options['source']);
      if (isset($options['source_uri']))
      {
        $object->setSourceUri($options['source_uri']);
      }
    }

    $activityImages = array();
    if (isset($options['images']))<commit_msg>added new option to ActivityDataTable::updateActivity() (refs #230)<commit_after><?php

/**
 * This file is part of the OpenPNE package.
 * (c) OpenPNE Project (http://www.openpne.jp/)
 *
 * For the full copyright and license information, please view the LICENSE
 * file and the NOTICE file that were distributed with this source code.
 */

/**
 * activity data table
 *
 * @package    OpenPNE
 * @subpackage model
 * @author     <NAME> <<EMAIL>>
 */
class ActivityDataTable extends Doctrine_Table
{
  const PUBLIC_FLAG_OPEN    = 0;
  const PUBLIC_FLAG_SNS     = 1;
  const PUBLIC_FLAG_FRIEND  = 2;
  const PUBLIC_FLAG_PRIVATE = 3;

  protected static $publicFlags = array(
    self::PUBLIC_FLAG_OPEN    => 'All Users on the Web',
    self::PUBLIC_FLAG_SNS     => 'All Members',
    self::PUBLIC_FLAG_FRIEND  => '%my_friend%',
    self::PUBLIC_FLAG_PRIVATE => 'Private',
  );

  public function updateActivity($memberId, $body, $options = array())
  {
    $object = new ActivityData();
    $object->setMemberId($memberId);
    $object->setBody($body);

    if (isset($options['public_flag']))
    {
      $publicFlagKeys = array_keys($this->getPublicFlags(false));
      if (!in_array($options['public_flag'], $publicFlagKeys))
      {
        throw new LogicException('Invalid public flag');
      }
      $object->setPublicFlag($options['public_flag']);
    }

    if (isset($options['in_reply_to_activity_id']))
    {
      $object->setInReplyToActivityId($options['in_reply_to_activity_id']);
    }

    if (isset($options['is_pc']) && !$options['is_pc'])
    {
      $object->setIsPc(false);
    }
    if (isset($options['is_mobile']) && !$options['is_mobile'])
    {
      $object->setIsMobile(false);
    }

    if (isset($options['uri']))
    {
      $object->setUri($options['uri']);
    }

    if (isset($options['source']))
    {
      $object->setSource($options['source']);
      if (isset($options['source_uri']))
      {
        $object->setSourceUri($options['source_uri']);
      }
    }

    $activityImages = array();
    if (isset($options['images']))
{'fraction_non_alphanumeric': 0.15813140144891333, 'fraction_numerical': 0.0027479390457157134, 'mean_word_length': 3.458797327394209, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 36, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '7651264', 'n_tokens_mistral': 1312, 'n_tokens_neox': 1258, 'n_words': 256}