<commit_before><?php


namespace Carvefx\Calendar;


class AbstractCarbonWrapper
{
  /**
   * @var \Carbon\Carbon
   */
  protected $carbon;

  /**
   * Attempts to query Carbon for the property
   *
   * @param $prop
   * @return \DateTimeZone|int|string
   */
  public function __get($prop)
  {
    return $this->carbon->$prop;
  }

  /**
   * Attempts to query Carbon for the property
   *
   * @param $method
   * @param $args
   * @return mixed
   */
  public function __call($method, $args)
  {
    $result = call_user_func_array([$this->carbon, $method], $args);

    if (!$this->isModifierMethod($method)) {
      return $result;
    }

    return $this;
  }

  /**
   * @param $method
   * @return bool
   */
  protected function isModifierMethod($method)
  {
    $pattern = '/^add|^sub/';
    preg_match($pattern, $method, $matches);
    if (count($matches)) {
      return true;
    }

    return false;
  }
}<commit_msg>+ fixed problem with clone on the Day object<commit_after><?php


namespace Carvefx\Calendar;


class AbstractCarbonWrapper
{
  /**
   * @var \Carbon\Carbon
   */
  protected $carbon;

  /**
   * Attempts to query Carbon for the property
   *
   * @param $prop
   * @return \DateTimeZone|int|string
   */
  public function __get($prop)
  {
    return $this->carbon->$prop;
  }

  /**
   * Attempts to query Carbon for the property
   *
   * @param $method
   * @param $args
   * @return mixed
   */
  public function __call($method, $args)
  {
    if (! $this->isModifierMethod($method)) {
      return call_user_func_array([$this->carbon, $method], $args);
    }

    $this->carbon = call_user_func_array([$this->carbon, $method], $args);
    return $this;
  }

  /**
   * @param $method
   * @return bool
   */
  protected function isModifierMethod($method)
  {
    $pattern = '/^add|^sub/';
    preg_match($pattern, $method, $matches);
    if (count($matches)) {
      return true;
    }

    return false;
  }


  /**
   * Force copy of the carbon object to
   * avoid it being passed by reference.
   */
  public function __clone()
  {
    $this->carbon = clone $this->carbon;
  }
}
{'fraction_non_alphanumeric': 0.14771118452100046, 'fraction_numerical': 0.0, 'mean_word_length': 2.623931623931624, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, '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': '5387429', 'n_tokens_mistral': 735, 'n_tokens_neox': 707, 'n_words': 169}