<commit_before><?

namespace Lean\Model;

trait Traits {

  protected static $notifyOnCreate = false;
  
  public static function get($id) {
    $instance = new self ( $id );
    if ($instance->id)
      return $instance;
  }
  
  public static function all(){
    $instance = new self ();
    return $instance->findAll ();
  }

  public static function where(array $attrs, $asObjects = false) {
    $instance = new self ();
    return $instance->findMany($attrs, $asObjects);
  }

  protected static function getClassName(){
    return __CLASS__ ;
  }

  public static function instantiate(array $attrs){
    return new self ($attrs);
  }

  public static function create(array $attrs){
    $instance = new self($attrs);
    if ($instance->isValid()) {
      $instance->save($attrs);
      if (self::$notifyOnCreate) $instance->notifier->notifyOnCreate ( $instance->attrs () );
    }
    return $instance;
  }
  
}<commit_msg>Refactored.<commit_after><?

namespace Lean\Model;

trait Traits {

  protected static $notifyOnCreate = false;
  
  public static function get($id) {
    $instance = new self ( $id );
    if ($instance->id)
      return $instance;
  }
  
  public static function all(){
    $instance = new self ();
    return $instance->findAll ();
  }

  public static function where(array $attrs, $asObjects = false) {
    $instance = new self ();
    return $instance->findMany($attrs, $asObjects);
  }

  protected static function getClassName(){
    return __CLASS__ ;
  }

  public static function instantiate(array $attrs){
    return new self ($attrs);
  }

  public static function create(array $attrs){
    $instance = new self($attrs);
    if ($instance->isValid() && $instance->save($attrs)) {
      if (self::$notifyOnCreate) $instance->notifier->notifyOnCreate ( $instance->attrs () );
    }
    return $instance;
  }
  
}
{'fraction_non_alphanumeric': 0.1396103896103896, 'fraction_numerical': 0.0, 'mean_word_length': 3.2702078521939955, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 19, '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': '1650587', 'n_tokens_mistral': 550, 'n_tokens_neox': 544, 'n_words': 150}